shinq 0.4.0 → 0.5.0
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/README.md +2 -2
- data/lib/generators/shinq/worker/templates/create_table_migration.erb +1 -1
- data/lib/shinq/client.rb +2 -1
- data/lib/shinq/launcher.rb +1 -1
- data/shinq.gemspec +2 -2
- data/spec/shinq_spec.rb +19 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9534f89c327ced4191505c4bd0e0034e2b8d2520
|
4
|
+
data.tar.gz: 5e44bcac5e977430c8fd147342ea062112248754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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/
|
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 %>,
|
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, "
|
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
|
data/lib/shinq/launcher.rb
CHANGED
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.
|
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
|
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
|
+
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
|
+
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
|
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
|
152
|
+
version: '4.2'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: serverengine
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|