This project is archived and is in readonly mode.

#5882 ✓stale
zjia

Unable to run rails:update if the app is generated with dev option

Reported by zjia | October 29th, 2010 @ 03:48 AM | in 3.1

I have an app generated with "ruby vendor/rails/bin/rails new . --dev", where vendor/rails is the rails repository. Then if I run "rake rails:update --trace" then it throws the following message.

(in /Users/zjia/code/test1)
** Invoke rails:update (first_time)
** Invoke rails:update:configs (first_time)
** Execute rails:update:configs
   identical  config/boot.rb
       exist  config
   identical  config/routes.rb
   identical  config/application.rb
   identical  config/environment.rb
** Invoke rails:update:javascripts (first_time)
** Execute rails:update:javascripts
       exist  public/javascripts
rake aborted!
wrong number of arguments (1 for 2)
/Users/zjia/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/fileutils.rb:471:in `copy_file'
/Users/zjia/code/test1/vendor/rails/railties/lib/rails/generators/rails/app/app_generator.rb:114:in `javascripts'
/Users/zjia/code/test1/vendor/rails/railties/lib/rails/generators/rails/app/app_generator.rb:349:in `build'
/Users/zjia/code/test1/vendor/rails/railties/lib/rails/generators/rails/app/app_generator.rb:289:in `create_javascript_files'
/Users/zjia/code/test1/vendor/rails/railties/lib/rails/tasks/framework.rake:40:in `invoke_from_app_generator'
/Users/zjia/code/test1/vendor/rails/railties/lib/rails/tasks/framework.rake:63:in `block (3 levels) in <top (required)>'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/zjia/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/Users/zjia/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/Users/zjia/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'

It works fine if I run "rake rails:update" with an app generated with rails gem.

Btw is there a way to specify to use jquery when running "rake rails:update:javascripts"?

Comments and changes to this ticket

  • Jeff Kreeftmeijer

    Jeff Kreeftmeijer November 1st, 2010 @ 05:04 PM

    • Importance changed from “” to “Low”

    Automatic cleanup of spam.

  • Arsen7

    Arsen7 January 11th, 2011 @ 10:38 AM

    This bug still exists in January:

    ** Execute rails:update:javascripts
       exist  public/javascripts
    rake aborted!
    wrong number of arguments (1 for 2)
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/generators/rails/app/app_generator.rb:109:in `copy_file'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/generators/rails/app/app_generator.rb:109:in `javascripts'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/generators/app_base.rb:85:in `send'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/generators/app_base.rb:85:in `build'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/generators/rails/app/app_generator.rb:233:in `create_javascript_files'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/tasks/framework.rake:40:in `send'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/tasks/framework.rake:40:in `invoke_from_app_generator'
    ~/.gem/ruby/1.8/bundler/gems/rails-366e7854ac41/railties/lib/rails/tasks/framework.rake:63
    [...]
    

    What arguments should be as the second ones in in app_generator.rb? (line ~105)

    def javascripts
      empty_directory "public/javascripts"
    
      unless options[:skip_javascript]
        copy_file "public/javascripts/#{options[:javascript]}.js"
        copy_file "public/javascripts/#{options[:javascript]}_ujs.js", "public/javascripts/rails.js"
    
        if options[:javascript] == "prototype"
          copy_file "public/javascripts/controls.js"
          copy_file "public/javascripts/dragdrop.js"
          copy_file "public/javascripts/effects.js"
        end
      end
    
      copy_file "public/javascripts/application.js"
    end
    
  • Arsen7

    Arsen7 January 11th, 2011 @ 10:53 AM

    I lied a little in the rails version, but the bug existed in rails commit 366e7854ac41 (from October) and still exists also in commit a60ea742226f (Jan 10).

  • Arsen7

    Arsen7 January 11th, 2011 @ 11:10 AM

    Looks like the commit 708e09448ba41c45f189c6b1adc989eba8994b20 introduced the problem.

    commit 708e09448ba41c45f189c6b1adc989eba8994b20
    Author: siong1987 <siong1987@gmail.com>
    Date:   Sat Sep 11 14:09:16 2010 -0500
        -j parameter added to rails new command.
        Now you can start your apps with jquery with rails new myapp -j jquery, the default is still prototype
        [[#5613](/projects/8994/tickets/5613 "Ticket #5613") state:committed]
        Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
    
    diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
    index 7907191..44f9fde 100644
    --- a/railties/lib/rails/generators/rails/app/app_generator.rb
    +++ b/railties/lib/rails/generators/rails/app/app_generator.rb
    @@ -108,12 +108,20 @@ module Rails
         end
     
         def javascripts
    -      unless options[:skip_prototype]
    -        directory "public/javascripts"
    -      else
    -        empty_directory_with_gitkeep "public/javascripts"
    -        create_file "public/javascripts/application.js"
    +      empty_directory "public/javascripts"
    +          
    +      unless options[:skip_javascript]
    +        copy_file "public/javascripts/#{@options[:javascript]}.js"
    +        copy_file "public/javascripts/#{@options[:javascript]}_ujs.js", "public/javascripts/rails.js"
    +        
    +        if options[:prototype]
    +          copy_file "public/javascripts/controls.js"
    +          copy_file "public/javascripts/dragdrop.js"
    +          copy_file "public/javascripts/effects.js"
    +        end
           end
    +      
    +      copy_file "public/javascripts/application.js"
         end
    
  • Arsen7

    Arsen7 January 11th, 2011 @ 11:14 AM

    • Assigned user set to “Santiago Pastorino”
  • Santiago Pastorino
  • Arsen7

    Arsen7 January 11th, 2011 @ 02:05 PM

    You want me to do some real work, don't you? ;-) Okay, but it will have to wait a few days, as I am currently a little overloaded.

    The diff I have sent is not the fix. It's just a quote from the commit 708e09448ba41c45f189c6b1adc989eba8994b20, which introduced the problem, as I believe. The commit cannot be easily reverted, I guess, so I need to understand what and where should be copied, and add the second parameters to all the copy_file functions.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 08:06 PM

    • State changed from “new” to “open”
    • Milestone set to 3.1
  • rails

    rails May 3rd, 2011 @ 01:00 AM

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails May 3rd, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages