fleiss 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f5d2237b3a3bb01c8998c273a9fbb4f65cbf75b737df03187db2315c1efa93d
4
- data.tar.gz: c80f8f0423dea4b516e824ccb669ec2e34abb6c2365adbe5cea937101526c429
3
+ metadata.gz: 6f4d85ef0b2ad7bfb482ec68a3ee93ac2d9a6298cb32583b1bec22dd0c59f170
4
+ data.tar.gz: 126d02197dc2c427dcfab96e79aee80d27b3ca709a0443a07131516031cd8d2c
5
5
  SHA512:
6
- metadata.gz: e497a57b2aec4333ce4cde801a7bcf631546158c1b4c1d2b2a663ca997066438f01bb14b5103637cbb661c168e403c4b21014dbe92ee2fb927806a377b788f21
7
- data.tar.gz: 7d18e086ebe3ca8f6d8c0c025ca302abdfa487487548c38664d18904cd5c3a8d7e1997132054af334c5cbb1e8863b01fcdf176546f7d9d300e30443a2958bbe0
6
+ metadata.gz: b4104bc953340edc36e2ef2c54ca55428cbc4334c1ff1b833b5dbe242c649bd55eef6b4fca58eb626a6cba3da5e8e9d71d8035e46fb0f3035afad8176b5cbb3f
7
+ data.tar.gz: 8ccafa26982aa0b09f8bd1b5a3e664d6c66610e4cffa36cf3bfa0b0327b2d315529a5d7231d1a683a50b2a20b9a44d74b2b0f504c4d0d0af3d904a09589cf980
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .rubocop-*
2
2
  pkg/
3
+ spec/tmp
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_from:
2
2
  - https://gitlab.com/bsm/misc/raw/master/rubocop/default.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: "2.4"
5
+ TargetRubyVersion: "2.5"
6
6
 
7
7
  Security/Open:
8
8
  Exclude:
data/.travis.yml CHANGED
@@ -2,7 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 2.6
4
4
  - 2.5
5
- - 2.4
6
5
  before_install:
7
6
  - gem install bundler
8
7
  - mysql -e 'CREATE DATABASE fleiss_test;'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fleiss (0.3.0)
4
+ fleiss (0.3.1)
5
5
  activejob (>= 5.0)
6
6
  activerecord (>= 5.0)
7
7
  concurrent-ruby
@@ -9,63 +9,65 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activejob (5.2.3)
13
- activesupport (= 5.2.3)
12
+ activejob (6.0.2.1)
13
+ activesupport (= 6.0.2.1)
14
14
  globalid (>= 0.3.6)
15
- activemodel (5.2.3)
16
- activesupport (= 5.2.3)
17
- activerecord (5.2.3)
18
- activemodel (= 5.2.3)
19
- activesupport (= 5.2.3)
20
- arel (>= 9.0)
21
- activesupport (5.2.3)
15
+ activemodel (6.0.2.1)
16
+ activesupport (= 6.0.2.1)
17
+ activerecord (6.0.2.1)
18
+ activemodel (= 6.0.2.1)
19
+ activesupport (= 6.0.2.1)
20
+ activesupport (6.0.2.1)
22
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
22
  i18n (>= 0.7, < 2)
24
23
  minitest (~> 5.1)
25
24
  tzinfo (~> 1.1)
26
- arel (9.0.0)
25
+ zeitwerk (~> 2.2)
27
26
  ast (2.4.0)
28
- concurrent-ruby (1.1.5)
27
+ concurrent-ruby (1.1.6)
29
28
  diff-lcs (1.3)
30
29
  globalid (0.4.2)
31
30
  activesupport (>= 4.2.0)
32
- i18n (1.6.0)
31
+ i18n (1.8.2)
33
32
  concurrent-ruby (~> 1.0)
34
- jaro_winkler (1.5.2)
35
- minitest (5.11.3)
36
- mysql2 (0.5.2)
37
- parallel (1.17.0)
38
- parser (2.6.3.0)
33
+ jaro_winkler (1.5.4)
34
+ minitest (5.14.0)
35
+ mysql2 (0.5.3)
36
+ parallel (1.19.1)
37
+ parser (2.7.0.3)
39
38
  ast (~> 2.4.0)
