ペペンログ

主に技術系でつくったものを載せる予定

Rubyでエラー

Rubyバッチ処理書くつもりだけど、環境準備でエラーがでつづけています。。。

エラー /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/runner.rb:62:in <top (required)>': uninitialized constant Tasks::MainTask (NameError) from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/runner.rb:62:ineval' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/runner.rb:62:in <top (required)>' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:123:inrequire_command!' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:90:in runner' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:inrun_command!' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in <top (required)>' from /Users/username/Documents/publicdata/github/aitbus/checktimetabledata/bin/rails:9:in' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Users/username/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from -e:1:in `

'

なんやろうか? 参考にいろいろなサイトみたけど、パスを通すような処理はやったはずだが。。。 application.rbに config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += Dir["#{config.root}/lib"] 追加したけどだめっぽい

追記:2016/1/12

解決した。3日かかったわ。 原因:命名規則っぽい(調査中):http://www.rubylife.jp/rails/controller/index1.html

実行方法

bundler exec rails runner Tasks::Maintask.execute

名前とか スクリーンショット 2016-01-14 1.15.22

コード:Github