Class: Virgo::MigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/virgo/migrations/migrations_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_migrationsObject


5
6
7
8
9
10
11
12
13
# File 'lib/generators/virgo/migrations/migrations_generator.rb', line 5

def copy_migrations
  timestamp_str = Time.now.strftime("%Y%m%d%H%M%S").to_s
  src_path = "#{engine_root}/db/migrate/create_virgo_schema.rb"
  dest_path = "#{Rails.root}/db/migrate/#{timestamp_str}_create_virgo_schema.rb"

  unless File.directory?(dest_path)
    copy_file src_path, dest_path
  end
end

#engine_rootObject


15
16
17
# File 'lib/generators/virgo/migrations/migrations_generator.rb', line 15

def engine_root
  File.expand_path('../../../../..', __FILE__)
end