procrastinator 1.1.0 → 2.0.0

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: 355845de0042676644aa4fd14ba5c37bc173b1f0cac9c73889dbb36aa8e5cd9c
4
- data.tar.gz: f4faa2e3644557027c8fc08f88c973deb19cf16e43fb3312106d8d25a3c61054
3
+ metadata.gz: 86ce767f3807bc5184e0d658392cbf45b03ab68465a5161c8ffd9434157bd007
4
+ data.tar.gz: 65b3b517a6bdd6150b34ee0e8419834f581abbe1ced3d1ae5aef50613a452c94
5
5
  SHA512:
6
- metadata.gz: 3f59116b21f6218d3ef3059e5f5532b1ef23a95e7a5f0b82a1d21a041ff84e64795e2fd7181bd277cba19e6c8fd01fa04146103ec2de9703169e9db7072a817f
7
- data.tar.gz: 235b273d6f07e21f492e82083ea89b0f67eb4275233dddbb04d52e25a5a2f3b6a0674e5d0b8dda9b5c43359ea257b081c4d7bf1b7561b4c1a7242f24660b932c
6
+ metadata.gz: e00357dccd1ac7bdbc2ce72fdaada932f3155b155c88c4af8ccd7674f1db196cd186b0f96a3c1b99f2751cf30652f77fabcfab733e091539e3748b90fe04c0ac
7
+ data.tar.gz: ee3425d98d5eca4d321e36b37428e50300cad78db202b34ef4150058c3a2a42fd0452f76015e51f3d5830c8e289f823e3d1e94aa086edcd694fb5d412558bdee
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
- inherit_from: ../.rubocop.yml
1
+ inherit_from: ~/.config/rubocop/config.yml
2
2
 
3
3
  AllCops:
4
4
  Exclude:
5
5
  - 'bin/*'
6
6
 
7
- TargetRubyVersion: 2.4
7
+ TargetRubyVersion: 3.0
8
8
 
9
9
  Layout/LineLength:
10
10
  Exclude:
@@ -23,4 +23,3 @@ Metrics/BlockLength:
23
23
  Metrics/ModuleLength:
24
24
  Exclude:
25
25
  - 'spec/**/*.rb'
26
-
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.4.2
1
+ ruby-3.1.4
data/Gemfile CHANGED
@@ -2,5 +2,17 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
+ group :development do
6
+ gem 'bundler', '~> 2.3'
7
+ gem 'fakefs', '~> 1.8'
8
+ gem 'rake', '~> 13.0'
9
+ gem 'rspec', '~> 3.12'
10
+ gem 'rubocop', '~> 1.52'
11
+ gem 'rubocop-performance', '~> 1.18'
12
+ gem 'simplecov', '~> 0.22.0'
13
+ gem 'timecop', '~> 0.9'
14
+ gem 'yard', '~> 0.9'
15
+ end
16
+
5
17
  # Specify your gem's dependencies in procrastinator.gemspec
6
18
  gemspec
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Release Notes
2
2
 
3
+ ## 2.0.0 (2023-06-17)
4
+
5
+ ### Major Changes
6
+
7
+ * Updated minimum ruby to 3.0
8
+
9
+ ### Minor Changes
10
+
11
+ * Updated development dependencies
12
+
13
+ ### Bugfixes
14
+
15
+ * none
16
+
17
+ ## 1.2.0 (2023-06-17)
18
+
19
+ ### Major Changes
20
+
21
+ * none
22
+
23
+ ### Minor Changes
24
+
25
+ * Updated minimum ruby to 2.7
26
+
27
+ ### Bugfixes
28
+
29
+ * When logging is disabled, it points to `File::NULL` instead of a dead-end StringIO
30
+
3
31
  ## 1.1.0 (2022-10-16)
4
32
 
5
33
  ### Major Changes
@@ -94,7 +94,7 @@ module Procrastinator
94
94
  raise AmbiguousTaskFilterError, "too many (#{ tasks.size }) tasks match #{ identifier }. Found: #{ tasks }"
95
95
  end
96
96
 
97
- TaskMetaData.new(tasks.first.merge(queue: self))
97
+ TaskMetaData.new(**tasks.first.merge(queue: self))
98
98
  end
99
99
 
100
100
  # Creates a task on the queue, saved using the Task Store strategy.
@@ -13,6 +13,8 @@ module Procrastinator
13
13
  # expected methods for all persistence strategies
14
14
  PERSISTER_METHODS = [:read, :update, :delete].freeze
