rails g generator somegen
Вот содержимое генератора:
class SomegenGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def install
gem "unicorn"
run "bundle install"
end
end
Пробую запустить генератор и получаю ошибку:
$ rails g somegen
gemfile unicorn
run bundle install from "."
Could not find gem 'unicorn (>= 0)' in any of the gem sources listed
in your Gemfile.
Run `bundle install` to install missing gems.
Почему так происходит? Если из консоли набрать "bundle install", то
все работает нормально, а вот из генератора оно не хочет это делать.
Использую Ubuntu, Rails 3.1, RVM.
Либо удалите из Gemfile unicorn, либо сделайте bundle install.
Иначе я вообще не понимаю, что вы там генерируете.
--
--
Данное сообщение отправлено Вам, так как Вы являетесь подписчиком группы "RubyOnRails to russian" на группах Google.
FAQ группы находится по адресу: http://ru.wikibooks.org/wiki/RubyFAQ
Для того, чтобы отправить сообщение в эту группу, пошлите его по адресу
ror...@googlegroups.com
Чтобы отменить подписку на эту группу, отправьте сообщение по адресу: ror2ru-un...@googlegroups.com
Дополнительные варианты находятся на странице группы http://groups.google.com/group/ror2ru?hl=ru
Website: http://torqueo.net
Skype: tanraya
Twitter: tanraya
Дурацкая гипотеза: а source первой строчкой в Gemfile прописан?
--
With Best Regards, Anton Dyachuk
class SomethingGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def install
gem "unicorn"
inside Rails.root do
run "bundle install"
end
end
end
gemfile unicorn
run bundle install from "."
Could not find gem 'unicorn (>= 0) ruby' in any of the gem sources listed in your Gemfile.
Андрей, вроде все как нужно:
#<Method: SomethingGenerator(Rails::Generators::Actions)#gem>
$ rails g something
/home/tanraya/.rvm/gems/ruby-1.9.2-p290@genapp/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
gemfile unicorn
run bundle install from "."
Could not find gem 'unicorn (>= 0) ruby' in any of the gem sources listed in your Gemfile.
Да, это как раз то место, где дебаггер нужен. Отследить головоломные
инклюды тем более в такой хрупкой штуке как гемы очень сложно.