Sha256: d8f72734df7e550c67ad725f35c13984ec022c4e0bd4c3f9a747f5cd3668cbc1

Contents?: true

Size: 781 Bytes

Versions: 4

Compression:

Stored size: 781 Bytes

Contents

require 'rails/generators/migration'

module Honor
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "Generates migration for Points and Scorecard"

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

      def copy_migrations
        migration_template 'create_honor_points.rb', 'db/migrate/create_honor_points.rb'
        migration_template 'create_honor_scorecards.rb', 'db/migrate/create_honor_scorecards.rb'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
honor-2.0.1 lib/generators/honor/install/install_generator.rb
honor-2.0.0 lib/generators/honor/install/install_generator.rb
honor-1.0.3 lib/generators/honor/install/install_generator.rb
honor-1.0.2 lib/generators/honor/install/install_generator.rb