mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
s/plugin_new/plugin
There are historical reasons that the `plugin` command was `plugin_new`, now those are no longer applicable, we should remove the naming edge case from the project. This PR is based off of comments from #11176 ATP Railties
This commit is contained in:
parent
6e583cdac3
commit
ec8d8652f3
35 changed files with 20 additions and 16 deletions
|
@ -1,3 +1,7 @@
|
|||
* Rename `commands/plugin_new.rb` to `commands/plugin.rb` and fix references
|
||||
|
||||
*Richard Schneeman*
|
||||
|
||||
* Fix `rails plugin --help` command.
|
||||
|
||||
*Richard Schneeman*
|
||||
|
|
|
@ -10,7 +10,7 @@ Signal.trap("INT") { puts; exit(1) }
|
|||
|
||||
if ARGV.first == 'plugin'
|
||||
ARGV.shift
|
||||
require 'rails/commands/plugin_new'
|
||||
require 'rails/commands/plugin'
|
||||
else
|
||||
require 'rails/commands/application'
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ command = aliases[command] || command
|
|||
|
||||
case command
|
||||
when 'plugin'
|
||||
require "rails/commands/plugin_new"
|
||||
require "rails/commands/plugin"
|
||||
when 'generate', 'destroy'
|
||||
require 'rails/generators'
|
||||
|
||||
|
|
9
railties/lib/rails/commands/plugin.rb
Normal file
9
railties/lib/rails/commands/plugin.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
if ARGV.first != "new"
|
||||
ARGV[0] = "--help"
|
||||
else
|
||||
ARGV.shift
|
||||
end
|
||||
|
||||
require 'rails/generators'
|
||||
require 'rails/generators/rails/plugin/plugin_generator'
|
||||
Rails::Generators::PluginGenerator.start
|
|
@ -1,9 +0,0 @@
|
|||
if ARGV.first != "new"
|
||||
ARGV[0] = "--help"
|
||||
else
|
||||
ARGV.shift
|
||||
end
|
||||
|
||||
require 'rails/generators'
|
||||
require 'rails/generators/rails/plugin_new/plugin_new_generator'
|
||||
Rails::Generators::PluginNewGenerator.start
|
|
@ -225,7 +225,7 @@ module Rails
|
|||
rails = groups.delete("rails")
|
||||
rails.map! { |n| n.sub(/^rails:/, '') }
|
||||
rails.delete("app")
|
||||
rails.delete("plugin_new")
|
||||
rails.delete("plugin")
|
||||
print_list("rails", rails)
|
||||
|
||||
hidden_namespaces.each { |n| groups.delete(n.to_s) }
|
||||
|
|
|
@ -154,7 +154,7 @@ task default: :test
|
|||
end
|
||||
|
||||
module Generators
|
||||
class PluginNewGenerator < AppBase # :nodoc:
|
||||
class PluginGenerator < AppBase # :nodoc:
|
||||
add_shared_options_for "plugin"
|
||||
|
||||
alias_method :plugin_path, :app_path
|
|
@ -1,5 +1,5 @@
|
|||
require 'generators/generators_test_helper'
|
||||
require 'rails/generators/rails/plugin_new/plugin_new_generator'
|
||||
require 'rails/generators/rails/plugin/plugin_generator'
|
||||
require 'generators/shared_generator_tests'
|
||||
|
||||
DEFAULT_PLUGIN_FILES = %w(
|
||||
|
@ -18,7 +18,7 @@ DEFAULT_PLUGIN_FILES = %w(
|
|||
test/dummy
|
||||
)
|
||||
|
||||
class PluginNewGeneratorTest < Rails::Generators::TestCase
|
||||
class PluginGeneratorTest < Rails::Generators::TestCase
|
||||
include GeneratorsTestHelper
|
||||
destination File.join(Rails.root, "tmp/bukkits")
|
||||
arguments [destination_root]
|
|
@ -106,7 +106,7 @@ class GeneratorsTest < Rails::Generators::TestCase
|
|||
def test_rails_generators_help_does_not_include_app_nor_plugin_new
|
||||
output = capture(:stdout){ Rails::Generators.help }
|
||||
assert_no_match(/app/, output)
|
||||
assert_no_match(/plugin_new/, output)
|
||||
assert_no_match(/[^:]plugin/, output)
|
||||
end
|
||||
|
||||
def test_rails_generators_with_others_information
|
||||
|
|
Loading…
Reference in a new issue