Jekyll自定义主题- gemspec捆绑安装错误:意外的unary-,期望的是keyword_do[英] Jekyll custom theme- gemspec bundle install error: unexpected unary-, expecting keyword_do

本文是小编为大家收集整理的关于Jekyll自定义主题- gemspec捆绑安装错误:意外的unary-,期望的是keyword_do的处理方法,想解了Jekyll自定义主题- gemspec捆绑安装错误:意外的unary-,期望的是keyword_do的问题怎么解决?Jekyll自定义主题- gemspec捆绑安装错误:意外的unary-,期望的是keyword_do问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

# coding: utf-8

Gem::Specification.new do |spec|
  spec.name          = "myJekyllTheme"
  spec.version       = "1.0.1"
  spec.authors       = ["Mai Walters"]
  spec.email         = ["maiverily@gmail.com"]

  spec.summary       = %q{A simple theme for my CMS class.}
  spec.homepage      = "https://www.github.uconn.edu/mvw13001/myJekyllTheme"
  spec.license       = "MIT"

  spec.files         = `git ls-files -z`.split("\x0").reject { |f| 
f.match(%r{^(test|spec|features)/}) }

  spec.add_runtime_dependency "jekyll", "~> 3.4"
  spec.add_development_dependency "bundler", "~> 1.12"
  spec.add_development_dependency "rake", "~> 10.0"
  spec.add_development_dependency "jekyll-polyglot", ">= 1.2.4"
  spec.add_development_dependency "jekyll-seo-tag", ">= 2.1.0"
  spec.add_development_dependency "jekyll-paginate", ">= 1.1.0"
  spec.add_development_dependency "jekyll-feed", "~> 0.6"
end

我正在使用此代码尝试创建一个 jekyll 主题,并且我正在设置我的 gemspec 文件,但是每次运行 bundle install 时,我都会收到此错误:

C:\Users\M\myJekyllTheme>bundle install

[!] There was an error parsing `Gemfile`: syntax error, unexpected unary-, 
expecting keyword_do or '{' or '(' - ....files         = git ls-files -
z.split("\x0").select { |f| f...
...                               ^. Bundler cannot continue.

 #  from C:/Users/M/myJekyllTheme/Gemfile:15
 #  -------------------------------------------
 #    spec.add_development_dependency "bundler", "~> 1.12"
 >  end #  source "https://rubygems.org"
#  -------------------------------------------

有人知道为什么会这样吗?

推荐答案

尝试改变这个:

spec.files = `git ls-files -z`.split("\x0").reject { |f| 
f.match(%r{^(test|spec|features)/}) }

到这个(一行):

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }

本文地址:https://www.itbaoku.cn/post/786369.html