Sha256: 53af82bea61872bce88a5b128138ae533348afb4128d5432140ba6fef63d9de4
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'rails/generators/active_record' module Sojourn module Generators class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration desc 'Copies sojourn migrations to your file.' source_root File.expand_path('../templates', __FILE__) def self.next_migration_number(dirname) next_migration_number = current_migration_number(dirname) + 1 if ::ActiveRecord::Base.timestamped_migrations [Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max else format('%.3d', next_migration_number) end end def create_config_file template 'config_initializer.rb', 'config/initializers/sojourn.rb' end def create_migrations %w(campaigns browsers requests events).map { |m| "create_sojourn_#{m}" }.each do |name| if self.class.migration_exists?('db/migrate', name) say " #{set_color('skip', :yellow)} #{name}.rb (migration already exists)" else migration_template "#{name}.rb", "db/migrate/#{name}.rb" sleep 1 end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sojourn-1.0.0.pre2 | lib/generators/sojourn/install_generator.rb |
sojourn-1.0.0.pre | lib/generators/sojourn/install_generator.rb |
sojourn-0.0.7 | lib/generators/sojourn/install_generator.rb |