rubykiq 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: fe8a63e0620e49a3abee5a4b793f6a47de9d2134
4
- data.tar.gz: 538763a88753b76a2d0647b0a66efba79da5db4f
3
+ metadata.gz: f16a7dd593de391c8588314bf0aaaba87b387308
4
+ data.tar.gz: 5c91ee1222eebf07a49e30dc695064f515cc31e6
5
5
  SHA512:
6
- metadata.gz: 61192efb893a6bbe6d0d094e3c672a56ae4cea8e1e6d65dbcdc7c21762423f49fcfd6f6e54d311c7852844af4bafeee5a069342a2e9fe4188bae1109a72bedfd
7
- data.tar.gz: 000c33af26dfd8edb0342f35265f2e85284affbd2e49338af480af75fee90db40b38abb08618981510d761136443da1d25513cb0ce8e559ec2fb391b56b9f79e
6
+ metadata.gz: 4b784fe4ec2dc3d0c972793170b0cd58b740dc1a9c251c344f32ad709062d42399d38b83154ebd185e90b97141014c503e7367e909e655b9d970660ec91a0a0c
7
+ data.tar.gz: 2de3671bf79f3f07d5b2c554766eaae6d20520a8c4de3047c81208c06e91c9221e1a83407bdeb9afd4a175d4cbc9dfdf980793f871c0380f0350c21f3937073e
data/.gitignore CHANGED
@@ -2,6 +2,8 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
+ .devnotes
6
+ .greenbar
5
7
  .yardoc
6
8
  Gemfile.lock
7
9
  InstalledFiles
@@ -21,4 +21,6 @@ matrix:
21
21
  notifications:
22
22
  email: false
23
23
  services:
