class Smster::InstallGenerator
Public Class Methods
next_migration_number(_)
click to toggle source
# File lib/generators/smster/install_generator.rb, line 12 def self.next_migration_number(_) if @prev_migration_nr @prev_migration_nr += 1 else @prev_migration_nr = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i end @prev_migration_nr.to_s end
Public Instance Methods
copy_initializer()
click to toggle source
# File lib/generators/smster/install_generator.rb, line 24 def copy_initializer filename = 'smster' copy_file "#{filename}.rb", "config/initializers/#{filename}.rb" end
copy_migrations()
click to toggle source
# File lib/generators/smster/install_generator.rb, line 8 def copy_migrations copy_migration 'create_smsters' end
Protected Instance Methods
copy_migration(filename)
click to toggle source
# File lib/generators/smster/install_generator.rb, line 31 def copy_migration(filename) if self.class.migration_exists?('db/migrate', "#{filename}") say_status('skipped', "Migration #{filename}.rb already exists") else migration_template "#{filename}.rb", "db/migrate/#{filename}.rb" end end