40
- pg (1.1.4)
39
+ pg (1.2.2)
41
40
  rainbow (3.0.0)
42
- rake (12.3.2)
43
- rspec (3.8.0)
44
- rspec-core (~> 3.8.0)
45
- rspec-expectations (~> 3.8.0)
46
- rspec-mocks (~> 3.8.0)
47
- rspec-core (3.8.0)
48
- rspec-support (~> 3.8.0)
49
- rspec-expectations (3.8.3)
41
+ rake (13.0.1)
42
+ rexml (3.2.4)
43
+ rspec (3.9.0)
44
+ rspec-core (~> 3.9.0)
45
+ rspec-expectations (~> 3.9.0)
46
+ rspec-mocks (~> 3.9.0)
47
+ rspec-core (3.9.1)
48
+ rspec-support (~> 3.9.1)
49
+ rspec-expectations (3.9.0)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.8.0)
52
- rspec-mocks (3.8.0)
51
+ rspec-support (~> 3.9.0)
52
+ rspec-mocks (3.9.1)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-support (3.8.0)
56
- rubocop (0.71.0)
54
+ rspec-support (~> 3.9.0)
55
+ rspec-support (3.9.2)
56
+ rubocop (0.80.1)
57
57
  jaro_winkler (~> 1.5.1)
58
58
  parallel (~> 1.10)
59
- parser (>= 2.6)
59
+ parser (>= 2.7.0.1)
60
60
  rainbow (>= 2.2.2, < 4.0)
61
+ rexml
61
62
  ruby-progressbar (~> 1.7)
62
63
  unicode-display_width (>= 1.4.0, < 1.7)
63
64
  ruby-progressbar (1.10.1)
64
- sqlite3 (1.3.13)
65
+ sqlite3 (1.4.2)
65
66
  thread_safe (0.3.6)
66
- tzinfo (1.2.5)
67
+ tzinfo (1.2.6)
67
68
  thread_safe (~> 0.1)
68
- unicode-display_width (1.6.0)
69
+ unicode-display_width (1.6.1)
70
+ zeitwerk (2.2.2)
69
71
 
70
72
  PLATFORMS
71
73
  ruby
@@ -78,7 +80,7 @@ DEPENDENCIES
78
80
  rake
79
81
  rspec
80
82
  rubocop
81
- sqlite3 (~> 1.3.6)
83
+ sqlite3
82
84
 
83
85
  BUNDLED WITH
84
- 2.0.1
86
+ 2.1.4
data/fleiss.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'fleiss'
3
- s.version = '0.3.0'
3
+ s.version = '0.3.1'
4
4
  s.authors = ['Black Square Media Ltd']
5
5
  s.email = ['info@blacksquaremedia.com']
6
6
  s.summary = %(Minimialist background jobs backed by ActiveJob and ActiveRecord.)
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
13
13
  s.test_files = `git ls-files -z -- spec/*`.split("\x0")
14
14
  s.require_paths = ['lib']
15
- s.required_ruby_version = '>= 2.4'
15
+ s.required_ruby_version = '>= 2.5'
16
16
 
17
17
  s.add_dependency 'activejob', '>= 5.0'
18
18
  s.add_dependency 'activerecord', '>= 5.0'
@@ -24,5 +24,5 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'rake'
25
25
  s.add_development_dependency 'rspec'
26
26
  s.add_development_dependency 'rubocop'
27
- s.add_development_dependency 'sqlite3', '~> 1.3.6'
27
+ s.add_development_dependency 'sqlite3'
28
28
  end
@@ -8,10 +8,10 @@ module Fleiss
8
8
  scope :in_queue, ->(qs) { where(queue_name: Array.wrap(qs)) }
9
9
  scope :finished, -> { where.not(finished_at: nil) }
10
10
  scope :not_finished, -> { where(finished_at: nil) }
11
- scope :not_expired, ->(now=Time.zone.now) { where(arel_table[:expires_at].eq(nil).or(arel_table[:expires_at].gt(now))) }
11
+ scope :not_expired, ->(now = Time.zone.now) { where(arel_table[:expires_at].eq(nil).or(arel_table[:expires_at].gt(now))) }
12
12
  scope :started, -> { where(arel_table[:started_at].not_eq(nil)) }
