Migration generator
This commit is contained in:
@@ -8,6 +8,8 @@ require 'burden/storage'
|
||||
require 'burden/version'
|
||||
require 'burden/wrapper'
|
||||
|
||||
# require 'generators/burden/install_generator'
|
||||
|
||||
module Burden
|
||||
include Config::Helper
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
class BurdenGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
|
||||
def self.source_root
|
||||
@source_root ||= File.dirname(__FILE__)
|
||||
end
|
||||
|
||||
def self.next_migration_number(dirname)
|
||||
if ActiveRecord::Base.timestamped_migrations
|
||||
Time.new.utc.strftime('%Y%m%d%H%M%S')
|
||||
else
|
||||
'%.3d' % (current_migration_number(dirname) + 1)
|
||||
end
|
||||
end
|
||||
|
||||
def create_migration_file
|
||||
migration_template 'create_burden_runs.rb', 'db/migrate/create_burden_runs.rb'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
Description:
|
||||
Explain the generator
|
||||
|
||||
Example:
|
||||
rails generate install Thing
|
||||
|
||||
This will create:
|
||||
what/will/it/create
|
||||
@@ -0,0 +1,20 @@
|
||||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
module Burden
|
||||
module Generators
|
||||
class InstallGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
|
||||
source_root File.expand_path('../templates', __FILE__)
|
||||
|
||||
def self.next_migration_number(path)
|
||||
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
||||
end
|
||||
|
||||
def create_migration
|
||||
migration_template 'create_burden_runs.rb', 'db/migrate/create_burden_runs.rb'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user