class CassandraConfigurationGenerator
Public Instance Methods
generate_configuration()
click to toggle source
Creates configuration file and migration directory
Any public method in the generator is run automatically when the generator is run. To understand fully see asciicasts.com/episodes/218-making-generators-in-rails-3
# File lib/cassandra_migrations/railtie/generators/cassandra_configuration/cassandra_configuration_generator.rb, line 10 def generate_configuration require 'fileutils' require 'colorize' # create cassandra.yaml if File.exists?(File.expand_path('config/cassandra.yml')) puts "[skip] 'config/cassandra.yml' already exists".yellow else puts "[new] creating 'config/cassandra.yml' (please update with your own configurations!)".green template "cassandra.yml", "config/cassandra.yml" end # create db/cassandra_migrations if File.exists?(File.expand_path('db/cassandra_migrate')) puts "[skip] 'db/cassandra_migrate' already exists".yellow else puts "[new] creating 'db/cassandra_migrate' directory".green FileUtils.mkdir(File.expand_path('db/cassandra_migrate')) end puts '[done]'.green end