13
13
  scope :not_started, -> { where(arel_table[:started_at].eq(nil)) }
14
- scope :scheduled, ->(now=Time.zone.now) { where(arel_table[:scheduled_at].gt(now)) }
14
+ scope :scheduled, ->(now = Time.zone.now) { where(arel_table[:scheduled_at].gt(now)) }
15
15
  end
16
16
 
17
17
  module ClassMethods
@@ -20,7 +20,7 @@ module Fleiss
20
20
  end
21
21
 
22
22
  # @return [ActiveRecord::Relation] pending scope
23
- def pending(now=Time.zone.now)
23
+ def pending(now = Time.zone.now)
24
24
  not_finished
25
25
  .not_expired(now)
26
26
  .not_started
data/lib/fleiss/cli.rb CHANGED
@@ -22,7 +22,7 @@ module Fleiss
22
22
  @opts = DEFAULT_OPTIONS.dup
23
23
  end
24
24
 
25
- def parse!(argv=ARGV)
25
+ def parse!(argv = ARGV)
26
26
  parser.parse!(argv)
27
27
 
28
28
  # Check config file
@@ -15,7 +15,7 @@ class Fleiss::Executor < Concurrent::SimpleExecutorService
15
15
 
16
16
  private
17
17
 
18
- def ns_initialize(opts={})
18
+ def ns_initialize(opts = {})
19
19
  super()
20
20
  @max_size = opts.fetch(:max_size, 1).to_i
21
21
  end
data/spec/spec_helper.rb CHANGED
@@ -5,15 +5,19 @@ require 'fleiss'
5
5
  require 'fleiss/backend/active_record/migration'
6
6
  require 'active_job'
7
7
  require 'active_job/queue_adapters/fleiss_adapter'
8
- require 'tempfile'
8
+ require 'fileutils'
9
9
 
10
10
  ActiveJob::Base.queue_adapter = :fleiss
11
11
  ActiveJob::Base.logger = Logger.new(nil)
12
12
 
13
13
  Time.zone_default = Time.find_zone!('UTC')
14
14
 
15
- database_url = ENV['DATABASE_URL'] || "sqlite3://#{Tempfile.new(['fleiss-test', '.sqlite3']).path}"
16
- ActiveRecord::Base.configurations['test'] = { 'url' => database_url, 'pool' => 20 }
15
+ tmpdir = File.expand_path('./tmp', __dir__)
16
+ FileUtils.rm_rf tmpdir
17
+ FileUtils.mkdir_p tmpdir
18
+
19
+ database_url = ENV['DATABASE_URL'] || "sqlite3://#{tmpdir}/fleiss-test.sqlite3"
20
+ ActiveRecord::Base.configurations = { 'test' => { 'url' => database_url, 'pool' => 20 } }
17
21
 
18
22
  ActiveRecord::Base.establish_connection :test
19
23
  ActiveRecord::Base.connection.drop_table('fleiss_jobs', if_exists: true)
@@ -32,7 +36,7 @@ class TestJob < ActiveJob::Base
32
36
  72.hours
33
37
  end
34
38
 
35
- def perform(msg=nil)
39
+ def perform(msg = nil)
36
40
  raise 'Failing' if msg == 'raise'
37
41
 
38
42
  self.class.performed.push(msg)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fleiss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Black Square Media Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -140,16 +140,16 @@ dependencies:
140
140
  name: sqlite3
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 1.3.6
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 1.3.6
152
+ version: '0'
153
153
  description: Run background jobs with your favourite stack.
154
154
  email:
155
155
  - info@blacksquaremedia.com
@@ -195,14 +195,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
195
  requirements:
196
196
  - - ">="
197
197
  - !ruby/object:Gem::Version
198
- version: '2.4'
198
+ version: '2.5'
199
199
  required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  requirements:
201
201
  - - ">="
202
202
  - !ruby/object:Gem::Version
203
203
  version: '0'
204
204
  requirements: []
205
- rubygems_version: 3.0.3
205
+ rubygems_version: 3.0.6
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Minimialist background jobs backed by ActiveJob and ActiveRecord.