Class: HamlRails::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- HamlRails::Generators::InstallGenerator
- Defined in:
- lib/generators/haml_rails/install_generator.rb
Instance Method Summary collapse
- #change_application_rb ⇒ Object
- #copy_base_file ⇒ Object
- #copy_controller_template ⇒ Object
- #copy_mailer_template ⇒ Object
- #copy_scaffold_template ⇒ Object
Instance Method Details
#change_application_rb ⇒ Object
29 30 31 32 33 |
# File 'lib/generators/haml_rails/install_generator.rb', line 29 def change_application_rb inject_into_file "config/application.rb", :after => "class Application < Rails::Application\n" do " config.generators do |g|\n g.template_engine :haml\n end\n" end end |
#copy_base_file ⇒ Object
26 27 28 |
# File 'lib/generators/haml_rails/install_generator.rb', line 26 def copy_base_file copy_file File.('../templates/base.rb', __FILE__), "#{@haml_dir}/base.rb" end |
#copy_controller_template ⇒ Object
7 8 9 10 11 |
# File 'lib/generators/haml_rails/install_generator.rb', line 7 def copy_controller_template @haml_dir = "lib/generators/haml" copy_file File.('../templates/controller/controller_generator.rb', __FILE__), "#{@haml_dir}/controller/controller_generator.rb" copy_file File.('../templates/controller/templates/view.html.haml', __FILE__), "#{@haml_dir}/controller/templates/view.html.haml" end |
#copy_mailer_template ⇒ Object
12 13 14 15 |
# File 'lib/generators/haml_rails/install_generator.rb', line 12 def copy_mailer_template copy_file File.('../templates/mailer/mailer_generator.rb', __FILE__), "#{@haml_dir}/mailer/mailer_generator.rb" copy_file File.('../templates/mailer/templates/view.text.haml', __FILE__), "#{@haml_dir}/mailer/templates/view.text.haml" end |
#copy_scaffold_template ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/generators/haml_rails/install_generator.rb', line 16 def copy_scaffold_template copy_file File.('../templates/scaffold/scaffold_generator.rb', __FILE__), "#{@haml_dir}/scaffold/scaffold_generator.rb" copy_file File.('../templates/scaffold/templates/_form.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/_form.html.haml" copy_file File.('../templates/scaffold/templates/edit.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/edit.html.haml" copy_file File.('../templates/scaffold/templates/index.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/index.html.haml" copy_file File.('../templates/scaffold/templates/layout.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/layout.html.haml" copy_file File.('../templates/scaffold/templates/new.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/new.html.haml" copy_file File.('../templates/scaffold/templates/show.html.haml', __FILE__), "#{@haml_dir}/scaffold/templates/show.html.haml" copy_file File.('../templates/scaffold/templates/_form.html.haml', __FILE__), "lib/templates/haml/scaffold/templates/_form.html.haml" end |