lib/generators/doorkeeper/migration_generator.rb in doorkeeper-4.4.3 vs lib/generators/doorkeeper/migration_generator.rb in doorkeeper-5.0.0.rc1

- old
+ new

@@ -1,27 +1,32 @@ +# frozen_string_literal: true + +require 'rails/generators' require 'rails/generators/active_record' -class Doorkeeper::MigrationGenerator < ::Rails::Generators::Base - include Rails::Generators::Migration - source_root File.expand_path('../templates', __FILE__) - desc 'Installs Doorkeeper migration file.' +module Doorkeeper + class MigrationGenerator < ::Rails::Generators::Base + include ::Rails::Generators::Migration + source_root File.expand_path('templates', __dir__) + desc 'Installs Doorkeeper migration file.' - def install - migration_template( - 'migration.rb.erb', - 'db/migrate/create_doorkeeper_tables.rb', - migration_version: migration_version - ) - end + def install + migration_template( + 'migration.rb.erb', + 'db/migrate/create_doorkeeper_tables.rb', + migration_version: migration_version + ) + end - def self.next_migration_number(dirname) - ActiveRecord::Generators::Base.next_migration_number(dirname) - end + def self.next_migration_number(dirname) + ActiveRecord::Generators::Base.next_migration_number(dirname) + end - private + private - def migration_version - if ActiveRecord::VERSION::MAJOR >= 5 - "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" + def migration_version + if ActiveRecord::VERSION::MAJOR >= 5 + "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" + end end end end