micro_q 0.8.0 → 0.9.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: 5d7397239d88fe8ba5027ca54e052af6ee286e32
4
- data.tar.gz: e52f3922fd037146a570208025aaf64451aa600c
3
+ metadata.gz: 594090928b9d6ed47e533456305b1944bb76d593
4
+ data.tar.gz: 76195292f3ea53b5d0b0ceb80033cac71e9e52a0
5
5
  SHA512:
6
- metadata.gz: 2318f4b75ccaaa0412809273013d7d8b563356b3cafd0219ed26b2bad66ccd3fd2c753fa8b36b76dade486182ccb12394c6679b2df4ea5edf734e66dcb2d7805
7
- data.tar.gz: 9b989f109f14acaea6742c95050701aa81631137923a1896c0b43f88a9f088179bf8826cff482205cbff14e228a8e9aefc2c82a3ead9b7762469006275050a9b
6
+ metadata.gz: a6443272fd150e6ca1e1a022445bd22a462856af5db981b86a207e4665d599d58727125198ccb4ca77ae1077b1f2d225bf4c2f5baacad449894d1bb1491762c2
7
+ data.tar.gz: 60c5ffda9d6cf7423ef0a86c6ba6fa012347cc1131db87260855e410f7c4336c09f4d109a817f178ded2b07c70805aaccc60fa02e3f25fa1f55cdc8c797dcd05
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 1.9.2
5
5
  - rbx-19mode
6
6
  - rbx-nightly-19mode
7
+ - jruby-19mode
7
8
  - 2.0.0
8
9
  branches:
9
10
  only:
@@ -18,6 +19,7 @@ matrix:
18
19
  - rvm: 1.9.2
19
20
  - rvm: rbx-19mode
20
21
  - rvm: rbx-nightly-19mode
22
+ - rvm: jruby-19mode
21
23
  branches:
22
24
  only:
23
25
  - master
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or install it:
24
24
  ```ruby
25
25
  ## A typical worker class
26
26
  class MyWorker
27
- worker :update # sets up the dsl and adds additional async_ methods
27
+ worker :update # sets up the dsl and adds additional _async methods
28
28
 
29
29
  def perform
30
30
  # do some performing here
@@ -39,8 +39,10 @@ end
39
39
  ###Simple
40
40
 
41
41
  ```ruby
42
- MyWorker.async_perform
43
- MyWorker.async_update(:user_id => user.id)
42
+ Called on the class invoked on an instance.
43
+
44
+ MyWorker.perform_async
45
+ MyWorker.update_async(:user_id => user.id)
44
46
  ```
45
47
 
46
48
  ###Advanced
data/lib/micro_q/dsl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module MicroQ
2
2
  ##
3
3
  # Convenience methods for calling methods asynchronously
4
- # Adds async_perform by default
4
+ # Adds perform_async by default
5
5
  #
6
6
  # Usage
7
7
  # class MyWorker
@@ -11,23 +11,23 @@ module MicroQ
11
11
  # end
12
12
  # end
13
13
  #
14
- # MyWorker.async_update
14
+ # MyWorker.update_async
15
15
  # is the same as
16
16
  # MyWorker.new.async(:queue => 'non-default').update
17
17
  #
18
18
  module DSL
19
19
  ##
20
20
  # For each of the methods given to the Object.worker method
21
- # define the async_ prefixed version for convenience
21
+ # define the _async post-fixed version for convenience
22
22
  #
23
23
  def self.attach_async_methods(target, opts)
24
24
  target.class_eval do
25
25
  (target.microq_options[:methods] |= opts.flatten).each do |method|
26
- target.define_singleton_method(:"async_#{method}") do |*args|
26
+ target.define_singleton_method(:"#{method}_async") do |*args|
27
27
  MicroQ::Proxy::Instance.new(
28
28
  target.microq_options.dup.merge(:class => self)
29
29
  ).send(method, *args)
30
- end unless respond_to?(:"async_#{method}")
30
+ end unless respond_to?(:"#{method}_async")
31
31
  end
32
32
  end
33
33
  end
@@ -1,6 +1,6 @@
1
1
  module MicroQ
2
2
  MAJOR = 0
3
- MINOR = 8
3
+ MINOR = 9
4
4
  POINT = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, POINT].join('.')
data/spec/lib/dsl_spec.rb CHANGED
@@ -14,16 +14,16 @@ describe MicroQ::DSL do
14
14
  Object.should be_is_a(MicroQ::DSL::ClassMethods)
15
15
  end
16
16
 
17
- it 'should add the async_perform method' do
18
- OtherWorker.should be_respond_to(:async_perform)
17
+ it 'should add the perform_async method' do
18
+ OtherWorker.should be_respond_to(:perform_async)
19
19
  end
20
20
 
21
- it 'should add async_ prefixed method when given them' do
22
- OtherWorker.should be_respond_to(:async_update)
21
+ it 'should add _async post-fixed method when given them' do
22
+ OtherWorker.should be_respond_to(:update_async)
23
23
  end
24
24
 
25
- describe 'when calling the async_ method' do
26
- let(:method) { ->(*args) { OtherWorker.async_perform(*args) } }
25
+ describe 'when calling the _async method' do
26
+ let(:method) { ->(*args) { OtherWorker.perform_async(*args) } }
27
27
 
28
28
  before do
29
29
  @proxy = mock(MicroQ::Proxy::Instance, :perform => nil)
@@ -61,8 +61,8 @@ describe MicroQ::DSL do
61
61
  end
62
62
  end
63
63
 
64
- describe 'when calling the async_something method' do
65
- let(:method) { ->(*args) { OtherWorker.async_update(*args) } }
64
+ describe 'when calling the something_async method' do
65
+ let(:method) { ->(*args) { OtherWorker.update_async(*args) } }
66
66
 
67
67
  before do
68
68
  @proxy = mock(MicroQ::Proxy::Instance, :update => nil)
@@ -101,9 +101,9 @@ describe MicroQ::DSL do
101
101
  worker :other_method, :queue => 'my-queue', :option => 'value'
102
102
  end
103
103
 
104
- it 'should have the async_ methods' do
105
- OptionWorker.should be_respond_to(:async_method_name)
106
- OptionWorker.should be_respond_to(:async_other_method)
104
+ it 'should have the _async methods' do
105
+ OptionWorker.should be_respond_to(:method_name_async)
106
+ OptionWorker.should be_respond_to(:other_method_async)
107
107
  end
108
108
 
109
109
  it 'should store the options' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_q
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Norton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-15 00:00:00.000000000 Z
11
+ date: 2013-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid