gearman-ruby 3.0.7 → 3.0.8

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzdjNjBlZDA5ODQ0ZGZhM2UwMzk0M2ZlNTNlNDY5NmEwNmMzODI4NA==
5
+ data.tar.gz: !binary |-
6
+ YmQ2ZjZiOTUxMTI5ZWRmYjRjZTE1MTY5ZGFhMGYwMWRjNGVjYzJmZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OGYwY2QxNDc2MmMxYzEyODRkNzU2NWMyYmY5MTNlYTY2ODRmY2ExNGZmMDk0
10
+ YmEzOTlhZTk0YzIzZjAxMTQ1YWZjMjUyNGYzZWZmYWFlZTM1ZDI5NDliMjUz
11
+ ZmM0MDUzZGJhNzkzZTQxZjg2YjJjNDY4NmJjNmM5MDc1MDM0NDU=
12
+ data.tar.gz: !binary |-
13
+ NzUzMDE1YmUyYTE4MDcxOWRlYjU5ZGQ2YzBiZTdlNTFiNTVjOTY0YmExZTdk
14
+ ZGQ2YzBmMzQ2YzlkMjZmZDU4NmZlMGUxOGJhZjM1MGJkYTJmZWEzNDJkZmUy
15
+ Y2E0N2ZlNjY3MTMxYzk1OWM5MDQxZTZjYmEzYTUwYTU4ODhkZWQ=
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGES
2
+ #
3
+ ## 3.0.8 (11/28/2014)
4
+ * Fix pattern captures in status output
5
+ * Allow tasks to be scheduled in constructor
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 3
3
+ :minor: 0
4
+ :patch: 5
data/gearman-ruby.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.summary = %q{Ruby Gearman library}
11
11
  s.description = %q{Library for the Gearman distributed job system}
12
12
  s.email = %q{john@johnewart.net}
