Class: Rails::Command::PluginCommand

Inherits:
Base show all
Defined in:
railties/lib/rails/commands/plugin/plugin_command.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

base_name, class_usage, command_name, default_command_root, desc, engine?, executable, exit_on_failure?, help, hide_command!, inherited, namespace, perform, printing_commands, usage_path

Methods included from Actions

#boot_application!, #load_environment_config!, #load_generators, #load_tasks, #require_application!, #set_application_directory!

Class Method Details

:nodoc:



14
15
16
# File 'railties/lib/rails/commands/plugin/plugin_command.rb', line 14

def self.banner(*) # :nodoc:
  "#{executable} new [options]"
end

Instance Method Details

#helpObject



10
11
12
# File 'railties/lib/rails/commands/plugin/plugin_command.rb', line 10

def help
  run_plugin_generator %w( --help )
end

#perform(type = nil, *plugin_args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'railties/lib/rails/commands/plugin/plugin_command.rb', line 23

def perform(type = nil, *plugin_args)
  plugin_args << "--help" unless type == "new"

  unless options.key?("no_rc") # Thor's not so indifferent access hash.
    railsrc = File.expand_path(options[:rc])

    if File.exist?(railsrc)
      extra_args = File.read(railsrc).split(/\n+/).flat_map(&:split)
      say "Using #{extra_args.join(" ")} from #{railsrc}"
      plugin_args.insert(1, *extra_args)
    end
  end

  run_plugin_generator plugin_args
end