2011-01-14 47 views
0

我有一個rails項目,其下有其他項目,子項目有rake和bundler文件。Rails3和`cd somehwere &&做點什麼`

當我做紅寶石-e`CD子項目& & rake`,或紅寶石-e`CD子項目& & bundle`,命令按預期方式工作,並使用子項目耙/捆綁器文件。但是,當我從Rails3控制檯(rails 3.0.3)執行同樣的操作時,rake會給出錯誤無法加載這樣的文件 - 初始化程序,並且bundle的操作就好像它是從根目錄啓動的。

我嘗試了Rails2.3.10控制檯中的相同命令,它們按預期工作。 Rails3在這裏做錯了什麼?

我通過RVM使用Ruby 1.9.2。
$紅寶石-v
紅寶石1.9.2p136(2010-12-25修訂30365)[i686的Linux的]

+0

什麼是Rails子項目? – Heikki 2011-01-14 18:45:44

+0

只有具有自己的rake和bundler文件的子目錄 – 2011-01-14 19:28:51

回答

1
bold_rewards ∴ ruby -v 
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0] 
bold_rewards ∴ rake -T | wc -l 
     46 
bold_rewards ∴ cd vendor/plugins/pretty_flash 
pretty_flash ∴ rake -T | wc -l 
     6 
pretty_flash ∴ cd ../../.. 
bold_rewards ∴ rails c 
Loading development environment (Rails 3.0.3) 
>> Dir.pwd 
=> "/Users/george/work/bold_rewards" 
>> `rake -T | wc -l`.chomp.strip 
=> "46" 
>> Dir.chdir 'vendor/plugins/pretty_flash' 
=> 0 
>> Dir.pwd 
=> "/Users/george/work/bold_rewards/vendor/plugins/pretty_flash" 
>> `rake -T | wc -l`.chomp.strip 
=> "6" 
>> Dir.chdir Rails.root 
=> 0 
>> `rake -T | wc -l`.chomp.strip 
=> "46" 
>> 

不幸的是,我認爲捆紮機是一個非常就難了:

increment ∴ cat Gemfile                                       
source 'http://rubygems.org' 

gem 'rails', '3.0.3' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3-ruby', :require => 'sqlite3' 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 
# gem 'ruby-debug' 
# gem 'ruby-debug19' 

# Bundle the extra gems: 
# gem 'bj' 
# gem 'nokogiri' 
# gem 'sqlite3-ruby', :require => 'sqlite3' 
# gem 'aws-s3', :require => 'aws/s3' 

# Bundle gems for the local environment. Make sure to 
# put test-only gems in this group so their generators 
# and rake tasks are available in development mode: 
# group :development, :test do 
# gem 'webrat' 
# end 
increment ∴ cat vendor/subproject_x/Gemfile                                  
source 'http://rubygems.org' 

gem 'net-ssh' 

increment ∴ rails c                                        
Loading development environment (Rails 3.0.3) 
>> Dir.pwd 
=> "/Users/george/tmp/increment" 
>> `BUNDLE_GEMFILE="vendor/subproject_x/Gemfile" bundle install` 
=> "\e[31mCould not find net-ssh-2.0.24 in any of the sources\e[0m\n" 
>> Dir.chdir 'vendor/subproject_x' 
=> 0 
>> Dir.entries '.' 
=> [".", "..", "Gemfile", "Rakefile"] 
>> Dir.pwd 
=> "/Users/george/tmp/increment/vendor/subproject_x" 
>> `BUNDLE_GEMFILE="Gemfile" bundle install` 
=> "\e[31mCould not find net-ssh-2.0.24 in any of the sources\e[0m\n" 
>> Dir.chdir Rails.root 
=> 0 
>> Dir.pwd 
=> "/Users/george/tmp/increment" 
>> `BUNDLE_GEMFILE="vendor/subproject_x/Gemfile" bundle install` 
=> "\e[31mCould not find net-ssh-2.0.24 in any of the sources\e[0m\n" 
>> quit 
increment ∴ cd vendor/subproject_x                                     
subproject_x ∴ bundle install                                      
Fetching source index for http://rubygems.org/ 
Installing net-ssh (2.0.24) 
Using bundler (1.0.7) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 
subproject_x ∴