-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor configuration and fix styles
- Loading branch information
Showing
28 changed files
with
310 additions
and
233 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
Lint/HandleExceptions: | ||
Enabled: true | ||
|
||
Lint/UselessAssignment: | ||
Enabled: true | ||
|
||
Metrics/AbcSize: | ||
Max: 38 | ||
|
||
Metrics/CyclomaticComplexity: | ||
Max: 7 | ||
|
||
Metrics/LineLength: | ||
Max: 108 | ||
|
||
Metrics/MethodLength: | ||
Max: 13 | ||
|
||
Metrics/PerceivedComplexity: | ||
Max: 8 | ||
|
||
Style/AccessorMethodName: | ||
Enabled: true | ||
|
||
Style/ConstantName: | ||
Enabled: true | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Style/FileName: | ||
Enabled: true | ||
|
||
Style/GlobalVars: | ||
Enabled: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
#!/usr/bin/env rake | ||
require "rubygems" | ||
require "bundler/setup" | ||
require "bundler/gem_tasks" | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
require 'rubocop/rake_task' | ||
|
||
RuboCop::RakeTask.new(:style) | ||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: [:spec, :style] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
require 'yaml' if RUBY_VERSION.include?('2.0.0') | ||
require 'sidekiq_unique_jobs/middleware' | ||
require 'sidekiq_unique_jobs/version' | ||
require 'sidekiq_unique_jobs/config' | ||
require 'sidekiq_unique_jobs/payload_helper' | ||
require 'ostruct' | ||
|
||
module SidekiqUniqueJobs | ||
module_function | ||
|
||
def config | ||
@config ||= Config.new( | ||
unique_prefix: 'sidekiq_unique', | ||
unique_args_enabled: false, | ||
default_expiration: 30 * 60, | ||
default_unlock_order: :after_yield | ||
) | ||
end | ||
|
||
def unique_args_enabled? | ||
config.unique_args_enabled | ||
end | ||
|
||
def configure | ||
yield configuration | ||
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,47 @@ | ||
module SidekiqUniqueJobs | ||
class Config < OpenStruct | ||
CONFIG_ACCESSORS = [ | ||
:unique_prefix, | ||
:unique_args_enabled, | ||
:default_expiration, | ||
:default_unlock_order | ||
] | ||
|
||
class << self | ||
warn('This method has been deprecated. See readme for information') | ||
CONFIG_ACCESSORS.each do |method| | ||
define_method(method) do | ||
warn('This method has been deprecated. See readme for information') | ||
config.send(method) | ||
end | ||
|
||
define_method("#{method}=") do |obj| | ||
warn('This method has been deprecated. See readme for information') | ||
config.send("#{method}=", obj) | ||
end | ||
end | ||
|
||
def unique_args_enabled? | ||
warn('This method has been deprecated. See readme for information') | ||
config.unique_args_enabled | ||
end | ||
|
||
def config | ||
SidekiqUniqueJobs.config | ||
end | ||
end | ||
|
||
def testing_enabled? | ||
if Sidekiq.const_defined?('Testing') && Sidekiq::Testing.enabled? | ||
require 'sidekiq_unique_jobs/testing' | ||
return true | ||
end | ||
|
||
false | ||
end | ||
|
||
def unique_args_enabled? | ||
config.unique_args_enabled | ||
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
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
2 changes: 1 addition & 1 deletion
2
...iddleware/client/connectors/redis_pool.rb → ...iddleware/client/connectors/redis_pool.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
4 changes: 2 additions & 2 deletions
4
...leware/client/connectors/sidekiq_redis.rb → ...leware/client/connectors/sidekiq_redis.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
6 changes: 3 additions & 3 deletions
6
...dleware/client/connectors/testing_fake.rb → ...dleware/client/connectors/testing_fake.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
8 changes: 4 additions & 4 deletions
8
...eware/client/connectors/testing_inline.rb → ...eware/client/connectors/testing_inline.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
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
Oops, something went wrong.