Class: EasyCms::Generators::NamespaceGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- EasyCms::Generators::NamespaceGenerator
- Includes:
- ResourceHelpers
- Defined in:
- lib/generators/easy_cms/namespace/namespace_generator.rb
Instance Method Summary collapse
- #add_initializers_assets ⇒ Object
- #generate_assets ⇒ Object
- #generate_base_controller ⇒ Object
- #generate_layout ⇒ Object
Instance Method Details
#add_initializers_assets ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/generators/easy_cms/namespace/namespace_generator.rb', line 30 def add_initializers_assets prepend_to_file 'config/initializers/assets.rb' do "Rails.application.config.assets.precompile += %w( #{namespace}.js )\n" end prepend_to_file 'config/initializers/assets.rb' do "Rails.application.config.assets.precompile += %w( #{namespace}.scss )\n" end end |
#generate_assets ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/generators/easy_cms/namespace/namespace_generator.rb', line 22 def generate_assets file_name_js = "app/assets/javascripts/#{namespace}.js" file_name_stylesheet = "app/assets/stylesheets/#{namespace}.scss" template "./assets/base_javascript.erb", file_name_js unless File.exist?(file_name_js) template "./assets/base_scss.erb", file_name_stylesheet unless File.exist?(file_name_stylesheet) end |
#generate_base_controller ⇒ Object
12 13 14 15 |
# File 'lib/generators/easy_cms/namespace/namespace_generator.rb', line 12 def generate_base_controller file_name = "app/controllers/#{namespace}/base_controller.rb" template './controllers/base_controller.erb', file_name, unless File.exist?(file_name) end |
#generate_layout ⇒ Object
17 18 19 20 |
# File 'lib/generators/easy_cms/namespace/namespace_generator.rb', line 17 def generate_layout file_name = "app/views/layouts/#{namespace}.html.erb" template "./layouts/layout.html.erb", file_name, unless File.exist?(file_name) end |