class ActiveEndpoint::Generators::InstallGenerator

Public Class Methods

next_migration_number(_dirname) click to toggle source
# File lib/generators/active_endpoint/install_generator.rb, line 9
def next_migration_number(_dirname)
  Time.current.strftime('%Y%m%d%H%M%S')
end

Public Instance Methods

copy_initializer_file() click to toggle source
# File lib/generators/active_endpoint/install_generator.rb, line 16
def copy_initializer_file
  puts '=> Copy initializer file to config/initializers/active_endpoint.rb'
  copy_file 'active_endpoint.rb', 'config/initializers/active_endpoint.rb'
end
copy_migration_file() click to toggle source
# File lib/generators/active_endpoint/install_generator.rb, line 21
def copy_migration_file
  puts '=> Create migration file in db/migrate/***_create_active_endpoint_probes.rb'
  migration_template 'migration.erb', 'db/migrate/create_active_endpoint_probes.rb',
                     migration_version: migration_version
end

Private Instance Methods

migration_version() click to toggle source
# File lib/generators/active_endpoint/install_generator.rb, line 29
def migration_version
  last_rails = ::Rails.version.start_with?('5')
  "[#{::Rails::VERSION::MAJOR}.#{::Rails::VERSION::MINOR}]" if last_rails
end