Sha256: ecca477ca9d481918a3ee45524c8b5793ab52b0bf12c4ed391b99272435cdeb1
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 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', :before => /^end/ 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polyblock-0.8.2 | lib/generators/polyblock/install/install_generator.rb |