Big_Bird
Big_Bird

Reputation: 427

When trying to run Rails server it crashes on Rake

I`ve just upgraded the apps rails version from 3.0.9 to 3.1.2 & also switched from ruby 1.8.7 to 1.9.2.

While trying to run the server after the updates I get the error message below:

rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:65:in `directory': wrong number of arguments (0 for 1) (ArgumentError)
    from /Users/Big_Bird/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:165:in `directory'
    from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:12:in `block (2 levels) in <class:Plugin>'
    from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:11:in `each'
    from /Users/Big_Bird/apps/Example/vendor/plugins/calendar_date_select/init.rb:11:in `block in <class:Plugin>'

Now the snippet where the error occurs for the plugin is:

%w[calendar_date_select includes_helper].each { |file| 
  require File.join( File.dirname(__FILE__), "lib",file) 
}

ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelper)
ActionView::Base.send(:include, CalendarDateSelect::FormHelper)
ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)

# install files
unless File.exists?(Rails.root + '/public/javascripts/calendar_date_select/calendar_date_select.js')
  ['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
    source = File.join(directory,dir)
    dest = Rails.root + dir
    FileUtils.mkdir_p(dest)
    FileUtils.cp(Dir.glob(source+'/*.*'), dest)
  end
end

I`m not quite sure where the problem lies since all of the directories listed in the plugin are correct, while upgrading I had to switch from using RAILS_ROOT to Rails.root but thats about it.

I would appreciate any guidance on how to fix this issue.

Upvotes: 0

Views: 120

Answers (1)

flynfish
flynfish

Reputation: 5867

It looks like the issue is with this line:

source = File.join(directory,dir)

Are you expecting directory to be a string path? If so, I don't see it defined anywhere.

Upvotes: 1

Related Questions