-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using of Sequel 5: merge pull request #8 from nbulaj/sequel5
Allow to use Sequel 5
- Loading branch information
Showing
26 changed files
with
154 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/doorkeeper-sequel/generators/application_owner_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module DoorkeeperSequel | ||
class ApplicationOwnerGenerator < ::Thor::Group | ||
include ::Thor::Actions | ||
include MigrationActions | ||
|
||
source_root File.expand_path('../templates', __FILE__) | ||
|
||
desc 'Provide support for client application ownership.' | ||
|
||
def install | ||
create_migration 'add_owner_to_application.rb' | ||
end | ||
end | ||
end |
43 changes: 43 additions & 0 deletions
43
lib/doorkeeper-sequel/generators/concerns/migration_actions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module DoorkeeperSequel | ||
module MigrationActions | ||
extend ::ActiveSupport::Concern | ||
|
||
protected | ||
|
||
def create_migration(template_name) | ||
copy_file template_name, migration_filename_for(template_name) | ||
end | ||
|
||
def migration_template | ||
File.expand_path('../templates/migration.rb', __FILE__) | ||
end | ||
|
||
private | ||
|
||
def migration_filename_for(template_name) | ||
"db/migrate/#{new_migration_number}_#{template_name}" | ||
end | ||
|
||
def new_migration_number | ||
current_number = current_migration_number('db/migrate') | ||
|
||
# possible numeric migration | ||
if current_number && current_number.start_with?('0') | ||
# generate the same name as used by the developer | ||
"%.#{current_number.length}d" % (current_number.to_i + 1) | ||
else | ||
Time.now.utc.strftime('%Y%m%d%H%M%S') | ||
end | ||
end | ||
|
||
def current_migration_number(dirname) | ||
migration_lookup_at(dirname).collect do |file| | ||
File.basename(file).split('_').first | ||
end.max | ||
end | ||
|
||
def migration_lookup_at(dirname) | ||
Dir.glob("#{dirname}/[0-9]*_*.rb") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module DoorkeeperSequel | ||
class MigrationGenerator < ::Thor::Group | ||
include ::Thor::Actions | ||
include MigrationActions | ||
|
||
source_root File.expand_path('../templates', __FILE__) | ||
|
||
desc 'Installs Doorkeeper Sequel migration file.' | ||
|
||
def install | ||
create_migration 'migration.rb' | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
lib/doorkeeper-sequel/generators/previous_refresh_token_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module DoorkeeperSequel | ||
class PreviousRefreshTokenGenerator < ::Thor::Group | ||
include ::Thor::Actions | ||
include MigrationActions | ||
|
||
source_root File.expand_path('../templates', __FILE__) | ||
|
||
desc 'Support revoke refresh token on access token use' | ||
|
||
def install | ||
create_migration 'add_previous_refresh_token_to_access_tokens.rb' | ||
end | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module DoorkeeperSequel | ||
class Railtie < ::Rails::Railtie | ||
rake_tasks do | ||
load File.expand_path('../tasks/doorkeeper-sequel.rake', __FILE__) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace :doorkeeper_sequel do | ||
namespace :generate do | ||
desc 'Generate main migration file' | ||
task :migration do | ||
DoorkeeperSequel::MigrationGenerator.start | ||
end | ||
|
||
desc 'Generate migration file for Application Owner functionality' | ||
task :application_owner do | ||
DoorkeeperSequel::ApplicationOwnerGenerator.start | ||
end | ||
|
||
desc 'Generate migration file for Previous Refresh Token functionality' | ||
task :previous_refresh_token do | ||
DoorkeeperSequel::PreviousRefreshTokenGenerator.start | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
lib/generators/doorkeeper/sequel/application_owner_generator.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
lib/generators/doorkeeper/sequel/previous_refresh_token_generator.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.