2011-09-27 4 views
2

레일 3.1 용 사용자 정의 생성기를 만들려고합니다. 그리고 나는이 쓴 :Rails 생성기에서 '번들 설치'가 실패하는 이유는 무엇입니까?

module SomeGem 
    module Generators 
    class InstallGenerator < Rails::Generators::Base 
     source_root File.expand_path('../templates', __FILE__) 
     desc "This adds devise" 

     def install 
     gem "devise" 
     run "bundle install" 
     end 
    end 
    end 
end 

을하지만이 발전기를 실행할 때 (레일 g somegem : 신선한 생성 된 레일 응용 프로그램에서 설치) :

gemfile devise 
run  bundle install 

Could not find gem 'devise (>= 0)' in any of the gem sources listed in your Gemfile. 
Run `bundle install` to install missing gems. 

내 발전기가 추가 나는이 오류가 발생했습니다 Gemfile을 제대로 작성하면 생성기에서 '번들 설치'명령을 실행할 때 실패합니다. 콘솔에서 '번들 설치'를 실행하면 오류없이 모든 보석을 설치합니다.

왜 이런 일이 발생합니까? 내가 실행 한 후


가 여기 내 Gemfile는 'g somegem 레일 : 설치'(I는 목록에서 주석을 제거) :

source 'http://rubygems.org' 
source 'http://gemcutter.org' 
source "http://gems.github.com" 

gem 'rails', '3.1.0' 
gem 'mysql2' 

group :assets do 
    gem 'sass-rails', " ~> 3.1.0" 
    gem 'coffee-rails', "~> 3.1.0" 
    gem 'uglifier' 
end 

gem 'jquery-rails' 

group :test do 
    # Pretty printed test output 
    gem 'turn', :require => false 
end 

gem 'therubyracer' 
gem "devise" 
+0

을'번들 install '이다 명령을 실행하는 동안 인터넷에 연결되어 있는지 확인 –

답변

3

바와 같이 here을 지적,이 Bundler 프로그램의 버그입니다. 는 그것이 작동되도록하려면

module SomeGem 
    module Generators 
    class InstallGenerator < Rails::Generators::Base 
     source_root File.expand_path('../templates', __FILE__) 
     desc "This adds devise" 

     def install 
     gem "devise" 
     Bundler.with_clean_env do 
      run "bundle install" 
     end 
     end 
    end 
    end 
end 
관련 문제