I'm trying to use the AppGenerator inside an engine, and the
copy_file method is going directly to fileutils instead of using
the thor actions method. The error is on master, it works on
3.0.5.
rake generate looks something like this:
require 'rails/generators'
require 'rails/generators/rails/app/app_generator'
class TestAppGenerator < Rails::Generators::AppBase
source_root File.expand_path("../templates", __FILE__)
def run_rails_new
invoke Rails::Generators::AppGenerator, ["spec/dummy"]
end
...
end
TestAppGenerator.start
% rake generate --trace
(in /Users/steve/code/engine_test)
** Invoke generate (first_time)
** Execute generate
exist
rake aborted!
wrong number of arguments (1 for 2)
/Users/steve/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:471:in `copy_file'
/Users/steve/code/rails/railties/lib/rails/generators/rails/app/app_generator.rb:33:in `readme'
/Users/steve/code/rails/railties/lib/rails/generators/app_base.rb:85:in `build'
/Users/steve/code/rails/railties/lib/rails/generators/rails/app/app_generator.rb:181:in `create_root_files'
/Users/steve/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
Using git diff I've tracked it down to the removal of a bunch of
methods being defined in 3.0.5 which are removed in master.
git diff v3.0.5..master
railties/lib/rails/generators/rails/app/app_generator.rb
0904e8256864239f673bf91fce1cfffb9345ee61 - This is the commit
that stops it working, although I find it strange that it's from
October last year and it's not in the 3.0.5 release. Maybe I'm
looking at the wrong commit.
In any case adding the method definitions back solves the
problem I'm having. I can't figure out why it fails in this case
but works fine through the rails command though...
Thanks