Ruby 加载错误与我的宝石
我用它做了一块宝石Ruby 加载错误与我的宝石,ruby,rubygems,Ruby,Rubygems,我用它做了一块宝石 $ gem build <gemspec> 我得到以下错误: LoadError: no such file to load -- xxxx from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in 'gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
$ gem build <gemspec>
我得到以下错误:
LoadError: no such file to load -- xxxx
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in 'gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in 'require'
我做错了什么?你能把你的
.gempec
文件也发出来吗
很可能您没有将文件包括在.files
数组中。比如说,
Gem::Specification.new do |s|
# Other specifications
s.files = ["bin/google", "lib/google.rb", "lib/google/utils.rb"]
s.files += ["LICENSE.md", "README.md", "google.gemspec"]
end
如果我的gemspec中有运行时依赖项。如何安装该gem。我仍然使用:$gem安装abc.gem吗?运行时依赖项是您的gem运行时需要的其他gem。如果您已经在gempec中指定了它们,那么在您安装gem时会注意它们的安装。但是,您的gem需要包含您为其编写的文件。
.files
数组是应该包含在gem中的文件的详细列表。它本质上是告诉gem build
命令“这些文件需要包含在gem中”,就像选择要压缩到zip文件中的文件一样。
Gem::Specification.new do |s|
# Other specifications
s.files = ["bin/google", "lib/google.rb", "lib/google/utils.rb"]
s.files += ["LICENSE.md", "README.md", "google.gemspec"]
end