disc 0.0.7 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d8bbbb6f541c89e165acb164db27941d0c13481
4
- data.tar.gz: b74592344a5a936f8e2aed6039772a39af8f1dbc
3
+ metadata.gz: e5ee2da4bef94664480d83b714c143e5c45e3cac
4
+ data.tar.gz: 387342a78355c0cac2dc8d344ec23332a71d3841
5
5
  SHA512:
6
- metadata.gz: 1452ef79a333b0562f9cce994b28770c6d66aadd41d14577edebeeded2678735e22e0486b75b31462250c5b40b93565f2f4ca0310b145263c74c2e64a39f4968
7
- data.tar.gz: 4679185b060daf9f1778ce2f0976b37787e7febed760c5838a065b25c6c440cd968a9c8d713ed01f32365cb4fffbadc67ef8de666dcfdc702235a40ad1d3ebad
6
+ metadata.gz: 5e20e956400a9dc713f36e4aa47ff61261c9e66c0d3f2ee8f5b523d6aeecfbe498eb6d29339cbd62bd5f85f4a00a12f43986b8670e4668967fdc3a64499837e8
7
+ data.tar.gz: 1fff7b0e2f8832e3c74da9d154893765ac5f49294ba0b3167dd738c8daf1749a641584281cb2bdc872e18f280c7caccc07ca55c9bac73e0d15e3e4fde28c660e
data/README.md CHANGED
@@ -108,6 +108,8 @@ for example.
108
108
  Both the error handler function and the `disc_start` callback get the data of
109
109
  the current job as a Hash, that has the following schema.
110
110
 
111
+ | | |
112
+ |:-------------:|:------------------------------------------------------|
111
113
  | `'class'` | (String) The Job class. |
112
114
  | `'arguments'` | (Array) The arguments passed to perform. |
113
115
  | `'queue'` | (String) The queue from which this job was picked up. |
@@ -132,3 +134,10 @@ default.
132
134
 
133
135
  The code is released under an MIT license. See the [LICENSE](./LICENSE) file for
134
136
  more information.
137
+
138
+ ## Acknowledgements
139
+
140
+ * To [@godfoca](https://github.com/godfoca) for helping me ship a quality thing and putting up with my constant whining.
141
+ * To [@antirez](https://github,com/antirez) for Redis, Disque, and his refreshing way of programming wonderful tools.
142
+ * To [@soveran](https://github.com/soveran) for pushing me to work on this and publishing gems that keep me enjoying ruby.
143
+ * To [all contributors](https://github.com/pote/disc/graphs/contributors)
data/bin/disc CHANGED
@@ -9,7 +9,7 @@ Clap.run ARGV,
9
9
  if defined?(Celluloid)
10
10
  concurrency = ENV.fetch('DISC_CONCURRENCY', '25').to_i
11
11
  STDOUT.puts(
12
- "[Notice] Disc running in celluloid-mode! Current DISC_CONCURRENCY is\
12
+ "[Notice] Disc running in celluloid mode! Current DISC_CONCURRENCY is\
13
13
  #{ concurrency }."
14
14
  )
15
15
 
@@ -32,9 +32,6 @@ if defined?(Celluloid)
32
32
  )
33
33
  end
34
34
  else
35
- STDOUT.puts(
36
- "[Notice] Disc running in non-threaded mode, consider requiring celluloid\
37
- for a significant powerup!"
38
- )
35
+ STDOUT.puts("[Notice] Disc running in non-threaded mode")
39
36
  Disc::Worker.run
40
37
  end
data/lib/disc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Disc
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/disc.rb CHANGED
@@ -71,8 +71,8 @@ class Disc
71
71
  job = MessagePack.unpack(serialized_job)
72
72
  job.update('id' => msgid, 'queue' => queue)
73
73
 
74
- instance = Object.const_get(job['class']).new
75
74
  begin
75
+ instance = Object.const_get(job['class']).new
76
76
  instance.disc_start(job)
77
77
  instance.perform(*job['arguments'])
78
78
  disque.call('ACKJOB', msgid)
@@ -92,8 +92,8 @@ class Disc
92
92
 
93
93
  module Job
94
94
  attr_reader :arguments,
95
- :queue,
96
- :disque
95
+ :disque,
96
+ :disc_options
97
97
 
98
98
  def self.included(base)
99
99
  base.extend(ClassMethods)
@@ -114,12 +114,16 @@ class Disc
114
114
  @disque = disque
115
115
  end
116
116
 
117
- def queue
118
- @queue ||= 'default'
117
+ def disc(options = {})
118
+ @disc_options = options
119
+ end
120
+
121
+ def disc_options
122
+ @disc_options ||= {}
119
123
  end
120
124
 
121
- def queue=(queue)
122
- @queue = queue
125
+ def queue
126
+ disc_options.fetch(:queue, 'default')
123
127
  end
124
128
 
125
129
  def enqueue(*args)
@@ -141,10 +145,6 @@ class Disc
141
145
  delay: datetime && (datetime.to_time.to_i - DateTime.now.to_time.to_i)
142
146
  )
143
147
  end
144
-
145
- def disc(options = {})
146
- self.queue = options.fetch(:queue, 'default')
147
- end
148
148
  end
149
149
  end
150
150
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - pote
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-11 00:00:00.000000000 Z
11
+ date: 2015-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: disque
@@ -71,7 +71,6 @@ files:
71
71
  - disc.gemspec
72
72
  - examples/disc_init.rb
73
73
  - examples/fail_job.rb
74
- - examples/failer.rb
75
74
  - examples/greeter.rb
76
75
  - lib/disc.rb
77
76
  - lib/disc/version.rb
data/examples/failer.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'disc'
2
-
3
- class Failer
4
- include Disc::Job
5
- disc queue: 'test_medium'
6
-
7
- def perform
8
- raise 'I just failed!'
9
- end
10
- end
11
-