class Cccode::Generators::InstallGenerator

Public Class Methods

next_migration_number(path) click to toggle source
# File lib/generators/cccode/install_generator.rb, line 16
def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Public Instance Methods

copy_migrations() click to toggle source
# File lib/generators/cccode/install_generator.rb, line 25
def copy_migrations
  copy_migration 'create_country_codes'
end
hi() click to toggle source
# File lib/generators/cccode/install_generator.rb, line 11
def hi
  puts "hi am Cccode installer running fine ..."
end

Protected Instance Methods

copy_migration(filename) click to toggle source
# File lib/generators/cccode/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