diff options
author | schneems <richard.schneeman@gmail.com> | 2013-06-29 12:54:23 +0300 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2013-06-29 14:34:46 +0300 |
commit | 6ce18ba7dcce09401a3b80542a3f12b89e40ac98 (patch) | |
tree | 5e04577cbc87fcc7371dd9243f19daf7be6e8d8d | |
parent | 3f81230a723a04a49aa28baf038566768bd392ce (diff) | |
download | rails-6ce18ba7dcce09401a3b80542a3f12b89e40ac98.tar.gz rails-6ce18ba7dcce09401a3b80542a3f12b89e40ac98.tar.bz2 rails-6ce18ba7dcce09401a3b80542a3f12b89e40ac98.zip |
Fix `rails plugin --help`
Right now if you run the `rails plugin --help` command it fails because rails expects a command in `railties/lib/rails/commands/plugin.rb` that does not exist because the file is named `plugin_new`. This is the error:
```
ruby-2.0.0-p0 ~/documents/projects/tmp/vanilla (master)
$ rails plugin --help
/Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- rails/commands/plugin (LoadError)
from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /Users/schneems/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0/lib/rails/commands.rb:49:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
```
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands.rb | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index eb0545ccbf..639dd70152 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Fix `rails plugin --help` command. + + *Richard Schneeman* + * Omit turbolinks configuration completely on skip_javascript generator option. *Nikita Fedyashev* diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 48007dd2ab..c2ce2b4d2a 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -35,19 +35,17 @@ command = ARGV.shift command = aliases[command] || command case command -when 'generate', 'destroy', 'plugin' +when 'plugin' + require "rails/commands/plugin_new" +when 'generate', 'destroy' require 'rails/generators' - if command == 'plugin' && ARGV.first == 'new' - require "rails/commands/plugin_new" - else - require APP_PATH - Rails.application.require_environment! + require APP_PATH + Rails.application.require_environment! - Rails.application.load_generators + Rails.application.load_generators - require "rails/commands/#{command}" - end + require "rails/commands/#{command}" when 'console' require 'rails/commands/console' |