script/generate hoptoad is raising "wrong number of arguments (1 for 0)" on Rails 2.3.5

shawlab's Avatar

shawlab

04 Mar, 2010 10:04 PM via web

When attempting to upgrade a project from plugin to gem (yes, I am late to the party), script/generate hoptoad is raising "wrong number of arguments (1 for 0)". The hoptoad_notifier plugin, exception_notifier plugin, and hoptoad initializer have been removed. I have added config.gem 'hoptoad_notifier' to my environment.rb. it looks like the error is occurring while running rake hoptoad:test.

$ script/generate hoptoad --api-key <snipped>
      exists  lib/tasks
      create  lib/tasks/hoptoad_notifier_tasks.rake
      insert  
Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
  $: << File.join(vendored_notifier, 'lib')
end

require 'hoptoad_notifier/capistrano'
 appended to config/deploy.rb
      create  config/initializers/hoptoad.rb
        rake  rake hoptoad:test
(in /home/matt/develop/clients/nih/mpr.ror/trunk)
rake aborted!
wrong number of arguments (1 for 0)

(See full trace by running task with --trace)
        rake  hoptoad:test failed. Rolling back
          rm  config/initializers/hoptoad.rb
      remove  
Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
  $: << File.join(vendored_notifier, 'lib')
end

require 'hoptoad_notifier/capistrano'
 removed from config/deploy.rb
          rm  lib/tasks/hoptoad_notifier_tasks.rake
    notempty  lib/tasks
    notempty  lib
Loaded suite script/generate
Started

Finished in 0.000258 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

System info:
Rails 2.3.5
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01

$ls vendor/plugins/

