Sha256: 2252e3700ed5b90568d0f4c8bf51646ae0e763290db18ed21d659638b0e4205a
Contents?: true
Size: 1.59 KB
Versions: 19
Compression:
Stored size: 1.59 KB
Contents
require 'rails/generators/migration' module Polygallery 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 Polygallery models 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 # This is the old way of including migrations in a gem. # Migrations are now automatically appended by the engine. # Legacy code left commented below. # dest_dir = Rails.root.join 'db', 'migrate' # { # 'polygallery_migration.rb' => 'create_polygalleries.rb', # 'add_gallery_title.rb' => 'add_gallery_title_to_polyphotos.rb' # }.each do |source, dest_name| # unless self.class.migration_exists? dest_dir, dest_name # migration_template source, dest_dir.join(dest_name) # end # end end def inject_engine_routing inject_into_file 'config/routes.rb', :after => 'pplication.routes.draw do' do "\n\nmount Polygallery::Engine => '/polygallery'\n" end end def inject_js_initializer inject_into_file 'app/assets/javascripts/application.js', :before => '//= require_tree .' do "//= require polygallery/init\n" end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems