sidekiq-sequence 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91a8e78c3dcdb510dd75d150203b8161d7793c4c5c2604769ae9e07150f67ba7
4
- data.tar.gz: 24efead68470cecd5ed5d1a91d14ead9c2e974cc104d8a8acf9a349515367e04
3
+ metadata.gz: 9d62231fa8c75d8944656bef9bc0f94f24043812880c042cf95caa3f5195921d
4
+ data.tar.gz: 2f99168d41407c56a8b4ce9a1a88699e99dd6da3704349aba69f931642063dbe
5
5
  SHA512:
6
- metadata.gz: c14153031e5626cf83f8dd9d3e0b1568d186b78f6ac16f8e89bee21b6f75e8c3151c6a0771e73864ca54382bfc1ce32d3a939f645603cb93e10354b0250fc8d4
7
- data.tar.gz: 408898e6da2605566f7ba3a2be38a3b4b8c3a7af118f4d5ec5d164089a9e2106841c826218690f3b0b168a6df0ff457d0439299ad6f6e84d88981ff4336d7676
6
+ metadata.gz: a3cfff429f8bc6ebb53d9d5176d03d1f0d9bd290cd93f5e12d1a8eb5ee5c2883361df11fe75182d310255c9eac0f45bc6fe8a720315544c2c27edc046bbc5372
7
+ data.tar.gz: 992fc45e2f1984c46ef6cdcaa1e4252cb852b11881784cb0b88748fb24df1deb0a0120621645b5cc80d7e553b81daea8561572aba143f1626b560b13cd3dbe30
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'autotest/suffix'
4
+ require 'autotest/restart'
5
+ require 'autotest/bundler'
6
+
7
+ Autotest.add_hook :initialize do |at|
8
+ at.testlib = 'minitest/autorun'
9
+ at.add_exception '.git'
10
+ end
data/Gemfile CHANGED
@@ -6,4 +6,6 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 12.0'
9
- gem 'minitest', '~> 5.0'
9
+ gem 'minitest'
10
+ gem 'minitest-autotest'
11
+ gem 'autotest-suffix'
@@ -0,0 +1,88 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sidekiq-sequence (0.1.7)
5
+ activerecord (>= 5)
6
+ railties (>= 5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (6.0.3.2)
12
+ actionview (= 6.0.3.2)
13
+ activesupport (= 6.0.3.2)
14
+ rack (~> 2.0, >= 2.0.8)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.0.3.2)
19
+ activesupport (= 6.0.3.2)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activemodel (6.0.3.2)
25
+ activesupport (= 6.0.3.2)
26
+ activerecord (6.0.3.2)
27
+ activemodel (= 6.0.3.2)
28
+ activesupport (= 6.0.3.2)
29
+ activesupport (6.0.3.2)
30
+ concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ i18n (>= 0.7, < 2)
32
+ minitest (~> 5.1)
33
+ tzinfo (~> 1.1)
34
+ zeitwerk (~> 2.2, >= 2.2.2)
35
+ autotest-suffix (1.1.0)
36
+ builder (3.2.4)
37
+ concurrent-ruby (1.1.6)
38
+ crass (1.0.6)
39
+ erubi (1.9.0)
40
+ i18n (1.8.3)
41
+ concurrent-ruby (~> 1.0)
42
+ loofah (2.6.0)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (1.0.0)
46
+ mini_portile2 (2.4.0)
47
+ minitest (5.14.1)
48
+ minitest-autotest (1.1.1)
49
+ minitest-server (~> 1.0)
50
+ path_expander (~> 1.0)
51
+ minitest-server (1.0.6)
52
+ minitest (~> 5.0)
53
+ nokogiri (1.10.9)
54
+ mini_portile2 (~> 2.4.0)
55
+ path_expander (1.1.0)
56
+ rack (2.2.3)
57
+ rack-test (1.1.0)
58
+ rack (>= 1.0, < 3)
59
+ rails-dom-testing (2.0.3)
60
+ activesupport (>= 4.2.0)
61
+ nokogiri (>= 1.6)
62
+ rails-html-sanitizer (1.3.0)
63
+ loofah (~> 2.3)
64
+ railties (6.0.3.2)
65
+ actionpack (= 6.0.3.2)
66
+ activesupport (= 6.0.3.2)
67
+ method_source
68
+ rake (>= 0.8.7)
69
+ thor (>= 0.20.3, < 2.0)
70
+ rake (12.3.3)
71
+ thor (1.0.1)
72
+ thread_safe (0.3.6)
73
+ tzinfo (1.2.7)
74
+ thread_safe (~> 0.1)
75
+ zeitwerk (2.3.1)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ autotest-suffix
82
+ minitest
83
+ minitest-autotest
84
+ rake (~> 12.0)
85
+ sidekiq-sequence!
86
+
87
+ BUNDLED WITH
88
+ 2.1.4
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rails'
4
+ require 'active_support/dependencies'
3
5
  require 'sidekiq/sequence/version'
