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, command_name, default_command_root, desc, engine?, executable, exit_on_failure?, hide_command!, inherited, namespace, perform, printing_commands, usage_path

Methods included from Actions

#load_generators, #load_tasks, #require_application!, #require_application_and_environment!, #require_environment!, #set_application_directory!

Class Method Details

:nodoc:



12
13
14
# File 'railties/lib/rails/commands/plugin/plugin_command.rb', line 12

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

Instance Method Details

#helpObject



8
9
10
# File 'railties/lib/rails/commands/plugin/plugin_command.rb', line 8

def help
  run_plugin_generator %w( --help )
end

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



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

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