resque_ranger 1.0.0.alpha.1 → 1.0.0.alpha.2

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWUyYTZmNjdlYTQwZGIwM2NmODc3MWZiYzU0NTUyMzkxNjEwMzU4ZA==
4
+ MmM4YjkyMDNlOGM1MjhkNWI1ODNkNmE2OTQ3MDI4ODlmNWYxN2RjMw==
5
5
  data.tar.gz: !binary |-
6
- ZjZkMmQ3NjE4MzA3NDllYTEzNjFmZDZhNDYwZGNmNzI3NGEyNzIxYQ==
6
+ NTg3ZTU2NWJiYWEzNmM0NzEyMmM5Y2NlMzg4MTRkZjRlYjY5ZTRlMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWFiODZmZTRjZWZlZjhjOTI1ODVjNDgyYmZjOGQ2NDY5M2Q4NjZmNmVmYjY4
10
- Mjc0NjgxMTBlMTNmODMyNjJkOTJiY2UwZDg0ODk4YmQzZWU0NWNjOTYxM2Vl
11
- ZGI0OWJjNmJjNWQzOTg3OTU3MjE4YzFkNWYxZmFhZDdhNGFhY2Y=
9
+ NWIxOWNhNWY5MDA5OTk5YWQwZDNjYWI3Nzc5ZjI3NzQ3NzM4NTlkOTk5NTI3
10
+ ODQzNTdkZjk0YTk4MGE4NzQwOGY5NWM3OWRiMTZiNGUwN2Y5NzBmOTUwODcx
11
+ OTVjZDk1Nzc1MzIxMWMxMTk3OWZjZjhkMjVjMDg2ZmQ4Y2ZmZTg=
12
12
  data.tar.gz: !binary |-
13
- MDE5YTVhYWRmZWY5ZDI3MzMwNjk2Y2RjODliOTM2YTc3OGYyYjFmYTM3Y2E5
14
- OWE3OTI4NmJmMjg3NjJiYjM0OTcyY2QzOTc5NTkwOGZlMGRlMjdjYTgwN2Y4
15
- NzA2YmI4M2I2NDQ0MTAxNjA5NjczNmRhZWRkNjMxNzhkMWI2Y2I=
13
+ OTVjNjhjYTExOTRkNGIxZmE4NGRiMzFjZTU4ZjgzN2ZlZDY3NTVkMGFlOGI3
14
+ YWFhZmM4YTU0M2NkNGJhZjExZDZkZmU5YTE4ZjcyMGQxZWFkMTdmYWRjOGI2
15
+ OGZmMzgzOGEyYjdkNTE1NjdmOGZkYWFjNzZhMzE2YWI3ZTAzNzI=
@@ -0,0 +1,3 @@
1
+
2
+ require 'resque_ranger/core'
3
+
@@ -0,0 +1,41 @@
1
+ require 'resque'
2
+
3
+ module ResqueRanger
4
+
5
+ def self.queues
6
+ Resque.queues.map do |q|
7
+ Queue.new(name: q)
8
+ end
9
+ end
10
+
11
+
12
+ class Queue
13
+
14
+ attr_reader :name, :redis
15
+
16
+ def initialize(options = {})
17
+ @name = options.fetch(:name)
18
+ @redis = options.fetch(:redis, Resque.redis)
19
+ end
20
+
21
+ def formal_name
22
+ "queue:#{name}"
23
+ end
24
+
25
+ def size
26
+ redis.llen(formal_name)
27
+ end
28
+
29
+ def purge
30
+ redis.del(formal_name)
31
+ end
32
+
33
+
34
+ def to_s
35
+ name
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
@@ -0,0 +1,36 @@
1
+ require 'resque_ranger/core'
2
+
3
+ require 'rake'
4
+
5
+ module ResqueRanger::Rake
6
+ extend Rake::DSL
7
+
8
+
9
+ # Creates the ResqueRanger tasks inside of the default
10
+ # 'queues' namespace
11
+ def self.default!
12
+ namespace :queues do
13
+ create_tasks!
14
+ end
15
+ end
16
+
17
+
18
+ def self.create_tasks!
19
+ desc "Displays the number of items in each queue"
20
+ task :size => :"resque:setup" do
21
+ ResqueRanger.queues.each do |q|
22
+ puts "#{ q.name.inspect } --> #{ q.size }"
23
+ end
24
+ end
25
+
26
+ desc "Deletes all items from each queue"
27
+ task :purge => :"resque:setup" do
28
+ ResqueRanger.queues.each do |q|
29
+ puts "Purging #{ q.name.inspect } (#{ q.size } --> 0)"
30
+ end
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_ranger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.1
4
+ version: 1.0.0.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lauber
@@ -9,13 +9,30 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-12-11 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: resque
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.25'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.25'
13
27
  description: Rake tasks and such for Resque
14
28
  email: constructible.truth@gmail.com
15
29
  executables: []
16
30
  extensions: []
17
31
  extra_rdoc_files: []
18
- files: []
32
+ files:
33
+ - lib/resque_ranger/core.rb
34
+ - lib/resque_ranger/rake.rb
35
+ - lib/resque_ranger.rb
19
36
  homepage:
20
37
  licenses:
21
38
  - MIT