shinq 0.4.0 → 0.5.0

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: b924bc9aa5b90d80b12a87648a79556806e05afb
4
- data.tar.gz: f819bc9b7d685856fd493f962c13d0cdbd8ee841
3
+ metadata.gz: 9534f89c327ced4191505c4bd0e0034e2b8d2520
4
+ data.tar.gz: 5e44bcac5e977430c8fd147342ea062112248754
5
5
  SHA512:
6
- metadata.gz: 02779081ac90c7e27bdf1838e16546beb3381e9756f885361239b0bf03c73d4371fd8bc12f59ba73848bead48ee5a4a3884aa70a608e67ed1174eee5124d08ea
7
- data.tar.gz: 4b618dfc9164a2de53d1a6ef65de9566644d94ea9e36e8947c2735ca044e910c48a7301c32f66d69346dec285adb8e590fd96ad75642309943316da558bac5d5
6
+ metadata.gz: 41cc01e642978d5c345c4ea7b9956d41e5cbf6115e0ec70f54103baea484e088e873565d17010b230f6eb056c75434fbd2c03e70ce314398c1099e95ca78b9ef
7
+ data.tar.gz: 3cb2a4b1adf7216117e5e693e32bdeac0147a8a0c995abb5b58222d6f5bc9b2f748f4cd0de8e91f0feabe214ab7b1f8bd6873d0f215e278d118544c009d4b2cd
data/README.md CHANGED
@@ -55,7 +55,7 @@ Generated migration file
55
55
  ```ruby
56
56
  class CreateWorkerNames < ActiveRecord::Migration
57
57
  def change
58
- create_table :worker_names, {id: false, options: "ENGINE=QUEUE"} do |t|
58
+ create_table :worker_names, id: false, options: "ENGINE=QUEUE" do |t|
59
59
  t.string :job_id, null: false
60
60
  t.string :title
61
61
  t.datetime :enqueued_at, null: false
@@ -98,7 +98,7 @@ You can specify some options. see `bundle exec shinq --help`
98
98
 
99
99
  ## Contributing
100
100
 
101
- 1. Fork it ( https://github.com/[my-github-username]/shinq/fork )
101
+ 1. Fork it ( https://github.com/ryopeko/shinq/fork )
102
102
  2. Create your feature branch (`git checkout -b my-new-feature`)
103
103
  3. Commit your changes (`git commit -am 'Add some feature'`)
104
104
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,6 +1,6 @@
1
1
  class <%= migration_class_name %> < ActiveRecord::Migration
2
2
  def change
3
- create_table :<%= table_name %>, {id: false, options: "ENGINE=QUEUE"} do |t|
3
+ create_table :<%= table_name %>, id: false, options: "ENGINE=QUEUE" do |t|
4
4
  t.string :job_id, null: false
5
5
  <% attributes.each do |attribute| -%>
6
6
  t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
data/lib/shinq/client.rb CHANGED
@@ -17,7 +17,7 @@ module Shinq
17
17
  ))
18
18
  Shinq.connection.query(sql)
19
19
  else
20
- raise ArgumentError, "Queue should be Hash"
20
+ raise ArgumentError, "`args` should be a Hash"
21
21
  end
22
22
  end
23
23
 
@@ -31,6 +31,7 @@ module Shinq
31
31
  unless has_queue[wait_query].to_i == 0
32
32
  sql = builder.select(table_name, ['*'])
33
33
  results = Shinq.connection.query(sql)
34
+ # select always returns 1 line in the owner (queue_wait) mode
34
35
  return results.first.symbolize_keys
35
36
  end
36
37
  end
@@ -17,7 +17,7 @@ module Shinq
17
17
  worker_class.new.perform(queue)
18
18
  rescue => e
19
19
  Shinq::Client.abort
20
- raise
20
+ raise e
21
21
  end
22
22
 
23
23
  Shinq::Client.done
data/shinq.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "shinq"
7
- spec.version = '0.4.0'
7
+ spec.version = '0.5.0'
8
8
  spec.authors = ["Ryoichi SEKIGUCHI"]
9
9
  spec.email = ["ryopeko@gmail.com"]
10
10
  spec.summary = %q{Worker and enqueuer for Q4M using the interface of ActiveJob.}
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "mysql2", "~> 0.3.16"
28
28
  spec.add_dependency "sql-maker", "~> 0.0.4"
29
- spec.add_dependency "activesupport", "~> 4.2.0.beta2"
29
+ spec.add_dependency "activesupport", "~> 4.2"
30
30
  spec.add_dependency 'serverengine', '~> 1.5.9'
31
31
  end
data/spec/shinq_spec.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'shinq'
3
3
  require 'shinq/configuration'
4
+ require 'logger'
4
5
 
5
6
  def shinq_class
6
7
  Shinq.dup
@@ -67,4 +68,22 @@ describe Shinq do
67
68
  it { expect(shinq.connection(db_name: :test)).to be_a_kind_of(Mysql2::Client) }
68
69
  end
69
70
  end
71
+
72
+ describe ".logger" do
73
+ context "when logger is present" do
74
+ let(:shinq) { shinq_class }
75
+ it { expect(shinq.logger).to be nil }
76
+ end
77
+
78
+ context "when logger is present" do
79
+ let(:logger) { Logger.new(STDOUT) }
80
+ let(:shinq) {
81
+ shinq_class.tap {|s|
82
+ s.logger = logger
83
+ }
84
+ }
85
+
86
+ it { expect(shinq.logger).to be logger }
87
+ end
88
+ end
70
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shinq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryoichi SEKIGUCHI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2014-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 4.2.0.beta2
145
+ version: '4.2'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 4.2.0.beta2
152
+ version: '4.2'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: serverengine
155
155
  requirement: !ruby/object:Gem::Requirement