beaneater 1.1.1 → 1.1.4
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 +4 -4
- data/.github/workflows/ruby.yml +42 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/beaneater.gemspec +1 -0
- data/examples/demo.rb +2 -0
- data/lib/beaneater/configuration.rb +2 -0
- data/lib/beaneater/connection.rb +9 -2
- data/lib/beaneater/errors.rb +2 -0
- data/lib/beaneater/job/collection.rb +2 -0
- data/lib/beaneater/job/record.rb +2 -0
- data/lib/beaneater/job.rb +2 -0
- data/lib/beaneater/stats/fast_struct.rb +2 -0
- data/lib/beaneater/stats/stat_struct.rb +2 -0
- data/lib/beaneater/stats.rb +2 -0
- data/lib/beaneater/tube/collection.rb +2 -0
- data/lib/beaneater/tube/record.rb +2 -0
- data/lib/beaneater/tube.rb +2 -0
- data/lib/beaneater/version.rb +3 -1
- data/lib/beaneater.rb +2 -0
- data/test/beaneater_test.rb +2 -0
- data/test/connection_test.rb +5 -0
- data/test/errors_test.rb +2 -0
- data/test/job_test.rb +3 -0
- data/test/jobs_test.rb +8 -2
- data/test/prompt_regexp_test.rb +2 -0
- data/test/stat_struct_test.rb +2 -0
- data/test/stats_test.rb +2 -0
- data/test/test_helper.rb +3 -1
- data/test/tube_test.rb +4 -2
- data/test/tubes_test.rb +2 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27dbb64059340085f2e89899e550b2329db2043e96491ae2561b2dd4f2bb34ea
|
|
4
|
+
data.tar.gz: 3bf0277effe249cbbcd95e6643c6d5f7c8bd7a3efeee3a3e86f2cd6c53b59402
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65c0e86ba162862f43ec6bf3d4c0f45b1e30821f7bd7a891d8833be1312d256d2ec6999406bee08c5bf0e151ce2a599a7274c9179f3b64563d6168fc02f39888
|
|
7
|
+
data.tar.gz: ab0f650fade61572fb3b1a8c57c3e0c15634e826f1a5cd2635ef07e4270ce472f8b53c02488028b14c25a294498b3b494854d3f52e798109a61ef7cb957bc674
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Build Status
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ "master" ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ "master" ]
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- name: Download & Extract beanstalkd
|
|
30
|
+
run: curl -L https://github.com/beanstalkd/beanstalkd/archive/refs/tags/v1.13.tar.gz | tar xz
|
|
31
|
+
- name: Make beanstalkd
|
|
32
|
+
run: make
|
|
33
|
+
working-directory: beanstalkd-1.13
|
|
34
|
+
- name: Set up Ruby
|
|
35
|
+
uses: ruby/setup-ruby@v1
|
|
36
|
+
with:
|
|
37
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
38
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
39
|
+
- name: Daemonize beanstalkd
|
|
40
|
+
run: ./beanstalkd-1.13/beanstalkd &
|
|
41
|
+
- name: Run tests
|
|
42
|
+
run: bundle exec rake test:full
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# CHANGELOG for Beaneater
|
|
2
2
|
|
|
3
|
+
## 1.1.4 (March 6 2026)
|
|
4
|
+
|
|
5
|
+
* Add frozen string literal comments for Ruby 3.4 compatibility (@nearapogee)
|
|
6
|
+
* Update tests for Ruby 3.4.x (@nearapogee)
|
|
7
|
+
* Add GitHub Actions CI workflow (@Ifiht)
|
|
8
|
+
* Update README.md (@Ifiht)
|
|
9
|
+
|
|
10
|
+
## 1.1.3 (Oct 14 2022)
|
|
11
|
+
|
|
12
|
+
* Fixes issue introduced in 1.1.2 re YML parsing (@pond)
|
|
13
|
+
* Fix job lookup test so it passes again
|
|
14
|
+
|
|
15
|
+
## 1.1.2 (Oct 10 2022)
|
|
16
|
+
|
|
17
|
+
* Fixes beaneater when used with Ruby 3.1 and YAML 4 (@pond)
|
|
18
|
+
|
|
3
19
|
## 1.1.1 (April 27th 2021)
|
|
4
20
|
|
|
5
21
|
* Support Ruby 3 keyword arguments (@yahonda)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Beaneater
|
|
2
|
-
|
|
2
|
+

