resque-kawai 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ TODO
3
3
  locks
4
4
  *.gem
5
5
  *.log
6
+ .bundle
data/Gemfile CHANGED
@@ -1,10 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Will automatically pull in this gem and all its
4
- # dependencies specified in the gemspec
5
- gem "resque-kawai", :path => File.expand_path("..", __FILE__)
6
-
7
- gem 'activesupport'
8
- # These are development dependencies
9
- gem "rspec"
10
- gem 'rake'
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -46,7 +46,6 @@ PLATFORMS
46
46
  ruby
47
47
 
48
48
  DEPENDENCIES
49
- activesupport
50
49
  rake
51
50
  resque-kawai!
52
51
  rspec
data/Rakefile CHANGED
@@ -1,16 +1,9 @@
1
1
  require 'rubygems'
2
- require "bundler/setup"
2
+ require 'bundler/setup'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
3
5
 
4
6
  require 'rspec/core/rake_task'
5
7
 
6
8
  task :default => :spec
7
9
  RSpec::Core::RakeTask.new(:spec)
8
-
9
- require 'rubygems/package_task'
10
- require 'rubygems/specification'
11
-
12
- spec = eval(File.read('resque-kawai.gemspec'))
13
-
14
- Gem::PackageTask.new(spec) do |pkg|
15
- pkg.gem_spec = spec
16
- end
data/lib/rq_queue.rb CHANGED
@@ -10,13 +10,21 @@ class RqQueue
10
10
  attr_accessor :logger
11
11
 
12
12
  def self.inherited(subclass)
13
- subclass.instance_variable_set('@queue', subclass.extract_queue_name)
13
+ subclass.set_queue_name(subclass.extract_queue_name)
14
14
  end
15
15
 
16
16
  def self.extract_queue_name
17
17
  name.gsub(/^Rq/, '').underscore.gsub('/', '-').to_sym
18
18
  end
19
19
 
20
+ def self.set_queue_name(queue_name)
21
+ self.instance_variable_set('@queue', queue_name.to_sym)
22
+ end
23
+
24
+ def self.queue_name
25
+ @queue
26
+ end
27
+
20
28
  def self.add_event(method_name, *args)
21
29
  Resque.enqueue(self, method_name.to_s, args)
22
30
  end
@@ -74,5 +82,9 @@ class RqQueue
74
82
  def initialize
75
83
  self.logger = self.class.logger
76
84
  end
85
+
86
+ def queue_name
87
+ self.class.queue_name
88
+ end
77
89
 
78
- end
90
+ end
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Rq
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
data/resque-kawai.gemspec CHANGED
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'activesupport'
23
23
  s.add_dependency 'resque'
24
24
  s.add_development_dependency "rspec"
25
+ s.add_development_dependency "rake"
25
26
 
26
- end
27
+ end
@@ -10,6 +10,29 @@ describe RqQueue do
10
10
  it "queue name A::B::C" do
11
11
  A::B::C.instance_variable_get('@queue').should == :'a-b-c'
12
12
  end
13
+
14
+ it "aliases for queues" do
15
+ RqTest.queue_name.should == :test
16
+ RqTest.instance.queue_name.should == :test
17
+ end
18
+
19
+ it "set queue_name" do
20
+ RqTest.set_queue_name('haha')
21
+ RqTest.queue_name.should == :haha
22
+ RqTest.instance.queue_name.should == :haha
23
+
24
+ class Rq2 < RqTest
25
+ set_queue_name 'jopa'
26
+ end
27
+ end
28
+
29
+ it "set queue name inside class" do
30
+ class Rq2 < RqTest
31
+ set_queue_name 'jopa'
32
+ end
33
+
34
+ Rq2.queue_name.should == :jopa
35
+ end
13
36
 
14
37
  it "should enqueue defined event" do
15
38
  Resque.should_receive(:enqueue).with(RqTest, 'bla', [1, 'a', []])
metadata CHANGED
@@ -1,74 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque-kawai
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Makarchev Konstantin
14
9
  autorequire: resque-kawai.rb
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-24 00:00:00 +04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: activesupport
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: resque
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: resque
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
50
47
  name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
51
55
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
53
57
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
61
70
  type: :development
62
- version_requirements: *id003
63
- description: Syntax sugar for Resque consumers. Each consumer is a class, with clean interface, and custom logger. Usefull when count of different events ~100 and more.
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Syntax sugar for Resque consumers. Each consumer is a class, with clean
79
+ interface, and custom logger. Usefull when count of different events ~100 and more.
64
80
  email: kostya27@gmail.com
65
81
  executables: []
66
-
67
82
  extensions: []
68
-
69
83
  extra_rdoc_files: []
70
-
71
- files:
84
+ files:
72
85
  - .gitignore
73
86
  - Gemfile
74
87
  - Gemfile.lock
@@ -85,39 +98,29 @@ files:
85
98
  - spec/rq_queue_spec.rb
86
99
  - spec/spec_helper.rb
87
100
  - spec/test_class.rb
88
- has_rdoc: true
89
101
  homepage: http://github.com/kostya/resque-kawai
90
102
  licenses: []
91
-
92
103
  post_install_message:
93
104
  rdoc_options: []
94
-
95
- require_paths:
105
+ require_paths:
96
106
  - lib
97
- required_ruby_version: !ruby/object:Gem::Requirement
107
+ required_ruby_version: !ruby/object:Gem::Requirement
98
108
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
106
- required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
114
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
113
- - 0
114
- version: "0"
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
115
119
  requirements: []
116
-
117
120
  rubyforge_project:
118
- rubygems_version: 1.3.7
121
+ rubygems_version: 1.8.23
119
122
  signing_key:
120
123
  specification_version: 3
121
- summary: Syntax sugar for Resque consumers. Each consumer is a class, with clean interface, and custom logger. Usefull when count of different events ~100 and more.
124
+ summary: Syntax sugar for Resque consumers. Each consumer is a class, with clean interface,
125
+ and custom logger. Usefull when count of different events ~100 and more.
122
126
  test_files: []
123
-