Class: Lotus::Generators::Migration Private
- Defined in:
- lib/lotus/generators/migration.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- TIMESTAMP_FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%Y%m%d%H%M%S'.freeze
- FILENAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'%{timestamp}_%{name}.rb'.freeze
Instance Method Summary collapse
-
#initialize(command) ⇒ Migration
constructor
private
A new instance of Migration.
- #start ⇒ Object private
Constructor Details
#initialize(command) ⇒ Migration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Migration.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lotus/generators/migration.rb', line 25 def initialize(command) super = Time.now.utc.strftime(TIMESTAMP_FORMAT) filename = FILENAME % { timestamp: , name: name } env.require_application_environment @destination = Lotus::Model.configuration.migrations.join(filename) cli.class.source_root(source) end |
Instance Method Details
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 46 47 |
# File 'lib/lotus/generators/migration.rb', line 39 def start templates = { 'migration.rb.tt' => @destination } templates.each do |src, dst| cli.template(source.join(src), target.join(dst), {}) end end |