Sha256: cc8cceb60f5ae18c8700ab4ebcfa73db49ece0564846bd4f2a539b188817b4a2
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
require 'rails/generators/migration' module Polyblock module Generators class InstallGenerator < ::Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) desc "Create a migration to add the Polyblock::Block model to your project." def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end def copy_migrations migration_template "ckeditor_migration.rb", "db/migrate/create_ckeditor_assets.rb" migration_template "polyblock_migration.rb", "db/migrate/create_polyblock_blocks.rb" end def inject_engine_routing inject_into_file 'config/routes.rb', :after => 'Application.routes.draw do' do "\n\n mount Ckeditor::Engine => '/ckeditor'\n mount Polyblock::Engine => '/polyblock'\n" end end def inject_precompile_directives inject_into_file 'config/application.rb', :after => 'class Application < Rails::Application' do '\\n\\n config.autoload_paths += %W(#{config.root}/app/models/ckeditor)\\n config.assets.precompile += Ckeditor.assets\\n config.assets.precompile += %w(ckeditor/*)\\n' end end def inject_js_initializer inject_into_file 'app/assets/javascripts/application.js', :before => '//= require_tree .' do "//= require polyblock/init\n" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
polyblock-0.8.1 | lib/generators/polyblock/install/install_generator.rb |
polyblock-0.8.0 | lib/generators/polyblock/install/install_generator.rb |