2dc_jqgrid fixture_references footnotes headliner importer memory_test_fix nested_has_many_through shaw_lab_db_conventionalizer strip_attributes validation_reflection

  1. Support Staff 2 Posted by joshua.clayton on 04 Mar, 2010 10:43 PM

    joshua.clayton's Avatar

    Hi,

    Could you add --trace to the rake task like it suggests and paste that the full output?

    Thanks,
    - Josh

  2. 3 Posted by shawlab on 05 Mar, 2010 03:07 AM

    shawlab's Avatar

    I added '--trace' inside the generator and ran it again.

        rake  rake hoptoad:test
    (in /home/matt/develop/clients/nih/mpr.ror/trunk)
    snarl_notifier is not available
    ** Invoke hoptoad:test (first_time)
    ** Invoke hoptoad:log_stdout (first_time)
    ** Execute hoptoad:log_stdout
    rake aborted!
    wrong number of arguments (1 for 0)
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/hoptoad_notifier-2.2.0/lib/hoptoad_notifier/tasks.rb:16:in `initialize'
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/hoptoad_notifier- 2.2.0/lib/hoptoad_notifier/tasks.rb:16:in `new'
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/hoptoad_notifier- 2.2.0/lib/hoptoad_notifier/tasks.rb:16
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/lib/rake.rb:636:in `call'
    <snipped/>
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
    /home/matt/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/bin/rake:31
    /home/matt/.rvm/rubies/ree-1.8.7-2010.01/bin/rake:22:in `load'
    /home/matt/.rvm/rubies/ree-1.8.7-2010.01/bin/rake:22
        rake  hoptoad:test failed. Rolling back
          rm  config/initializers/hoptoad.rb
      remove
    

    This points to: `Logger.new(STDOUT)

    task :log_stdout do
      require 'logger'
      RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
    end
    

    From class Logger:
    def initialize(logdev, shift_age = 0, shift_size = 1048576)

    Looks good to me.

    Any ideas?

  3. 4 Posted by shawlab on 05 Mar, 2010 04:30 AM

    shawlab's Avatar

    While in debugger, I checked this:

    (rdb:1) p Logger.instance_method("initialize").arity
    0
    

    Sure enough, no args. Any idea how I can identify the source file for Logger.new?

  4. Support Staff 5 Posted by thoughtbot on 05 Mar, 2010 04:14 PM

    thoughtbot's Avatar

    Off the top of my head, since the Rails initializer will look for a logger.rb to provider a Logger class, you might try the following from script/console:

    $:.each { |path| puts `find #{path} -iname "logger.rb"` }
    

    and investigate the files that show up?

  5. 6 Posted by cenize on 08 Mar, 2010 05:29 PM

    cenize's Avatar

    I have the same problem. After run the script I have:
    ["C:/Software/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/vendor/text-format-0.6.3", "C:/Software/ruby/lib/ruby/gems/1.8/gems/actionmail er-2.1.0/lib/action_mailer/vendor/tmail-1.2.3", "C:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/vendor/html-scanner", "C:/Softwa
    re/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/tzinfo-0.3.8", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/act
    ive_support/vendor/memcache-client-1.5.0", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/xml-simple-1.0.11", "C:/Softwa
    re/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib", "C:/Users/Juarez/Documents/Aptana Studio/unibem/test/mocks/development", "C:/Users/Juarez/Documents/Apt
    ana Studio/unibem/app/controllers/", "C:/Users/Juarez/Documents/Aptana Studio/unibem/app", "C:/Users/Juarez/Documents/Aptana Studio/unibem/app/models", "C:/User
    s/Juarez/Documents/Aptana Studio/unibem/app/controllers", "C:/Users/Juarez/Documents/Aptana Studio/unibem/app/helpers", "C:/Users/Juarez/Documents/Aptana Studio
    /unibem/config", "C:/Users/Juarez/Documents/Aptana Studio/unibem/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/will_paginate-2.3.12/lib", "C:/Users/Juarez/Docu ments/Aptana Studio/unibem/vendor/plugins/restful_authentication/lib", "C:/Users/Juarez/Documents/Aptana Studio/unibem/vendor/plugins/ptbr_rails_plugin/lib", "C
    :/Users/Juarez/Documents/Aptana Studio/unibem/vendor/plugins/hoptoad_notifier/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/hoptoad_notifier-2.2.0/lib", "C:/Us ers/Juarez/Documents/Aptana Studio/unibem/vendor", "C:/Software/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/../builtin/rails_info/", "C:/Software/ruby/lib/ruby/
    gems/1.8/gems/rails-2.1.0/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/gemcutter-0.3.0/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin", "C:/Sof
    tware/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/a
    ctiverecord-2.1.0/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/bin", "C:/So
    ftware/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/bin", "C:/Software/ruby/lib/ruby/gems/1.8/
    gems/actionmailer-2.1.0/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activeresource-2.1.0/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/activeresource-2.1.0/
    lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/builder-2.1.2/bin", "C:/Software/ruby/lib/ruby/gems/1.
    8/gems/builder-2.1.2/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.2-x86-mswin32/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.2-x86-m
    swin32/lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/RedCloth-4.2.2-x86-mswin32-60/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/RedCloth-4.2.2-x86-mswin32-60
    /lib", "C:/Software/ruby/lib/ruby/gems/1.8/gems/RedCloth-4.2.2-x86-mswin32-60/ext", "C:/Software/ruby/lib/ruby/gems/1.8/gems/RedCloth-4.2.2-x86-mswin32-60/lib/c ase_sensitive_require", "C:/Software/ruby/lib/ruby/gems/1.8/gems/will_paginate-2.3.12/bin", "C:/Software/ruby/lib/ruby/gems/1.8/gems/hoptoad_notifier-2.2.0/bin"
    , "C:/Software/ruby/lib/ruby/site_ruby/1.8", "C:/Software/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt", "C:/Software/ruby/lib/ruby/site_ruby", "C:/Software/ruby/lib /ruby/1.8", "C:/Software/ruby/lib/ruby/1.8/i386-mswin32", "."]

  6. Support Staff 7 Posted by elindsay on 08 Mar, 2010 08:47 PM

    elindsay's Avatar

    Hey Cenize,

    you mention that you're having a similar problem, but could you also walk us through the actions you performed to generate the same error, and what version of Rails, Rubygems, and hoptoad_notified that you are using?

    If this ends up being a bug, it will help us narrow down the conditions under which it is being produced.

    Thank you,

    Emma

  7. Support Staff 8 Posted by Matt Jankowski on 28 Apr, 2010 08:05 PM

    Matt Jankowski's Avatar

    shawlab,

    Is this still an issue?

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

What day comes after Monday?

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.