13
- s.homepage = %q{http://github.com/gearman-ruby/gearman-ruby}
13
+ s.homepage = %q{http://github.com/johnewart/gearman-ruby}
14
14
  s.rubyforge_project = "gearman-ruby"
15
15
 
16
16
  s.extra_rdoc_files = [
@@ -62,7 +62,7 @@ class Server
62
62
  if response = send_command('status')
63
63
  response.split("\n").each do |line|
64
64
  if line.match /^(.*)?\t(\d+)\t(\d+)\t(\d+)$/
65
- (status[$1] ||= {})[$2] = { :queue => $3, :active => $4, :workers => $5 }
65
+ status[$1] = { :queue => $2, :active => $3, :workers => $4 }
66
66
  end
67
67
  end
68
68
  end
data/lib/gearman/task.rb CHANGED
@@ -21,7 +21,7 @@ module Gearman
21
21
  @arg = arg or '' # TODO: use something more ref-like?
22
22
  @uniq = nil # Initialize to nil
23
23
  %w{on_complete on_fail on_retry on_exception on_status on_warning on_data
24
- uniq retry_count priority hash background}.map {|s| s.to_sym }.each do |k|
24
+ uniq retry_count priority hash background schedule_at}.map {|s| s.to_sym }.each do |k|
25
25
  instance_variable_set "@#{k}", opts[k]
26
26
  opts.delete k
27
27
  end
@@ -31,7 +31,6 @@ module Gearman
31
31
  @retry_count ||= 0
32
32
  @successful = false
33
33
  @retries_done = 0
34
-
35
34
  end
36
35
 
37
36
  attr_accessor :uniq, :retry_count, :priority, :background, :epoch
@@ -42,7 +41,7 @@ module Gearman
42
41
  #
43
42
  # @param time Ruby Time object that represents when to run the thing
44
43
  def schedule(time)
45
- @scheduled_at = time
44
+ @schedule_at = time
46
45
  end
47
46
 
48
47
  ##
@@ -119,11 +118,11 @@ module Gearman
119
118
  @on_complete.call(data) if @on_complete
120
119
  self
121
120
  end
122
-
121
+
123
122
  def on_created(&f)
124
123
  @on_created = f
125
124
  end
126
-
125
+
127
126
  def handle_created(data)
128
127
  @on_created.call(data) if @on_created
129
128
  self
@@ -182,13 +181,13 @@ module Gearman
182
181
  #
183
182
  def get_uniq_hash
184
183
  return @hash if @hash
185
-
186
- if @uniq.nil?
184
+
185
+ if @uniq.nil?
187
186
  string = @func+@arg.to_s
188
- else
187
+ else
189
188
  string = @uniq
190
189
  end
191
-
190
+
192
191
  @hash = Digest::SHA1.hexdigest(string)
193
192
  end
194
193
 
@@ -198,10 +197,10 @@ module Gearman
198
197
  # @return String representation of packet
199
198
  def get_submit_packet()
200
199
  modes = ['submit_job']
201
-
202
- if @scheduled_at
200
+
201
+ if @schedule_at
203
202
  modes << 'epoch'
204
- args = [func, get_uniq_hash, @scheduled_at.to_i, arg]
203
+ args = [func, get_uniq_hash, @schedule_at.to_i, arg]
205
204
  else
206
205
  if @priority
207
206
  modes << 'high' if @priority == :high
@@ -212,12 +211,12 @@ module Gearman
212
211
 
213
212
  args = [func, get_uniq_hash, arg]
214
213
  end
215
-
214
+
216
215
  mode = modes.join('_')
217
216
  Util::pack_request(mode, args.join("\0"))
218
217
  end
219
218
  end
220
-
219
+
221
220
  class BackgroundTask < Task
222
221
  def initialize(*args)
223
222
  super
@@ -1,3 +1,3 @@
1
1
  module Gearman
2
- VERSION = "3.0.7"
2
+ VERSION = "3.0.8"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gearman-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
5
- prerelease:
4
+ version: 3.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - John Ewart
@@ -28,13 +27,14 @@ extra_rdoc_files:
28
27
  - TODO
29
28
  files:
30
29
  - .gitignore
31
- - CHANGELOG
30
+ - CHANGELOG.md
32
31
  - Gemfile
33
32
  - HOWTO
34
33
  - LICENSE
35
34
  - README
36
35
  - Rakefile
37
36
  - TODO
37
+ - VERSION.yml
38
38
  - examples/calculus_client.rb
39
39
  - examples/calculus_worker.rb
40
40
  - examples/client.php
@@ -77,32 +77,28 @@ files:
77
77
  - test/testlib.rb
78
78
  - test/util_test.rb
79
79
  - test/worker_test.rb
80
- homepage: http://github.com/gearman-ruby/gearman-ruby
80
+ homepage: http://github.com/johnewart/gearman-ruby
81
81
  licenses: []
82
+ metadata: {}
82
83
  post_install_message:
83
84
  rdoc_options: []
84
85
  require_paths:
85
86
  - lib
86
87
  required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
88
  requirements:
89
89
  - - ! '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
- segments:
93
- - 0
94
- hash: 4589265995456252145
95
92
  required_rubygems_version: !ruby/object:Gem::Requirement
96
- none: false
97
93
  requirements:
98
94
  - - ! '>='
99
95
  - !ruby/object:Gem::Version
100
96
  version: '0'
101
97
  requirements: []
102
98
  rubyforge_project: gearman-ruby
103
- rubygems_version: 1.8.23
99
+ rubygems_version: 2.2.2
104
100
  signing_key:
105
- specification_version: 3
101
+ specification_version: 4
106
102
  summary: Ruby Gearman library
107
103
  test_files:
108
104
  - spec/client_spec.rb
data/CHANGELOG DELETED
@@ -1,3 +0,0 @@
1
- 3.0.6
2
-
3
- * Connection failover for clients