|
|
3
3
|
[](https://coveralls.io/r/beanstalkd/beaneater)
|
|
4
4
|
|
|
5
5
|
Beaneater is the best way to interact with beanstalkd from within Ruby.
|
data/Rakefile
CHANGED
data/beaneater.gemspec
CHANGED
data/examples/demo.rb
CHANGED
data/lib/beaneater/connection.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'yaml'
|
|
2
4
|
require 'socket'
|
|
3
5
|
|
|
@@ -74,7 +76,7 @@ class Beaneater
|
|
|
74
76
|
@mutex.synchronize do
|
|
75
77
|
_raise_not_connected! unless connection
|
|
76
78
|
|
|
77
|
-
command = command.force_encoding('ASCII-8BIT') if command.respond_to?(:force_encoding)
|
|
79
|
+
command = command.dup.force_encoding('ASCII-8BIT') if command.respond_to?(:force_encoding)
|
|
78
80
|
connection.write(command.to_s + "\r\n")
|
|
79
81
|
res = connection.readline
|
|
80
82
|
parse_response(command, res)
|
|
@@ -150,7 +152,12 @@ class Beaneater
|
|
|
150
152
|
if ['OK','FOUND', 'RESERVED'].include?(status)
|
|
151
153
|
bytes_size = body_values[-1].to_i
|
|
152
154
|
raw_body = connection.read(bytes_size)
|
|
153
|
-
body = status == 'OK'
|
|
155
|
+
body = if status == 'OK'
|
|
156
|
+
psych_v4_valid_body = raw_body.gsub(/^(.*?): (.*)$/) { "#{$1}: #{$2.gsub(/[\:\-\~]/, '_')}" }
|
|
157
|
+
YAML.load(psych_v4_valid_body)
|
|
158
|
+
else
|
|
159
|
+
config.job_parser.call(raw_body)
|
|
160
|
+
end
|
|
154
161
|
crlf = connection.read(2) # \r\n
|
|
155
162
|
raise ExpectedCrlfError.new('EXPECTED_CRLF', cmd) if crlf != "\r\n"
|
|
156
163
|
end
|
data/lib/beaneater/errors.rb
CHANGED
data/lib/beaneater/job/record.rb
CHANGED
data/lib/beaneater/job.rb
CHANGED
data/lib/beaneater/stats.rb
CHANGED
data/lib/beaneater/tube.rb
CHANGED
data/lib/beaneater/version.rb
CHANGED
data/lib/beaneater.rb
CHANGED
data/test/beaneater_test.rb
CHANGED
data/test/connection_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# test/connection_test.rb
|
|
2
4
|
|
|
3
5
|
require File.expand_path('../test_helper', __FILE__)
|
|
@@ -101,6 +103,7 @@ describe Beaneater::Connection do
|
|
|
101
103
|
client = Beaneater.new('127.0.0.1:11300')
|
|
102
104
|
client.tubes.watch! "another"
|
|
103
105
|
|
|
106
|
+
$called = false
|
|
104
107
|
TCPSocket.prepend Module.new {
|
|
105
108
|
def readline
|
|
106
109
|
if !$called
|
|
@@ -113,6 +116,8 @@ describe Beaneater::Connection do
|
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
assert_equal %w[another], client.tubes.watched.map(&:name)
|
|
119
|
+
ensure
|
|
120
|
+
$called = nil
|
|
116
121
|
end
|
|
117
122
|
end # transmit
|
|
118
123
|
|
data/test/errors_test.rb
CHANGED
data/test/job_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# test/job_test.rb
|
|
2
4
|
|
|
3
5
|
require File.expand_path('../test_helper', __FILE__)
|
|
@@ -10,6 +12,7 @@ describe Beaneater::Job do
|
|
|
10
12
|
|
|
11
13
|
describe "for #bury" do
|
|
12
14
|
before do
|
|
15
|
+
@tube.clear
|
|
13
16
|
@time = Time.now.to_i
|
|
14
17
|
@tube.put "foo bury #{@time}", :pri => 5
|
|
15
18
|
end
|
data/test/jobs_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# test/jobs_test.rb
|
|
2
4
|
|
|
3
5
|
require File.expand_path('../test_helper', __FILE__)
|
|
@@ -28,8 +30,12 @@ describe Beaneater::Jobs do
|
|
|
28
30
|
assert_equal "foo find #{@time}", @jobs.find(@job.id).body
|
|
29
31
|
end
|
|
30
32
|
|
|
31
|
-
it "should return nil for invalid id" do
|
|
32
|
-
assert_nil @jobs.find(
|
|
33
|
+
it "should return nil for invalid negative id" do
|
|
34
|
+
assert_nil @jobs.find(10000)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should return nil for invalid negative id" do
|
|
38
|
+
assert_raises(Beaneater::BadFormatError) { @jobs.find(-1) }
|
|
33
39
|
end
|
|
34
40
|
end # find
|
|
35
41
|
|
data/test/prompt_regexp_test.rb
CHANGED
data/test/stat_struct_test.rb
CHANGED
data/test/stats_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
ENV["TEST"] = 'true'
|
|
2
4
|
require 'rubygems'
|
|
3
5
|
require 'coveralls'
|
|
@@ -7,7 +9,7 @@ $:.unshift File.expand_path("../../lib")
|
|
|
7
9
|
require 'beaneater'
|
|
8
10
|
require 'timeout'
|
|
9
11
|
begin
|
|
10
|
-
require 'mocha/
|
|
12
|
+
require 'mocha/minitest'
|
|
11
13
|
rescue LoadError
|
|
12
14
|
require 'mocha'
|
|
13
15
|
end
|
data/test/tube_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# test/tube_test.rb
|
|
2
4
|
|
|
3
5
|
require File.expand_path('../test_helper', __FILE__)
|
|
@@ -89,9 +91,9 @@ describe Beaneater::Tube do
|
|
|
89
91
|
|
|
90
92
|
it "should support custom parser" do
|
|
91
93
|
Beaneater.configure.job_parser = lambda { |b| JSON.parse(b) }
|
|
92
|
-
json = '{"message":"hi"}'
|
|
94
|
+
json = '{"message": "hi: there! this: is a long message"}'
|
|
93
95
|
@tube.put(json)
|
|
94
|
-
assert_equal 'hi', @tube.peek(:ready).body['message']
|
|
96
|
+
assert_equal 'hi: there! this: is a long message', @tube.peek(:ready).body['message']
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
after do
|
data/test/tubes_test.rb
CHANGED
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.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nico Taing
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -87,6 +87,7 @@ executables: []
|
|
|
87
87
|
extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
|
89
89
|
files:
|
|
90
|
+
- ".github/workflows/ruby.yml"
|
|
90
91
|
- ".gitignore"
|
|
91
92
|
- ".travis.yml"
|
|
92
93
|
- ".yardopts"
|
|
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
143
|
- !ruby/object:Gem::Version
|
|
143
144
|
version: '0'
|
|
144
145
|
requirements: []
|
|
145
|
-
rubygems_version: 3.
|
|
146
|
+
rubygems_version: 3.5.23
|
|
146
147
|
signing_key:
|
|
147
148
|
specification_version: 4
|
|
148
149
|
summary: Simple beanstalkd client for ruby.
|