class Tr8nGenerator
Public Class Methods
next_migration_number(dirname)
click to toggle source
Implement the required interface for Rails::Generators::Migration.
# File lib/generators/tr8n/tr8n_generator.rb, line 35 def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end
source_root()
click to toggle source
# File lib/generators/tr8n/tr8n_generator.rb, line 30 def self.source_root @source_root ||= File.expand_path('../templates', __FILE__) end
Public Instance Methods
copy_configuration()
click to toggle source
# File lib/generators/tr8n/tr8n_generator.rb, line 47 def copy_configuration config_source = File.expand_path("#{self.class.source_root}/config/tr8n", __FILE__) system "rsync -ruv #{config_source} #{Rails.root}/config" end
copy_layouts()
click to toggle source
# File lib/generators/tr8n/tr8n_generator.rb, line 52 def copy_layouts layouts_source = File.expand_path("#{self.class.source_root}/layouts", __FILE__) system "rsync -ruv #{layouts_source} #{Rails.root}/app/views" end
create_migration_file()
click to toggle source
# File lib/generators/tr8n/tr8n_generator.rb, line 43 def create_migration_file migration_template 'db/create_tr8n_tables.rb', 'db/migrate/create_tr8n_tables.rb' end