15
15
 
16
+ NULL_FILE = File.open(File::NULL, File::WRONLY)
17
+
16
18
  def initialize(queue:, config:)
17
19
  raise ArgumentError, ':queue cannot be nil' if queue.nil?
18
20
  raise ArgumentError, ':config cannot be nil' if config.nil?
@@ -26,13 +28,13 @@ module Procrastinator
26
28
  end
27
29
 
28
30
  @scheduler = Scheduler.new(config)
29
- @logger = Logger.new(StringIO.new)
31
+ @logger = Logger.new(File::NULL)
30
32
  end
31
33
 
32
34
  # Works on jobs forever
33
35
  def work!
34
36
  @logger = open_log!("#{ name }-queue-worker", @config)
35
- @logger.info("Started worker thread to consume queue: #{ name }")
37
+ @logger.info "Started worker thread to consume queue: #{ name }"
36
38
 
37
39
  loop do
38
40
  sleep(@queue.update_period)
@@ -72,12 +74,14 @@ module Procrastinator
72
74
 
73
75
  # Starts a log file and returns the created Logger
74
76
  def open_log!(name, config)
75
- return @logger unless config.log_level
76
-
77
- log_path = config.log_dir / "#{ name }.log"
77
+ if config.log_level
78
+ log_path = config.log_dir / "#{ name }.log"
78
79
 
79
- config.log_dir.mkpath
80
- FileUtils.touch(log_path)
80
+ config.log_dir.mkpath
81
+ FileUtils.touch(log_path)
82
+ else
83
+ log_path = NULL_FILE
84
+ end
81
85
 
82
86
  Logger.new(log_path.to_path,
83
87
  config.log_shift_age, config.log_shift_size,
@@ -90,6 +94,6 @@ module Procrastinator
90
94
  # Raised when a Task Storage strategy is missing a required part of the API.
91
95
  #
92
96
  # @see TaskStore
93
- class MalformedTaskPersisterError < StandardError
97
+ class MalformedTaskPersisterError < RuntimeError
94
98
  end
95
99
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Procrastinator
4
4
  # Version number of this release
5
- VERSION = '1.1.0'
5
+ VERSION = '2.0.0'
6
6
  end
@@ -23,15 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.required_ruby_version = '>= 2.4'
27
-
28
- spec.add_development_dependency 'bundler', '~> 2.3'
29
- spec.add_development_dependency 'fakefs', '~> 1.8'
30
- spec.add_development_dependency 'rake', '~> 13.0'
31
- spec.add_development_dependency 'rspec', '~> 3.9'
32
- spec.add_development_dependency 'rubocop', '~> 1.12'
33
- spec.add_development_dependency 'rubocop-performance', '~> 1.10'
34
- spec.add_development_dependency 'simplecov', '~> 0.18.0'
35
- spec.add_development_dependency 'timecop', '~> 0.9'
36
- spec.add_development_dependency 'yard', '~> 0.9'
26
+ spec.required_ruby_version = '>= 3.0'
37
27
  end
metadata CHANGED
@@ -1,141 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procrastinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Miller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-16 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.3'
27
- - !ruby/object:Gem::Dependency
28
- name: fakefs
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.8'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.8'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '13.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '13.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.9'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.9'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.12'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.12'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-performance
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.10'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.10'
97
- - !ruby/object:Gem::Dependency
98
- name: simplecov
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.18.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.18.0
111
- - !ruby/object:Gem::Dependency
112
- name: timecop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.9'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0.9'
125
- - !ruby/object:Gem::Dependency
126
- name: yard
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.9'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '0.9'
11
+ date: 2023-06-17 00:00:00.000000000 Z
12
+ dependencies: []
139
13
  description: A flexible pure Ruby job queue. Tasks are reschedulable after failures.
140
14
  email:
141
15
  - robin@tenjin.ca
@@ -184,14 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
58
  requirements:
185
59
  - - ">="
186
60
  - !ruby/object:Gem::Version
187
- version: '2.4'
61
+ version: '3.0'
188
62
  required_rubygems_version: !ruby/object:Gem::Requirement
189
63
  requirements:
190
64
  - - ">="
191
65
  - !ruby/object:Gem::Version
192
66
  version: '0'
193
67
  requirements: []
194
- rubygems_version: 3.1.2
68
+ rubygems_version: 3.3.26
195
69
  signing_key:
196
70
  specification_version: 4
197
71
  summary: For apps to put off work until later