Methods
A
B
C
D
F
G
M
N
O
R
S
V
W
Class Public methods
new(*args)
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 156
def initialize(*args)
  raise Error, "Options should be given after the plugin name. For details run: rails plugin --help" if args[0].blank?

  @dummy_path = nil
  super
end
Class Protected methods
banner()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 261
def self.banner
  "rails plugin new #{self.arguments.map(&:usage).join(' ')} [options]"
end
Instance Public methods
create_app_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 174
def create_app_files
  build(:app)
end
create_config_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 178
def create_config_files
  build(:config)
end
create_images_directory()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 194
def create_images_directory
  build(:images)
end
create_javascript_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 190
def create_javascript_files
  build(:javascripts)
end
create_lib_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 182
def create_lib_files
  build(:lib)
end
create_public_stylesheets_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 186
def create_public_stylesheets_files
  build(:stylesheets)
end
create_root_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 165
def create_root_files
  build(:readme)
  build(:rakefile)
  build(:gemspec)   unless options[:skip_gemspec]
  build(:license)
  build(:gitignore) unless options[:skip_git]
  build(:gemfile)   unless options[:skip_gemfile]
end
create_script_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 198
def create_script_files
  build(:script)
end
create_test_dummy_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 206
def create_test_dummy_files
  return unless with_dummy_app?
  create_dummy_app
end
create_test_files()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 202
def create_test_files
  build(:test) unless options[:skip_test_unit]
end
finish_template()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 211
def finish_template
  build(:leftovers)
end
name()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 217
def name
  @name ||= begin
    # same as ActiveSupport::Inflector#underscore except not replacing '-'
    underscored = original_name.dup
    underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
    underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
    underscored.downcase!

    underscored
  end
end
Instance Protected methods
app_templates_dir()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 231
def app_templates_dir
  "../../app/templates"
end
application_definition()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 283
def application_definition
  @application_definition ||= begin

    dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
    unless options[:pretend] || !File.exists?(dummy_application_path)
      contents = File.read(dummy_application_path)
      contents[(contents.index(/module ([\w]+)\n(.*)class Application/))..-1]
    end
  end
end
camelized()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 269
def camelized
  @camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize
end
create_dummy_app(path = nil)
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 235
def create_dummy_app(path = nil)
  dummy_path(path) if path

  say_status :vendor_app, dummy_path
  mute do
    build(:generate_test_dummy)
    store_application_definition!
    build(:test_dummy_config)
    build(:test_dummy_clean)
    # ensure that script/rails has proper dummy_path
    build(:script, true)
  end
end
dummy_path(path = nil)
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 312
def dummy_path(path = nil)
  @dummy_path = path if path
  @dummy_path || options[:dummy_path]
end
full?()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 249
def full?
  options[:full] || options[:mountable]
end
get_builder_class()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 295
def get_builder_class
  defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder
end
mountable?()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 253
def mountable?
  options[:mountable]
end
mute(&block)
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 317
def mute(&block)
  shell.mute(&block)
end
original_name()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 265
def original_name
  @original_name ||= File.basename(destination_root)
end
rakefile_test_tasks()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 299
      def rakefile_test_tasks
        <<-RUBY
require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
  t.libs << 'lib'
  t.libs << 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = false
end
        RUBY
      end
store_application_definition!()
valid_const?()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 273
def valid_const?
  if camelized =~ /^\d/
    raise Error, "Invalid plugin name #{original_name}. Please give a name which does not start with numbers."
  elsif RESERVED_NAMES.include?(name)
    raise Error, "Invalid plugin name #{original_name}. Please give a name which does not match one of the reserved rails words."
  elsif Object.const_defined?(camelized)
    raise Error, "Invalid plugin name #{original_name}, constant #{camelized} is already in use. Please choose another plugin name."
  end
end
with_dummy_app?()
# File railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb, line 257
def with_dummy_app?
  options[:skip_test_unit].blank? || options[:dummy_path] != 'test/dummy'
end