我创建了一个 gem(apple_store_search)。它取决于另外两个 gem(curl 和 json)。我的 .gemspec 看起来像
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "apple_store_search/version"
Gem::Specification.new do |s|
s.name = "apple_store_search"
s.version = AppleStoreSearch::VERSION
s.authors = "Shamith c"
s.email = "shamithc@gmail.com"
s.homepage = ""
s.summary = %q{This is for searching in app in apple store}
s.description = %q{Exited to watch its progress}
s.rubyforge_project = "apple_store_search"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
# specify any dependencies here; for example:
#s.add_development_dependency "rspec"
s.add_dependency('curl', '0.0.9')
s.add_dependency('json', '1.7.3')
s.add_runtime_dependency('curl', '0.0.9')
s.add_runtime_dependency('json', '1.7.3')
end
我成功地构建了这个宝石。然后我试图在 irb 上加载这个 gem,我得到了错误
NameError: uninitialized constant AppleStoreSearch::Search::CURL
此错误是由于 curl gem。
如果我需要“curl”和“json”,我的 gem 会正确执行。
如何在加载“apple_store_search”gem 时默认加载这些 gem(json 和 curl)?