我刚刚检查了我的Rails Engine项目,当(在捆绑安装后)我在其根目录中调用了rails -v,我收到一个LoadError,Rails似乎正在寻找宝石/引擎,试图建立:
my-engine dmoles$rails -v /Users/dmoles/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'my-engine' (>= 0) among 117 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/dmoles/.rvm/gems/ruby-2.2.1:/Users/dmoles/.rvm/gems/ruby-2.2.1@global',execute `gem env` for more information from /Users/dmoles/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec' from /Users/dmoles/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem' from /Users/dmoles/.rvm/gems/ruby-2.2.1/bin/rails:22:in `<main>'
运行gem env如建议不再有启发:
my-engine dmoles$gem env RubyGems Environment: - RUBYGEMS VERSION: 2.4.6 - RUBY VERSION: 2.2.1 (2015-02-26 patchlevel 85) [x86_64-darwin14] - INSTALLATION DIRECTORY: /Users/dmoles/.rvm/gems/ruby-2.2.1 - RUBY EXECUTABLE: /Users/dmoles/.rvm/rubies/ruby-2.2.1/bin/ruby - EXECUTABLE DIRECTORY: /Users/dmoles/.rvm/gems/ruby-2.2.1/bin - SPEC CACHE DIRECTORY: /Users/dmoles/.gem/specs - SYstem CONfigURATION DIRECTORY: /Users/dmoles/.rvm/rubies/ruby-2.2.1/etc - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-14 - GEM PATHS: - /Users/dmoles/.rvm/gems/ruby-2.2.1 - /Users/dmoles/.rvm/gems/ruby-2.2.1@global - GEM CONfigURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - https://rubygems.org/ - SHELL PATH: - /Users/dmoles/.rvm/gems/ruby-2.2.1/bin - /Users/dmoles/.rvm/gems/ruby-2.2.1@global/bin - /Users/dmoles/.rvm/rubies/ruby-2.2.1/bin - /Users/dmoles/.rvm/bin - /Users/dmoles/bin - /usr/local/bin - /usr/bin - /bin - /usr/sbin - /sbin - /usr/local/git/bin
我可以搭建/安装宝石
gem build my-engine.gemspec gem install my-engine-0.0.1.gem
之后,rails -v开始工作.但是,这似乎并不是必须的,而且它使我担心Rails可能正在使用内置/安装的代码而不是直接的源代码.我究竟做错了什么?
就是说,它运行,即使它抱怨“Bundler正在使用为不同的宝石创建的binstub”.可能是因为它不喜欢宝石被命名为我的引擎,但是ENGINE_PATH有我的/引擎?