Sha256: 7d15e6b6be46f07addd0dc697c0a11fb51e75d606aa76fdfc0094bbc9ea0ba5d

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

require 'rails/generators/migration'


module ActiveRecord
  module Generators
    class OproGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)

      desc "add the migrations needed for opro oauth"

      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 "access_grants.rb",       "db/migrate/create_opro_access_grants.rb"
        migration_template "client_applications.rb", "db/migrate/create_opro_client_applications.rb"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opro-0.0.3 lib/generators/active_record/opro_generator.rb
opro-0.0.2 lib/generators/active_record/opro_generator.rb