class PhrasingGenerator

Public Class Methods

next_migration_number(path) click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 22
def self.next_migration_number(path)
  sleep 1 # migration numbers should differentiate
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Public Instance Methods

create_helper_file() click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 10
def create_helper_file
  helper_location = "app/helpers/phrasing_helper.rb"
  copy_file helper_location, helper_location
end
create_initializer_file() click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 5
def create_initializer_file
  initializer_location = "config/initializers/phrasing.rb"
  copy_file initializer_location, initializer_location
end
create_migrations() click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 15
def create_migrations
  phrasing_phrase_migration = "db/migrate/create_phrasing_phrases.rb"
  migration_template phrasing_phrase_migration, phrasing_phrase_migration
  phrase_versions_migration = "db/migrate/create_phrasing_phrase_versions.rb"
  migration_template phrase_versions_migration, phrase_versions_migration
end
migration_version() click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 27
def migration_version
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails_major_version >= 5
end
rails_major_version() click to toggle source
# File lib/generators/phrasing/phrasing_generator.rb, line 31
def rails_major_version
  Rails.version.first.to_i
end