Class: Rails::Generators::PluginNewGenerator

Inherits:
AppBase show all
Defined in:
railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb

Constant Summary

Constants inherited from AppBase

AppBase::DATABASES, AppBase::JDBC_DATABASES

Instance Attribute Summary

Attributes inherited from AppBase

#rails_template

Instance Method Summary collapse

Methods inherited from AppBase

add_shared_options_for

Methods inherited from Base

base_root, class_option, default_source_root, desc, hook_for, inherited, namespace, remove_hook_for, source_root

Methods included from Actions

#add_source, #capify!, #environment, #gem, #gem_group, #generate, #git, #initializer, #lib, #plugin, #rake, #rakefile, #readme, #route, #vendor

Constructor Details

#initialize(*args) ⇒ PluginNewGenerator

Returns a new instance of PluginNewGenerator.

Raises:



156
157
158
159
160
161
# 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

Instance Method Details

#create_app_filesObject



174
175
176
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 174

def create_app_files
  build(:app)
end

#create_config_filesObject



178
179
180
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 178

def create_config_files
  build(:config)
end

#create_images_directoryObject



194
195
196
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 194

def create_images_directory
  build(:images)
end

#create_javascript_filesObject



190
191
192
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 190

def create_javascript_files
  build(:javascripts)
end

#create_lib_filesObject



182
183
184
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 182

def create_lib_files
  build(:lib)
end

#create_public_stylesheets_filesObject



186
187
188
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 186

def create_public_stylesheets_files
  build(:stylesheets)
end

#create_root_filesObject



165
166
167
168
169
170
171
172
# 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_filesObject



198
199
200
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 198

def create_script_files
  build(:script)
end

#create_test_dummy_filesObject



206
207
208
209
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 206

def create_test_dummy_files
  return if options[:skip_test_unit] && options[:dummy_path] == 'test/dummy'
  create_dummy_app
end

#create_test_filesObject



202
203
204
# 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_templateObject



211
212
213
# File 'railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb', line 211

def finish_template
  build(:leftovers)
end