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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60e34aa7bfb6dc0a66ce540b609fa2ed112af52a7defcb3d7148efdbf9a8d213
4
- data.tar.gz: 36c9c9cf9a1d2330243f4f8dbd664318bda4b702ecc1c160e9a288255b211764
3
+ metadata.gz: 27dbb64059340085f2e89899e550b2329db2043e96491ae2561b2dd4f2bb34ea
4
+ data.tar.gz: 3bf0277effe249cbbcd95e6643c6d5f7c8bd7a3efeee3a3e86f2cd6c53b59402
5
5
  SHA512:
6
- metadata.gz: e447f52b2790b98867e613009d7a31b3cc2af0c116656fe209514000f0a023d662a850328a3242609590f1a2fdfd9f006936f24aaf9b04d86d44f2a7b40a2dd4
7
- data.tar.gz: 90eca2d3c5db4c0c96a0bfccc774d894c2d942f9ea52979f15a0a5f6b0bb39990299896a994e56f7c60537e015fc152b7fa030293c980498b545e8f5c52cb411
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in beaneater.gemspec
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Beaneater
2
- [![Build Status](https://secure.travis-ci.org/beanstalkd/beaneater.png)](http://travis-ci.org/beanstalkd/beaneater)
2
+ ![Build Status](https://github.com/beanstalkd/beaneater/actions/workflows/ruby.yml/badge.svg)
3
3
  [![Coverage Status](https://coveralls.io/repos/beanstalkd/beaneater/badge.png?branch=master)](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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require 'rake/testtask'
3
5
  require 'yard'
data/beaneater.gemspec CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # -*- encoding: utf-8 -*-
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
data/examples/demo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'term/ansicolor'
2
4
  class String; include Term::ANSIColor; end
3
5
  def step(msg); "\n[STEP] #{msg}...".yellow; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  class Configuration
3
5
  attr_accessor :default_put_delay # default delay value to put a job
@@ -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' ? YAML.load(raw_body) : config.job_parser.call(raw_body)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Raises when a beanstalkd instance is no longer accessible.
3
5
  class NotConnected < RuntimeError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Exception to stop processing jobs during a `process!` loop.
3
5
  # Simply `raise AbortProcessingError` in any job process handler to stop the processing loop.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Represents job related commands.
3
5
  class Job
data/lib/beaneater/job.rb CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'beaneater/job/record'
2
4
  require 'beaneater/job/collection'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  #
3
5
  # Borrowed from:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Represents a stats hash with proper underscored keys
3
5
  class StatStruct < FasterOpenStruct
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'beaneater/stats/fast_struct'
2
4
  require 'beaneater/stats/stat_struct'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Represents collection of tube related commands.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Beanstalk tube which contains jobs which can be inserted, reserved, et al.
3
5
  class Tube
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'beaneater/tube/record'
2
4
  require 'beaneater/tube/collection'
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Beaneater
2
4
  # Current version of gem.
3
- VERSION = "1.1.1"
5
+ VERSION = "1.1.4"
4
6
  end
data/lib/beaneater.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thread' unless defined?(Mutex)
2
4
 
3
5
  %w(version configuration errors connection tube job stats).each do |f|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('../test_helper', __FILE__)
2
4
 
3
5
  describe "beanstalk-client" do
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test/errors_test.rb
2
4
 
3
5
  require File.expand_path('../test_helper', __FILE__)
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(-1)
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test/prompt_regexp_test.rb
2
4
 
3
5
  require File.expand_path('../test_helper', __FILE__)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test/stat_struct_test.rb
2
4
 
3
5
  require File.expand_path('../test_helper', __FILE__)
data/test/stats_test.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test/stats_test.rb
2
4
 
3
5
  require File.expand_path('../test_helper', __FILE__)
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/setup'
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # test/tubes_test.rb
2
4
 
3
5
  require File.expand_path('../test_helper', __FILE__)
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.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: 2021-04-27 00:00:00.000000000 Z
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.0.8
146
+ rubygems_version: 3.5.23
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Simple beanstalkd client for ruby.