Class: Manifest::InstallGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- Manifest::InstallGenerator
- Defined in:
- lib/generators/manifest/install/install_generator.rb
Overview
Creates templates and migrations for the initial Manifest install. Example:
rails generate manifest:install Page
The “Page” argument is completely arbitrary.
Instance Method Summary collapse
- #create_pages_directory ⇒ Object
- #create_public_layout ⇒ Object
- #generate_add_index_to_content_blocks_migration ⇒ Object
- #generate_add_index_to_pages_migration ⇒ Object
- #generate_content_blocks_migratoin ⇒ Object
- #generate_create_editors_migration ⇒ Object
- #generate_create_pages_migration ⇒ Object
- #inject_assets_for_precompiling_in_application_rb ⇒ Object
- #require_manifest_in_application_rb ⇒ Object
Instance Method Details
#create_pages_directory ⇒ Object
30 31 32 |
# File 'lib/generators/manifest/install/install_generator.rb', line 30 def create_pages_directory empty_directory 'app/views/pages' end |
#create_public_layout ⇒ Object
34 35 36 |
# File 'lib/generators/manifest/install/install_generator.rb', line 34 def create_public_layout create_file 'app/views/layouts/public.html.erb' end |
#generate_add_index_to_content_blocks_migration ⇒ Object
22 23 24 |
# File 'lib/generators/manifest/install/install_generator.rb', line 22 def generate_add_index_to_content_blocks_migration migration_template 'add_index_to_content_blocks.rb', 'db/migrate/add_index_to_content_blocks.rb' end |
#generate_add_index_to_pages_migration ⇒ Object
18 19 20 |
# File 'lib/generators/manifest/install/install_generator.rb', line 18 def generate_add_index_to_pages_migration migration_template 'add_index_to_pages.rb', 'db/migrate/add_index_to_pages.rb' end |
#generate_content_blocks_migratoin ⇒ Object
14 15 16 |
# File 'lib/generators/manifest/install/install_generator.rb', line 14 def generate_content_blocks_migratoin migration_template 'create_content_blocks.rb', 'db/migrate/create_content_blocks.rb' end |
#generate_create_editors_migration ⇒ Object
26 27 28 |
# File 'lib/generators/manifest/install/install_generator.rb', line 26 def generate_create_editors_migration migration_template 'create_editors.rb', 'db/migrate/create_editors.rb' end |
#generate_create_pages_migration ⇒ Object
10 11 12 |
# File 'lib/generators/manifest/install/install_generator.rb', line 10 def generate_create_pages_migration migration_template 'create_pages.rb', 'db/migrate/create_pages.rb' end |
#inject_assets_for_precompiling_in_application_rb ⇒ Object
47 48 49 50 51 52 |
# File 'lib/generators/manifest/install/install_generator.rb', line 47 def inject_assets_for_precompiling_in_application_rb line = " config.assets.precompile += ['manifest/main.css', 'manifest/sessions.css', 'manifest/main.js']\n" application_file = "#{Rails.root}/config/application.rb" sentinel = /^ {2}end\nend/ inject_into_file application_file, line, before: sentinel end |
#require_manifest_in_application_rb ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/generators/manifest/install/install_generator.rb', line 38 def require_manifest_in_application_rb application_file = "#{Rails.root}/config/application.rb" File.open(application_file, 'r') do |f| sentinel = /Bundler.require/ inject_into_file application_file, "require 'manifest'\n\n", before: sentinel end end |