Class: PlatformGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/platform/platform_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
- .source_root ⇒ Object
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
35 36 37 38 39 40 41 |
# File 'lib/generators/platform/platform_generator.rb', line 35 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
30 31 32 |
# File 'lib/generators/platform/platform_generator.rb', line 30 def self.source_root @source_root ||= File.('../templates', __FILE__) end |
Instance Method Details
#copy_configuration ⇒ Object
47 48 49 50 |
# File 'lib/generators/platform/platform_generator.rb', line 47 def copy_configuration config_source = File.("#{self.class.source_root}/config", __FILE__) system "rsync -ruv #{config_source} #{Rails.root}/config" end |
#copy_layouts ⇒ Object
52 53 54 55 |
# File 'lib/generators/platform/platform_generator.rb', line 52 def copy_layouts layouts_source = File.("#{self.class.source_root}/layouts", __FILE__) system "rsync -ruv #{layouts_source} #{Rails.root}/app/views" end |
#create_migration_file ⇒ Object
43 44 45 |
# File 'lib/generators/platform/platform_generator.rb', line 43 def create_migration_file migration_template 'db/create_platform_tables.rb', 'db/migrate/create_platform_tables.rb' end |