Class: Kublog::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Kublog::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/kublog/install/install_generator.rb
Instance Method Summary collapse
-
#generate_coffee ⇒ Object
Optionally copies javascript files.
- #generate_configuration ⇒ Object
- #generate_css ⇒ Object
-
#generate_email_views ⇒ Object
Generates all email views to the users app.
-
#generate_html_views ⇒ Object
Generates all html views to the users app.
-
#generate_kublog_controller ⇒ Object
Generates the controller needed for user integration.
- #generate_layout ⇒ Object
- #generate_localization ⇒ Object
-
#generate_migrations ⇒ Object
Generates migrations to make all installation in one step.
Instance Method Details
#generate_coffee ⇒ Object
Optionally copies javascript files
50 51 52 53 54 |
# File 'lib/generators/kublog/install/install_generator.rb', line 50 def generate_coffee if .coffee? directory "app/assets/javascripts/kublog" end end |
#generate_configuration ⇒ Object
41 42 43 |
# File 'lib/generators/kublog/install/install_generator.rb', line 41 def generate_configuration copy_file template_path('configuration.rb.tt'), 'config/initializers/kublog.rb' end |
#generate_css ⇒ Object
37 38 39 |
# File 'lib/generators/kublog/install/install_generator.rb', line 37 def generate_css directory 'app/assets/stylesheets/kublog' end |
#generate_email_views ⇒ Object
Generates all email views to the users app
29 30 31 |
# File 'lib/generators/kublog/install/install_generator.rb', line 29 def generate_email_views directory "app/views/kublog/post_mailer" end |
#generate_html_views ⇒ Object
Generates all html views to the users app. Does not copy RSS
24 25 26 |
# File 'lib/generators/kublog/install/install_generator.rb', line 24 def generate_html_views selective_copy 'app/views/kublog/posts/*.html.erb' end |
#generate_kublog_controller ⇒ Object
Generates the controller needed for user integration
19 20 21 |
# File 'lib/generators/kublog/install/install_generator.rb', line 19 def generate_kublog_controller copy_file "app/controllers/kublog/application_controller.rb" end |
#generate_layout ⇒ Object
33 34 35 |
# File 'lib/generators/kublog/install/install_generator.rb', line 33 def generate_layout directory 'app/views/layouts/kublog' end |
#generate_localization ⇒ Object
45 46 47 |
# File 'lib/generators/kublog/install/install_generator.rb', line 45 def generate_localization copy_file "config/locales/kublog/en.yml" end |
#generate_migrations ⇒ Object
Generates migrations to make all installation in one step
10 11 12 13 14 15 16 |
# File 'lib/generators/kublog/install/install_generator.rb', line 10 def generate_migrations Dir[File.join(source_paths, 'db', 'migrate', '*.rb')].each do |file| migration_filepath = file.match(/\A.+\/(db\/migrate\/.+)\Z/i)[1] raw_migration_filename = file.match(/\d+\_(.+)\Z/i)[1] migration_template migration_filepath, "db/migrate/#{raw_migration_filename}" end end |