class Polygallery::Generators::InstallGenerator
Public Class Methods
next_migration_number(path)
click to toggle source
# File lib/generators/polygallery/install/install_generator.rb, line 10 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
Public Instance Methods
copy_migrations()
click to toggle source
# File lib/generators/polygallery/install/install_generator.rb, line 19 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
inject_engine_routing()
click to toggle source
# File lib/generators/polygallery/install/install_generator.rb, line 35 def inject_engine_routing inject_into_file 'config/routes.rb', :after => 'pplication.routes.draw do' do "\n\nmount Polygallery::Engine => '/polygallery'\n" end end
inject_js_initializer()
click to toggle source
# File lib/generators/polygallery/install/install_generator.rb, line 41 def inject_js_initializer inject_into_file 'app/assets/javascripts/application.js', :before => '//= require_tree .' do "//= require polygallery/init\n" end end