beaneater 1.1.0 → 1.1.3

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: 83a6a5bc5d6a0e34828c5b011ca65b3bb99a296ab0d038b348279fd7b5bbf842
4
- data.tar.gz: 30e307f3cb14d2d078cfc2eb23219add703535b2a2c9e8212b60dd54eb808bd9
3
+ metadata.gz: ffe398358517da9e09fd22e17ddd4421e7a0f2b7fa2ae816e8ad0a308466f2d8
4
+ data.tar.gz: 7f9d831b5318de310462d8d4405acc0dbedb82463d5b252dec9b63fbcb39677b
5
5
  SHA512:
6
- metadata.gz: 820d14df0a37f2d3afd63db394a8d971a0e98436331a67b989e4c58335f1d3803f79b233b261c096069c511cba5ff77d7bf0eb887f14a9f61b39251d9ac8ea12
7
- data.tar.gz: ed53e2479c36ce9e2af27f3e63a00c3540e935fcc822414649ae2135daa93d59cc14154f71c70e6d02a9f53a42d11b360fe01808350915a85b91abd8ffc95056
6
+ metadata.gz: 0fd5812759fa6e28a830cecacdd7a22447ce94705b044d9c28062bb868a082ea3679a29b18e3c4f421a6abf90fb3ba28551a2715eb5e8b38782a6e842548dc08
7
+ data.tar.gz: 919952687b5f715aca936c4c40af28a0db741e6c7539dfdcb78c6e5834a855fb91800e5a2e5fc2cb0e201e6422b5522f7c944be787fa0ca7b145f6b3edf83091
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ rvm:
3
3
  - 2.5
4
4
  - 2.6
5
5
  - 2.7
6
+ - 3.0
6
7
  before_install:
7
8
  - curl -L https://github.com/kr/beanstalkd/archive/v1.9.tar.gz | tar xz -C /tmp
8
9
  - cd /tmp/beanstalkd-1.9/
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # CHANGELOG for Beaneater
2
2
 
3
+ ## 1.1.3 (Oct 14 2022)
4
+
5
+ * Fixes issue introduced in 1.1.2 re YML parsing (@pond)
6
+ * Fix job lookup test so it passes again
7
+
8
+ ## 1.1.2 (Oct 10 2022)
9
+
10
+ * Fixes beaneater when used with Ruby 3.1 and YAML 4 (@pond)
11
+
12
+ ## 1.1.1 (April 27th 2021)
13
+
14
+ * Support Ruby 3 keyword arguments (@yahonda)
15
+ * Add CI for Ruby 3 (@yahonda)
16
+
3
17
  ## 1.1.0 (April 25th 2021)
4
18
 
5
19
  * 'clear' behavior was failing unexpectedly, swallow issues during delete as well (@bfolkens)
@@ -150,7 +150,12 @@ class Beaneater
150
150
  if ['OK','FOUND', 'RESERVED'].include?(status)
151
151
  bytes_size = body_values[-1].to_i
152
152
  raw_body = connection.read(bytes_size)
153
- body = status == 'OK' ? YAML.load(raw_body) : config.job_parser.call(raw_body)
153
+ body = if status == 'OK'
154
+ psych_v4_valid_body = raw_body.gsub(/^(.*?): (.*)$/) { "#{$1}: #{$2.gsub(/[\:\-\~]/, '_')}" }
155
+ YAML.load(psych_v4_valid_body)
156
+ else
157
+ config.job_parser.call(raw_body)
158
+ end
154
159
  crlf = connection.read(2) # \r\n
155
160
  raise ExpectedCrlfError.new('EXPECTED_CRLF', cmd) if crlf != "\r\n"
156
161
  end
@@ -37,7 +37,7 @@ class Beaneater
37
37
  #
38
38
  # @see Beaneater::Connection#transmit
39
39
  def transmit(command, options={})
40
- client.connection.transmit(command, options)
40
+ client.connection.transmit(command, **options)
41
41
  end
42
42
 
43
43
  # Peek (or find) job by id from beanstalkd.
@@ -25,7 +25,7 @@ class Beaneater
25
25
  #
26
26
  # @see Beaneater::Connection#transmit
27
27
  def transmit(command, options={})
28
- client.connection.transmit(command, options)
28
+ client.connection.transmit(command, **options)
29
29
  end
30
30
 
31
31
  # Inserts job with specified body onto tube.
@@ -1,4 +1,4 @@
1
1
  class Beaneater
2
2
  # Current version of gem.
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.3"
4
4
  end
data/test/jobs_test.rb CHANGED
@@ -28,8 +28,12 @@ describe Beaneater::Jobs do
28
28
  assert_equal "foo find #{@time}", @jobs.find(@job.id).body
29
29
  end
30
30
 
31
- it "should return nil for invalid id" do
32
- assert_nil @jobs.find(-1)
31
+ it "should return nil for invalid negative id" do
32
+ assert_nil @jobs.find(10000)
33
+ end
34
+
35
+ it "should return nil for invalid negative id" do
36
+ assert_raises(Beaneater::BadFormatError) { @jobs.find(-1) }
33
37
  end
34
38
  end # find
35
39
 
data/test/test_helper.rb CHANGED
@@ -7,7 +7,7 @@ $:.unshift File.expand_path("../../lib")
7
7
  require 'beaneater'
8
8
  require 'timeout'
9
9
  begin
10
- require 'mocha/setup'
10
+ require 'mocha/minitest'
11
11
  rescue LoadError
12
12
  require 'mocha'
13
13
  end
data/test/tube_test.rb CHANGED
@@ -89,9 +89,9 @@ describe Beaneater::Tube do
89
89
 
90
90
  it "should support custom parser" do
91
91
  Beaneater.configure.job_parser = lambda { |b| JSON.parse(b) }
92
- json = '{"message":"hi"}'
92
+ json = '{"message": "hi: there! this: is a long message"}'
93
93
  @tube.put(json)
94
- assert_equal 'hi', @tube.peek(:ready).body['message']
94
+ assert_equal 'hi: there! this: is a long message', @tube.peek(:ready).body['message']
95
95
  end
96
96
 
97
97
  after do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaneater
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Taing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest