Skip to content

Problem running app generator standalone #897

lighthouse-import opened this Issue May 16, 2011 · 3 comments

2 participants


Imported from Lighthouse. Original ticket at:
Created by Steve Hodgkiss - 2011-03-04 14:33:23 UTC

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"]

% rake generate --trace
(in /Users/steve/code/engine_test)
** Invoke generate (first_time)
** Execute generate
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

0904e82 - 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...



Imported from Lighthouse.
Comment by Steve Hodgkiss - 2011-03-06 14:09:36 UTC

This is due running it with rake, where FileUtils is included into the top level module causing method_missing not to be used on Rails::ActionMethods.

I've put an example on github that demonstrates this -


Attachments saved to Gist:


This was fixed by commit 00379ee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.