Class: ViewGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ViewGenerator
- Defined in:
- lib/generators/view/view_generator.rb
Instance Method Summary collapse
- #create_root_directory ⇒ Object
- #create_view_file ⇒ Object
- #generate_locale_file ⇒ Object
- #generate_test_file ⇒ Object
Instance Method Details
#create_root_directory ⇒ Object
7 8 9 |
# File 'lib/generators/view/view_generator.rb', line 7 def create_root_directory empty_directory(File.join("app/views", file_name)) if actions.empty? end |
#create_view_file ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/generators/view/view_generator.rb', line 11 def create_view_file unless actions.empty? actions.each do |filename| template("view.html.erb", File.join("app/views", class_path, file_name, "#{filename}.html.erb")) end end end |
#generate_locale_file ⇒ Object
19 20 21 |
# File 'lib/generators/view/view_generator.rb', line 19 def generate_locale_file invoke("locale:view", [name]) if ActiveGenerator.configuration.autoload_view_generator_locale end |
#generate_test_file ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/view/view_generator.rb', line 23 def generate_test_file unless ["test_unit", nil].include?(ActiveGenerator.configuration.test_framework) invoke("#{ActiveGenerator.configuration.test_framework}:view", [name]) rescue nil end end |