Class: Spree::Generators::ExtensionGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Spree::Generators::ExtensionGenerator
- Defined in:
- lib/generators/spree/extension_generator.rb
Instance Method Summary collapse
- #config_routes ⇒ Object
- #create_app_dirs ⇒ Object
- #create_lib_files ⇒ Object
- #create_root_files ⇒ Object
- #create_spec_helper ⇒ Object
- #install_rake ⇒ Object
- #update_gemfile ⇒ Object
Instance Method Details
#config_routes ⇒ Object
24 25 26 |
# File 'lib/generators/spree/extension_generator.rb', line 24 def config_routes template "routes.rb", "#{file_name}/config/routes.rb" end |
#create_app_dirs ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/generators/spree/extension_generator.rb', line 32 def create_app_dirs empty_directory extension_dir('app') empty_directory extension_dir('app/controllers') empty_directory extension_dir('app/helpers') empty_directory extension_dir('app/models') empty_directory extension_dir('app/views') empty_directory extension_dir('spec') end |
#create_lib_files ⇒ Object
41 42 43 44 45 |
# File 'lib/generators/spree/extension_generator.rb', line 41 def create_lib_files directory "lib", "#{file_name}/lib" template 'extension/extension.rb.tt', "#{file_name}/lib/#{file_name}.rb" template 'hooks.rb.tt', "#{file_name}/lib/#{file_name}_hooks.rb" end |
#create_root_files ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/spree/extension_generator.rb', line 11 def create_root_files empty_directory file_name empty_directory "#{file_name}/config" empty_directory "#{file_name}/db" empty_directory "#{file_name}/public" template "LICENSE", "#{file_name}/LICENSE" template "Rakefile.tt", "#{file_name}/Rakefile" template "README.md", "#{file_name}/README.md" template "gitignore.tt", "#{file_name}/.gitignore" template "extension.gemspec.tt", "#{file_name}/#{file_name}.gemspec" template "Versionfile.tt", "#{file_name}/Versionfile" end |
#create_spec_helper ⇒ Object
47 48 49 |
# File 'lib/generators/spree/extension_generator.rb', line 47 def create_spec_helper template "spec_helper.rb", "#{file_name}/spec/spec_helper.rb" end |
#install_rake ⇒ Object
28 29 30 |
# File 'lib/generators/spree/extension_generator.rb', line 28 def install_rake template "install.rake.tt", "#{file_name}/lib/tasks/install.rake" end |
#update_gemfile ⇒ Object
51 52 53 |
# File 'lib/generators/spree/extension_generator.rb', line 51 def update_gemfile gem file_name, :path => file_name, :require => file_name end |