sidekiq-sequence 0.1.4 → 0.1.9

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: b25bd499805fc6e3f2a773a74b060ad034109dc908124a41646c49d6bb7c8dad
4
- data.tar.gz: 7bdb0c5d3695ed8f3e8d4e603b1fadd9471f0f49e50d2f642f25850ec1883c8f
3
+ metadata.gz: 9277190a95f032f08017866653a6bb073bde7a5546b1300707d0290d96a4b363
4
+ data.tar.gz: 23a86b0b37f95135ec439728bd286e04f836bcea638b7808b52ec214f8bfabfc
5
5
  SHA512:
6
- metadata.gz: 14441441af4b1eaafe2adfed3db18614ffaa86bf3745876928ceaca810733eab153e8bdc6e83b04e9ebeb4a5a4f4888d7d9256a34f2137cfa45ee152095d0980
7
- data.tar.gz: 8c6eca8e632e8ecb6f348765a1c12e2ff698aeb85f2abefe8bbd08f0055bce0d8b153c1fafc89e1793fe0c3299d54efd6f636d24fe98e6bf30d888d248b44723
6
+ metadata.gz: 6067738cadae32d9125cb295bc2c19d7e0f0d209294a3702794c1f4ea85b5f12bbd165402ee5f23f45b066e75ad557e2b1a4f4e56270d1bb1db707d3216e7b3d
7
+ data.tar.gz: 07eb2b647ed37fee81a845cc2c64c62e2c76ad252e44ebe4bf52a7bc532ca91dcd971b8f556fa66fd469f56cf38f4c5063c4538eafe315370710097b65cc6bec
data/.autotest ADDED
@@ -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
@@ -5,5 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in sidekiq-sequence.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 12.0'
9
- gem 'minitest', '~> 5.0'
8
+ gem 'autotest-suffix'
9
+ gem 'minitest'
10
+ gem 'minitest-autotest'
11
+ gem 'rake'
data/Gemfile.lock ADDED
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sidekiq-sequence (0.1.8)
5
+ activerecord (>= 5)
6
+ railties (>= 5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (6.1.3.1)
12
+ actionview (= 6.1.3.1)
13
+ activesupport (= 6.1.3.1)
14
+ rack (~> 2.0, >= 2.0.9)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.1.3.1)
19
+ activesupport (= 6.1.3.1)
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.1.3.1)
25
+ activesupport (= 6.1.3.1)
26
+ activerecord (6.1.3.1)
27
+ activemodel (= 6.1.3.1)
28
+ activesupport (= 6.1.3.1)
29
+ activesupport (6.1.3.1)
30
+ concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ i18n (>= 1.6, < 2)
32
+ minitest (>= 5.1)
33
+ tzinfo (~> 2.0)
34
+ zeitwerk (~> 2.3)
35
+ autotest-suffix (1.1.0)
36
+ builder (3.2.4)
37
+ concurrent-ruby (1.1.8)
38
+ crass (1.0.6)
39
+ erubi (1.10.0)
40
+ i18n (1.8.10)
41
+ concurrent-ruby (~> 1.0)
42
+ loofah (2.9.1)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (1.0.0)
46
+ mini_portile2 (2.5.0)
47
+ minitest (5.14.4)
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.11.3)
54
+ mini_portile2 (~> 2.5.0)
55
+ racc (~> 1.4)
56
+ path_expander (1.1.0)
57
+ racc (1.5.2)
58
+ rack (2.2.3)
59
+ rack-test (1.1.0)
60
+ rack (>= 1.0, < 3)
61
+ rails-dom-testing (2.0.3)
62
+ activesupport (>= 4.2.0)
63
+ nokogiri (>= 1.6)
64
+ rails-html-sanitizer (1.3.0)
65
+ loofah (~> 2.3)
66
+ railties (6.1.3.1)
67
+ actionpack (= 6.1.3.1)
68
+ activesupport (= 6.1.3.1)
69
+ method_source
70
+ rake (>= 0.8.7)
71
+ thor (~> 1.0)
72
+ rake (13.0.3)
73
+ thor (1.1.0)
74
+ tzinfo (2.0.4)
75
+ concurrent-ruby (~> 1.0)
76
+ zeitwerk (2.4.2)
77
+
78
+ PLATFORMS
79
+ ruby
80
+
81
+ DEPENDENCIES
82
+ autotest-suffix
83
+ minitest
84
+ minitest-autotest
85
+ rake
86
+ sidekiq-sequence!
87
+
88
+ BUNDLED WITH
89
+ 2.2.15
@@ -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,25 +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
- klass = worker_class.name
11
- @@steps << klass unless @@steps.include?(klass)
12
- end
13
-
14
- def self.steps
15
- @@steps
9
+ def step(worker_class)
10
+ @steps = [] if steps.nil?
11
+ @steps << worker_class.name
12
+ end
16
13
  end
17
14
 
18
15
  def self.perform_step(index, id)
19
- if index >= @@steps.size
16
+ if index >= steps.size
20
17
  # No more steps in the sequence, so delete the record.
21
18
  Record.destroy id
22
19
  else
23
- @@steps[index].constantize.perform_async id
20
+ steps[index].constantize.perform_async id
24
21
  end
25
22
  end
26
23
 
@@ -28,9 +25,8 @@ module Sidekiq
28
25
  record = Record.create(data: data)
29
26
 
30
27
  # Start first job in the sequence.
31
- @@steps.first.perform_async record.id
28
+ self.class.steps.first.constantize.perform_async record.id
32
29
  end
33
30
  end
34
- # rubocop:enable Style/ClassVars
35
31
  end
36
32
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Sequence
5
- VERSION = '0.1.4'
5
+ VERSION = '0.1.9'
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.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-04-14 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
@@ -43,7 +71,7 @@ metadata:
43
71
  homepage_uri: https://github.com/joelmoss/sidekiq-sequence
44
72
  source_code_uri: https://github.com/joelmoss/sidekiq-sequence
45
73
  changelog_uri: https://github.com/joelmoss/sidekiq-sequence/releases
46
- post_install_message:
74
+ post_install_message:
47
75
  rdoc_options: []
48
76
  require_paths:
49
77
  - lib
@@ -58,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
86
  - !ruby/object:Gem::Version
59
87
  version: '0'
60
88
  requirements: []
61
- rubygems_version: 3.1.2
62
- signing_key:
89
+ rubygems_version: 3.2.3
90
+ signing_key:
63
91
  specification_version: 4
64
92
  summary: Sequential Sidekiq jobs
65
93
  test_files: []
data/bin/console DELETED
@@ -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