24
- - redis-server
24
+ - redis-server
25
+ env:
26
+ - CODECLIMATE_REPO_TOKEN=04a9fef09063cdef2f62cf46531329ad01a9383e3de8270e112480052774f676
@@ -0,0 +1,16 @@
1
+ Next Release
2
+ ============
3
+ * Your contribution here.
4
+
5
+ 1.0.2 (02/08/2015)
6
+ ==================
7
+ * [Include `enqueued_at` in payload](https://github.com/karlfreeman/rubykiq/commit/0a68c9dc670f94efe8a344869db0b7ba4a97d1d7) - [@amiel](https://github.com/karlfreeman).
8
+
9
+
10
+ 1.0.1 (18/03/2014)
11
+ ==================
12
+ * [Ensure loading a client is Thread.exclusive](https://github.com/karlfreeman/rubykiq/commit/0a68c9dc670f94efe8a344869db0b7ba4a97d1d7) - [@karlfreeman](https://github.com/karlfreeman).
13
+
14
+ 1.0.0 (03/03/2014)
15
+ ==================
16
+ * Initial public release - [@karlfreeman](https://github.com/karlfreeman).
data/Gemfile CHANGED
@@ -8,5 +8,7 @@ gem 'em-synchrony'
8
8
  group :test do
9
9
  gem 'rake', '~> 10.0'
10
10
  gem 'rspec'
11
+ gem 'rspec-its'
11
12
  gem 'timecop'
13
+ gem 'codeclimate-test-reporter'
12
14
  end
data/README.md CHANGED
@@ -69,6 +69,7 @@ bar_client = Rubykiq::Client.new(namespace: 'bar')
69
69
  [![Gem Version](http://img.shields.io/gem/v/rubykiq.svg)][gem]
70
70
  [![Build Status](http://img.shields.io/travis/karlfreeman/rubykiq.svg)][travis]
71
71
  [![Code Quality](http://img.shields.io/codeclimate/github/karlfreeman/rubykiq.svg)][codeclimate]
72
+ [![Code Coverage](http://img.shields.io/codeclimate/coverage/github/karlfreeman/rubykiq.svg)][codeclimate]
72
73
  [![Gittip](http://img.shields.io/gittip/karlfreeman.svg)][gittip]
73
74
 
74
75
  ## Supported Redis Drivers
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ end
15
15
  begin
16
16
  require 'rubocop/rake_task'
17
17
  desc 'Run rubocop'
18
- Rubocop::RakeTask.new(:rubocop)
18
+ RuboCop::RakeTask.new(:rubocop)
19
19
  rescue LoadError
20
20
  end
21
21
 
@@ -12,7 +12,7 @@ module Rubykiq
12
12
  def_delegators :client, *Rubykiq::Client::VALID_OPTIONS_KEYS
13
13
 
14
14
  # delegate all VALID_OPTIONS_KEYS setters to the client ( hacky I know... )
15
- def_delegators :client, *(Rubykiq::Client::VALID_OPTIONS_KEYS.dup.map! do |key| "#{key}=".to_sym; end)
15
+ def_delegators :client, *(Rubykiq::Client::VALID_OPTIONS_KEYS.dup.map! { |key| "#{key}=".to_sym; })
16
16
 
17
17
  # Fetch the Rubykiq::Client
18
18
  #
@@ -176,6 +176,9 @@ module Rubykiq
176
176
  # provide a job ID
177
177
  pre_normalized_item[:jid] = ::SecureRandom.hex(12)
178
178
 
179
+ # Sidekiq::Queue#latency (used in sidekiq web), requires `enqueued_at`
180
+ pre_normalized_item[:enqueued_at] = Time.now.to_f
181
+
179
182
  pre_normalized_item
180
183
  end
181
184
 
@@ -1,3 +1,3 @@
1
1
  module Rubykiq
2
- VERSION = '1.0.1' unless defined?(Rubykiq::VERSION)
2
+ VERSION = '1.0.2' unless defined?(Rubykiq::VERSION)
3
3
  end
@@ -8,6 +8,7 @@ Bundler.setup
8
8
  end
9
9
 
10
10
  require 'rubykiq'
11
+ require 'rspec/its'
11
12
 
12
13
  RSpec.configure do |config|
13
14
  config.expect_with :rspec do |c|
@@ -0,0 +1,2 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
@@ -1,3 +1,6 @@
1
1
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
2
- require 'pry' unless ENV['CI']
2
+ begin
3
+ require 'pry' unless ENV['CI']
4
+ rescue LoadError
5
+ end
3
6
  end
@@ -20,7 +20,7 @@ describe Rubykiq::Client do
20
20
  subject { client }
21
21
  its(:namespace) { should eq driver }
22
22
  its(:driver) { should be driver }
23
- its(:retry) { should be_true }
23
+ its(:retry) { should eq true }
24
24
  its(:queue) { should eq 'default' }
25
25
  end
26
26
 
@@ -59,18 +59,17 @@ describe Rubykiq::Client do
59
59
  context "with args #{args}" do
60
60
  it "should create #{args.length} job(s)" do
61
61
  wrap_in_synchrony?(driver) do
62
- client.connection_pool do |connection|
63
- connection.flushdb
64
- end
62
+ client.connection_pool(&:flushdb)
65
63
 
66
64
  expect { client.push(class: 'MyWorker', args: args) }.to change {
67
- client.connection_pool do |connection| connection.llen('queue:default'); end
65
+ client.connection_pool { |connection| connection.llen('queue:default'); }
68
66
  }.from(0).to(args.length)
69
67
 
70
- raw_jobs = client.connection_pool do |connection| connection.lrange('queue:default', 0, args.length); end
68
+ raw_jobs = client.connection_pool { |connection| connection.lrange('queue:default', 0, args.length); }
71
69
  raw_jobs.each do |job|
72
70
  job = MultiJson.decode(job, symbolize_keys: true)
73
71
  expect(job).to have_key(:jid)
72
+ expect(job[:enqueued_at]).to be_within(1).of(Time.now.to_f)
74
73
  end
75
74
  end
76
75
  end
@@ -81,15 +80,13 @@ describe Rubykiq::Client do
81
80
  context "with time #{time} (#{time.class})" do
82
81
  it "should create #{args.length} job(s)" do
83
82
  wrap_in_synchrony?(driver) do
84
- client.connection_pool do |connection|
85
- connection.flushdb
86
- end
83
+ client.connection_pool(&:flushdb)
87
84
 
88
85
  expect { client.push(class: 'MyWorker', args: args, at: time) }.to change {
89
- client.connection_pool do |connection| connection.zcard('schedule'); end
86
+ client.connection_pool { |connection| connection.zcard('schedule'); }
90
87
  }.from(0).to(args.length)
91
88
 
92
- raw_jobs = client.connection_pool do |connection| connection.zrange('schedule', 0, args.length); end
89
+ raw_jobs = client.connection_pool { |connection| connection.zrange('schedule', 0, args.length); }
93
90
  raw_jobs.each do |job|
94
91
  job = MultiJson.decode(job, symbolize_keys: true)
95
92
  expect(job).to have_key(:at)
@@ -28,7 +28,7 @@ describe Rubykiq::Connection do
28
28
 
29
29
  describe :env do
30
30
  subject { Rubykiq::Connection.new }
31
- [{ name: 'REDISTOGO_URL', value: 'redistogo' }, { name: 'REDIS_PROVIDER', value: 'redisprovider' }, { name: 'REDIS_URL', value: 'redisurl' }].each do | test_case |
31
+ [{ name: 'REDISTOGO_URL', value: 'redistogo' }, { name: 'REDIS_PROVIDER', value: 'redisprovider' }, { name: 'REDIS_URL', value: 'redisurl' }].each do |test_case|
32
32
  context "with ENV[#{test_case[:name]}]" do
33
33
  before do
34
34
  ENV[test_case[:name]] = "redis://#{test_case[:value]}:6379/0"
@@ -1,8 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Rubykiq do
4
-
5
-
6
4
  describe :client do
7
5
  it 'should return a Client' do
8
6
  expect(Rubykiq.client).to be_kind_of(Rubykiq::Client)
@@ -34,5 +32,4 @@ describe Rubykiq do
34
32
  it { should respond_to "#{key}=".to_sym }
35
33
  end
36
34
  end
37
-
38
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubykiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Freeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2015-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -174,6 +174,7 @@ files:
174
174
  - lib/rubykiq/version.rb
175
175
  - rubykiq.gemspec
176
176
  - spec/spec_helper.rb
177
+ - spec/support/codeclimate.rb
177
178
  - spec/support/pry.rb
178
179
  - spec/support/timecop.rb
179
180
  - spec/unit/client_spec.rb
@@ -199,12 +200,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  version: '0'
200
201
  requirements: []
201
202
  rubyforge_project:
202
- rubygems_version: 2.2.0
203
+ rubygems_version: 2.4.5
203
204
  signing_key:
204
205
  specification_version: 4
205
206
  summary: Sidekiq agnostic enqueuing using Redis
206
207
  test_files:
207
208
  - spec/spec_helper.rb
209
+ - spec/support/codeclimate.rb
208
210
  - spec/support/pry.rb
209
211
  - spec/support/timecop.rb
210
212
  - spec/unit/client_spec.rb