fruit_juice 0.5.0 → 1.0.0

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: 00615c32fa376b69617e3eafdcbf6f4f77ea211dbd4ab4c5a5818bbf0a8b0763
4
- data.tar.gz: 3595801442e08409ba444cfd967fc1f1ec76fcb9956b78fb1b1d1a8a3df3fa43
3
+ metadata.gz: 50acb05db88081a34b6fa89b6ba701a6822c8d4ce2bb77c7584ef018c0726196
4
+ data.tar.gz: b19e563af2dc36317e2d790f64e34f173d3d47e6a6bcc9197d0b42cb5798576c
5
5
  SHA512:
6
- metadata.gz: 7bba0dd5a5181faeae8ab44c091045b98f47d23c4bfd04a7f9886f87190a1dee140d88e2abdd520088c6f32b2f912e0cbd0580708d77f290e4a97f3f7aea8347
7
- data.tar.gz: af8eecdac690482f8af029c1982d496b7b6a2294f61cd3b768fef76343ce833e8ab4941a185786da3e73db6c026d78a29c2328c6a4645c370754cace182a0507
6
+ metadata.gz: d76ea233f0bdd7296190c8cd2a6a75a247f5787cbe7496742736cd9a8c4981394f0171d8fbcb6e6230b9e5a526bb37436208ce90296e8a8c35462b14133a47ba
7
+ data.tar.gz: 373659336eaeb7dba73541c94df18a0c3f145d2c68d9f4feccea0a1b2e326926b0c59185e8f3c8ead8e7deb5c2a37626ff6d8ceb33213356d1fa81b40edb7c83
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise "redis-4" do
2
+ gem "redis", ">= 4.0.0", "< 5.0.0"
3
+ end
4
+
5
+ appraise "redis-5" do
6
+ gem "redis", ">= 5.0.0"
7
+ end
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in fruit_juice.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
9
- gem "byebug"
10
- gem "rspec", "~> 3.0"
8
+ group :test do
9
+ gem "rspec", "~> 3.0"
10
+ end
data/Gemfile.lock CHANGED
@@ -1,14 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fruit_juice (0.5.0)
5
- json (>= 2.4.1)
6
- redis (>= 4.0.0)
4
+ fruit_juice (0.6.0)
5
+ json (>= 2.3.0)
6
+ redis (>= 4.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- byebug (11.1.3)
11
+ appraisal (2.5.0)
12
+ bundler
13
+ rake
14
+ thor (>= 0.14.0)
12
15
  connection_pool (2.3.0)
13
16
  diff-lcs (1.5.0)
14
17
  json (2.6.3)
@@ -30,14 +33,16 @@ GEM
30
33
  diff-lcs (>= 1.2.0, < 2.0)
31
34
  rspec-support (~> 3.12.0)
32
35
  rspec-support (3.12.0)
36
+ thor (1.2.1)
33
37
 
34
38
  PLATFORMS
35
39
  arm64-darwin-22
40
+ x86_64-darwin-21
41
+ x86_64-linux
36
42
 
37
43
  DEPENDENCIES
38
- byebug
44
+ appraisal (~> 2.5)
39
45
  fruit_juice!
40
- rake (~> 13.0)
41
46
  rspec (~> 3.0)
42
47
 
43
48
  BUNDLED WITH
data/README.md CHANGED
@@ -5,7 +5,7 @@ FruitJuice is a job enqueuing adapter for the [mosquito background job processor
5
5
 
6
6
  ## Requirements
7
7
 
8
- Ruby 2.7+
8
+ Ruby 2.5.0+
9
9
  Mosquito 1.0.0.rc1+
10
10
  Crystal 1.0.0+
11
11
  Redis 4+
@@ -76,13 +76,12 @@ delayed_job = MyNewRubyJob.new(job_type: "MyNewJob")
76
76
  delayed_job.perform(this_will: "become a job option", "job option": "and be stored", "as": "json to parse in Mosquito")
77
77
  ```
78
78
 
79
-
80
79
  That's it! Triggering jobs from Ruby/Rails is pretty easy, but this makes it a nice pattern that's easy to follow.
81
80
 
82
81
 
83
82
  ## Development
84
83
 
85
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
84
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
86
85
 
87
86
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). (Hint: only Seth can push to ruby gems for now)
88
87
 
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "redis", ">= 4.0.0", "< 5.0.0"
7
+
8
+ group :test do
9
+ gem "rspec", "~> 3.0"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ fruit_juice (0.6.0)
5
+ redis (>= 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ appraisal (2.5.0)
11
+ bundler
12
+ rake
13
+ thor (>= 0.14.0)
14
+ byebug (11.1.3)
15
+ diff-lcs (1.5.0)
16
+ rake (13.0.6)
17
+ redis (4.6.0)
18
+ rspec (3.12.0)
19
+ rspec-core (~> 3.12.0)
20
+ rspec-expectations (~> 3.12.0)
21
+ rspec-mocks (~> 3.12.0)
22
+ rspec-core (3.12.0)
23
+ rspec-support (~> 3.12.0)
24
+ rspec-expectations (3.12.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.12.0)
27
+ rspec-mocks (3.12.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.12.0)
30
+ rspec-support (3.12.0)
31
+ thor (1.2.1)
32
+
33
+ PLATFORMS
34
+ arm64-darwin-22
35
+ x86_64-darwin-21
36
+
37
+ DEPENDENCIES
38
+ appraisal (~> 2.5)
39
+ byebug
40
+ fruit_juice!
41
+ rake (~> 13.0)
42
+ redis (>= 4.0.0, < 5.0.0)
43
+ rspec (~> 3.0)
44
+
45
+ BUNDLED WITH
46
+ 2.3.26
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "redis", ">= 5.0.0"
7
+
8
+ group :test do
9
+ gem "rspec", "~> 3.0"
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ fruit_juice (0.6.0)
5
+ redis (>= 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ appraisal (2.5.0)
11
+ bundler
12
+ rake
13
+ thor (>= 0.14.0)
14
+ byebug (11.1.3)
15
+ connection_pool (2.3.0)
16
+ diff-lcs (1.5.0)
17
+ rake (13.0.6)
18
+ redis (5.0.5)
19
+ redis-client (>= 0.9.0)
20
+ redis-client (0.11.2)
21
+ connection_pool
22
+ rspec (3.12.0)
23
+ rspec-core (~> 3.12.0)
24
+ rspec-expectations (~> 3.12.0)
25
+ rspec-mocks (~> 3.12.0)
26
+ rspec-core (3.12.0)
27
+ rspec-support (~> 3.12.0)
28
+ rspec-expectations (3.12.0)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.12.0)
31
+ rspec-mocks (3.12.1)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.12.0)
34
+ rspec-support (3.12.0)
35
+ thor (1.2.1)
36
+
37
+ PLATFORMS
38
+ arm64-darwin-22
39
+ x86_64-darwin-21
40
+
41
+ DEPENDENCIES
42
+ appraisal (~> 2.5)
43
+ byebug
44
+ fruit_juice!
45
+ rake (~> 13.0)
46
+ redis (>= 5.0.0)
47
+ rspec (~> 3.0)
48
+
49
+ BUNDLED WITH
50
+ 2.3.26
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative "string"
3
3
  require_relative "hash"
4
-
5
4
  require "json"
6
5
 
7
6
  module FruitJuice
@@ -20,13 +19,13 @@ module FruitJuice
20
19
  end
21
20
 
22
21
  def perform(**job_options)
23
- @job_options = JSON.generate(job_options.deep_stringify_keys!)
22
+ @job_options = job_options.deep_stringify_keys!
24
23
  enqueue_job
25
24
  end
26
25
 
27
26
  protected
28
27
 
29
- def enqueue_job(**options)
28
+ def enqueue_job
30
29
  enqueue_time = (Time.now.utc.to_f*1000).to_i
31
30
  job_id = "#{enqueue_time}:#{rand(1000)}"
32
31
  job_run_key = "mosquito:job_run:#{job_id}"
@@ -38,9 +37,12 @@ module FruitJuice
38
37
  "retry_count": 0,
39
38
 
40
39
  # Job specific params
41
- "job_options": @job_options
40
+ "job_options": @job_options.to_json
42
41
  }
43
42
 
43
+ # Required to support both Redis v4.x & v5+ due to behavior changes
44
+ job_run_meta_data.transform_values!(&:to_s) if Redis::VERSION.to_i > 4
45
+
44
46
  @redis_adapter.hset(job_run_key, job_run_meta_data)
45
47
  @redis_adapter.lpush(@waiting_queue_key, job_id)
46
48
  job_run_key
@@ -70,4 +72,4 @@ module FruitJuice
70
72
  end
71
73
  end
72
74
  end
73
- end
75
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FruitJuice
4
- VERSION = "0.5.0"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fruit_juice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Tucker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
14
+ name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.1
19
+ version: 4.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.1
26
+ version: 4.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: redis
28
+ name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: 2.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: 2.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.5'
41
55
  description: This handy adapter will let you enqueue delayed jobs from a Ruby/Rails
42
56
  app and have the job processed by Mosquito in Crystal. The idea behind this came
43
57
  from a Ruby/Rails app needing a better way to process massive background jobs more
@@ -48,15 +62,19 @@ executables: []
48
62
  extensions: []
49
63
  extra_rdoc_files: []
50
64
  files:
51
- - ".byebug_history"
52
65
  - ".rspec"
66
+ - Appraisals
53
67
  - CODE_OF_CONDUCT.md
54
68
  - Gemfile
55
69
  - Gemfile.lock
56
70
  - LICENSE.txt
57
71
  - README.md
58
72
  - Rakefile
59
- - fruit_juice.gemspec
73
+ - gemfiles/.bundle/config
74
+ - gemfiles/redis_4.gemfile
75
+ - gemfiles/redis_4.gemfile.lock
76
+ - gemfiles/redis_5.gemfile
77
+ - gemfiles/redis_5.gemfile.lock
60
78
  - lib/fruit_juice.rb
61
79
  - lib/fruit_juice/delayed_job.rb
62
80
  - lib/fruit_juice/hash.rb
@@ -77,14 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
95
  requirements:
78
96
  - - ">="
79
97
  - !ruby/object:Gem::Version
80
- version: 2.7.0
98
+ version: 2.5.0
81
99
  required_rubygems_version: !ruby/object:Gem::Requirement
82
100
  requirements:
83
101
  - - ">="
84
102
  - !ruby/object:Gem::Version
85
103
  version: '0'
86
104
  requirements: []
87
- rubygems_version: 3.3.7
105
+ rubygems_version: 3.4.10
88
106
  signing_key:
89
107
  specification_version: 4
90
108
  summary: Ruby job adapter to enqueue background jobs in Mosquito for Crystal. Uniting
data/.byebug_history DELETED
@@ -1,55 +0,0 @@
1
- q!
2
- job_type.class.to_s
3
- job_type
4
- c
5
- delayed_job.job_type
6
- c
7
- job_type.class
8
- c
9
- delayed_job.public_methods
10
- delayed_job.methods
11
- delayed_job.job_type
12
- c
13
- delayed_job.instance_variables
14
- delayed_job.job_type
15
- c
16
- job_type.camelize
17
- job_type.class == String
18
- job_type
19
- job_type.camelize
20
- job_type.class
21
- c
22
- config_options[:job_type].class
23
- config_options[:job_type].camelize
24
- config_options[:job_type]
25
- "test".camelize
26
- @job_type
27
- c
28
- jobType&.camelize
29
- jobType.camelize
30
- jobType.methods.grep /camel/
31
- jobType.class
32
- jobType = config_options[:job_type]
33
- config_options[:job_type].camelize
34
- config_options[:job_type].class
35
- set_job_type(config_options[:job_type])
36
- config_options
37
- @job_type
38
- c
39
- c!
40
- c
41
- job_type
42
- config_options
43
- config_options[:job_type]
44
- @job_type
45
- c
46
- FruitJuice::DelayedJob.new
47
- c
48
- ENV["REDIS_URL"]
49
- redis_url
50
- q
51
- ENV["REDIS_URL"]
52
- ENV.delete("REDIS_URL")
53
- ENV["REDIS_URL"].delete
54
- ENV["REDIS_URL"]
55
- redis_adapter.class.to_s.downcase
data/fruit_juice.gemspec DELETED
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/fruit_juice/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "fruit_juice"
7
- spec.version = FruitJuice::VERSION
8
- spec.authors = ["Seth Tucker"]
9
- spec.email = ["crimsonknightstudios@gmail.com"]
10
-
11
- spec.summary = "Ruby job adapter to enqueue background jobs in Mosquito for Crystal. Uniting Ruby/Rails & Crystal!"
12
- spec.description = "This handy adapter will let you enqueue delayed jobs from a Ruby/Rails app and have the job processed by Mosquito in Crystal. The idea behind this came from a Ruby/Rails app needing a better way to process massive background jobs more effeciently, and a desire to stay curious and explore."
13
- spec.homepage = "https://github.com/crimson-knight/fruit_juice"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.7.0"
16
-
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = "https://github.com/crimson-knight/fruit_juice"
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(__dir__) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
- end
26
- end
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_dependency "json", ">= 2.4.1"
32
- spec.add_dependency "redis", ">= 4.0.0"
33
- end