Class: Insight::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Insight::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/insight/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/generators/insight/install/install_generator.rb', line 14 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
10 11 12 |
# File 'lib/generators/insight/install/install_generator.rb', line 10 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), "templates") end |
Instance Method Details
#install ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/insight/install/install_generator.rb', line 22 def install copy_file "insight.rb", "config/initializers/insight.rb" copy_file "insight.html.erb", "app/views/layouts/insight_layout.rb" copy_file "_insight_footer.html.erb", "app/views/layouts/_insight_footer.html.erb" copy_file "insight.sass", "app/assets/stylesheets/insight.css.sass" migration_template "migrations/link_users_to_crm_contacts.rb", "db/migrate/link_users_to_crm_contacts.rb" inject_into_class "app/models/user.rb", User, " include Insight::CRM::Callbacks::User\n" inject_into_class "app/models/account.rb", Account, " include Insight::CRM::Callbacks::Account\n" readme "README" end |