我刚刚构建了一个CLI数据创业板,并将其发布到RubyGems。现在,如果我尝试进行捆绑安装,则会得到以下错误
You have one or more invalid gemspecs that need to be fixed.
The gemspec at
/home/himachhag-45739/code/popular-deals-from-slickdeals.net-`cli/popular_deals.gemspec`
is not valid. Please fix this gemspec.
The validation error was 'popular_deals-0.1.0 contains itself
(popular_deals-0.1.0.gem), check your files list'
请参阅下面的gmspec文件:
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'popular_deals/version'
Gem::Specification.new do |spec|
spec.name = "popular_deals"
spec.version = PopularDeals::VERSION
spec.authors = ["'Hima Chitalia'"]
spec.email = ["'hima_chhag@yahoo.com'"]
spec.summary = %q{It displays popular deals of the day from https://slickdeals.net/deals/.}
#spec.description = %q{It displays popular deals of the day from https://slickdeals.net/deals/.}
spec.homepage = "https://github.com/HimaChitalia/popular_deals"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.14"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "pry"
spec.add_dependency "nokogiri"
spec.add_dependency "colorize"
end
我该怎么做才能解决这个问题?提前谢谢你的帮助。
发布于 2017-04-03 21:46:09
来自http://siawyoung.com/coding/ruby/invalid-gemspec.html
结果发现发生这种情况是因为gemspec从命令中获取文件列表。
`git ls-files -z`.split("\x0")
因此,从存储库中删除文件popular_deals-0.1.0.gem
,它应该可以工作。
发布于 2018-08-12 15:18:09
rm popular_deals-0.1.0.gem
git add .
bundle install
注意,您需要gitadd.在包安装之前,因为您需要更新文件列表。
发布于 2020-10-13 13:39:13
我发现另一个不符合我的需要的答案是把我所有的不同版本上传到我的回购。
几分钟前,我遇到了同样的问题,请尝试修改您的gemspec‘file’属性如下:
spec.files = Dir.glob("{bin,lib}/**/*")
如果对你有用就告诉我。
https://stackoverflow.com/questions/43194205
复制相似问题