Sha256: 0ada59a10f93beb61afdad7d24fd1afbe7fa4195b1944cdfef373520f2148a7d
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require 'rails/generators' require 'rails/generators/migration' require 'rails/generators/active_record' module Draftsman class InstallGenerator < ::Rails::Generators::Base include ::Rails::Generators::Migration desc 'Generates (but does not run) a migration to add a drafts table.' source_root File.expand_path('../templates', __FILE__) class_option :skip_initializer, :type => :boolean, :default => false, :desc => 'Skip generation of the boilerplate initializer at `config/initializers/draftsman.rb`.' class_option :with_changes, :type => :boolean, :default => false, :desc => 'Store changeset (diff) with each draft' def create_migration_file migration_template 'create_drafts.rb', 'db/migrate/create_drafts.rb' migration_template 'add_object_changes_column_to_drafts.rb', 'db/migrate/add_object_changes_column_to_drafts.rb' if options.with_changes? end def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end def copy_config template 'config/initializers/draftsman.rb' unless options.skip_initializer? end end end
Version data entries
4 entries across 4 versions & 1 rubygems