Class: Rails::Command::PluginCommand

Inherits:
Base
  • Object
show all
Defined in:
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, hide_command!, inherited, namespace, perform, printing_commands, usage_path

Methods included from Actions

#load_generators, #load_tasks, #require_application_and_environment!, #set_application_directory!

Class Method Details

:nodoc:



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

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

Instance Method Details

#helpObject



6
7
8
# File 'lib/rails/commands/plugin/plugin_command.rb', line 6

def help
  run_plugin_generator %w( --help )
end

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



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

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)
      puts "Using #{extra_args.join(" ")} from #{railsrc}"
      plugin_args.insert(1, *extra_args)
    end
  end

  run_plugin_generator plugin_args
end