4
6
  require 'sidekiq/sequence/engine'
5
- require 'sidekiq/sequence/base'
6
- require 'sidekiq/sequence/worker'
7
7
 
8
8
  module Sidekiq
9
9
  module Sequence
10
+ autoload :Base, 'sidekiq/sequence/base'
11
+ autoload :Worker, 'sidekiq/sequence/worker'
10
12
  end
11
13
  end
@@ -2,24 +2,22 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Sequence
5
- # rubocop:disable Style/ClassVars
6
5
  class Base
7
- @@steps = []
6
+ class << self
7
+ attr_reader :steps
8
8
 
9
- def self.step(worker_class)
10
- @@steps << worker_class unless @@steps.include?(worker_class)
11
- end
12
-
13
- def self.steps
14
- @@steps
9
+ def step(worker_class)
10
+ @steps = [] if steps.nil?
11
+ @steps << worker_class.name
12
+ end
15
13
  end
16
14
 
17
15
  def self.perform_step(index, id)
18
- if index >= @@steps.size
16
+ if index >= steps.size
19
17
  # No more steps in the sequence, so delete the record.
20
18
  Record.destroy id
21
19
  else
22
- @@steps[index].perform_async id
20
+ steps[index].constantize.perform_async id
23
21
  end
24
22
  end
25
23
 
@@ -27,9 +25,8 @@ module Sidekiq
27
25
  record = Record.create(data: data)
28
26
 
29
27
  # Start first job in the sequence.
30
- @@steps.first.perform_async record.id
28
+ self.class.steps.first.constantize.perform_async record.id
31
29
  end
32
30
  end
33
- # rubocop:enable Style/ClassVars
34
31
  end
35
32
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Sequence
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.8'
6
6
  end
7
7
  end
@@ -24,4 +24,7 @@ Gem::Specification.new do |spec|
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
25
  end
26
26
  spec.require_paths = ['lib']
27
+
28
+ spec.add_dependency 'railties', '>= 5'
29
+ spec.add_dependency 'activerecord', '>= 5'
27
30
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-sequence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
13
41
  description: Create and manage sequential jobs in Sidekiq
14
42
  email:
15
43
  - joel@developwithstyle.com
@@ -17,16 +45,16 @@ executables: []
17
45
  extensions: []
18
46
  extra_rdoc_files: []
19
47
  files:
48
+ - ".autotest"
20
49
  - ".gitignore"
21
50
  - ".travis.yml"
22
51
  - CODE_OF_CONDUCT.md
23
52
  - Gemfile
53
+ - Gemfile.lock
24
54
  - LICENSE.txt
25
55
  - README.md
26
56
  - Rakefile
27
57
  - app/models/sidekiq/sequence/record.rb
28
- - bin/console
29
- - bin/setup
30
58
  - lib/generators/sidekiq_sequence/install_generator.rb
31
59
  - lib/generators/sidekiq_sequence/templates/migration.rb.tt
32
60
  - lib/sidekiq/sequence.rb
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "sidekiq/sequence"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here