class Sentinel::Generators::Install::MigrationsGenerator

Constants

ROOT_PATH

Public Instance Methods

copy_migrations() click to toggle source
# File lib/generators/sentinel/install/migrations_generator.rb, line 16
def copy_migrations
  paths = Dir["#{File.absolute_path("#{ROOT_PATH}/db/migrate", __FILE__)}/*.rb"]
  module_name = Module.nesting.last.name.downcase

  paths.each do |d|
    ext = File.extname(d)
    filename = File.basename(d, ext)
    file = "#{filename}.#{module_name}#{ext}"
    # uses source path
    copy_file d, "db/migrate/#{file}"
  end

end