resque-scheduler-status 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +17 -0
- data/Rakefile +4 -0
- data/lib/resque-scheduler-status.rb +1 -0
- data/lib/resque/plugins/scheduler_status.rb +68 -0
- data/resque-scheduler-status.gemspec +21 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f981ad863e0153319a077ef53d75673b179077c9
|
4
|
+
data.tar.gz: 58f8d5115dfef07a5ab4f0ee1f8e82de5acd1a8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 85dccd563eda6bdcb11e459fc9845a1a6ae68b301889b940d9efe2b0f4a42b25e6e647997aca847f106c81635fa895e04fd0f00f3426b0efff64a5f0a85939eb
|
7
|
+
data.tar.gz: e601482477db7a17a2ae9ed788a50c590b8995b753164509d0e9e77dd54e0b1c69bf54375486745caa9a4fb1aa71b894b47728c9e1dd77d33430963572d14777
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/resque/plugins/scheduler_status"
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Resque
|
2
|
+
module Plugins
|
3
|
+
module SchedulerStatus
|
4
|
+
|
5
|
+
VERSION = '0.0.1'
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
|
13
|
+
def create(options = {})
|
14
|
+
self.enqueue(self, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def enqueue(klass, options = {})
|
18
|
+
uuid = Resque::Plugins::Status::Hash.generate_uuid
|
19
|
+
self.enqueue_to(Resque.queue_from_class(klass) || queue, klass, uuid, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def enqueue_to(queue, klass, uuid, options = {})
|
23
|
+
Resque::Plugins::Status::Hash.create uuid, :options => options
|
24
|
+
|
25
|
+
if Resque.enqueue_to(queue, klass, uuid, options)
|
26
|
+
uuid
|
27
|
+
else
|
28
|
+
Resque::Plugins::Status::Hash.remove(uuid)
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_in(number_of_seconds_from_now, options = {})
|
34
|
+
self.enqueue_in(number_of_seconds_from_now, self, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_at(timestamp, options = {})
|
38
|
+
self.enqueue_at(timestamp, self, options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def enqueue_in(number_of_seconds_from_now, klass, options = ())
|
42
|
+
self.enqueue_at(Time.now + number_of_seconds_from_now, klass, options)
|
43
|
+
end
|
44
|
+
|
45
|
+
def enqueue_at(timestamp, klass, options = {})
|
46
|
+
uuid = Resque::Plugins::Status::Hash.generate_uuid
|
47
|
+
self.enqueue_at_with_queue(Resque.queue_from_class(klass), timestamp, klass, uuid, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def enqueue_at_with_queue(queue, timestamp, klass, uuid, options = {})
|
51
|
+
Resque::Plugins::Status::Hash.create uuid, options: options
|
52
|
+
|
53
|
+
if Resque.enqueue_at_with_queue(queue, timestamp, klass, uuid, options)
|
54
|
+
uuid
|
55
|
+
else
|
56
|
+
Resque::Plugins::Status::Hash.remove(uuid)
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def scheduled(queue, klass, *args)
|
63
|
+
uuid, options = args
|
64
|
+
self.enqueue_to(queue, self, uuid, options)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
require 'resque/plugins/scheduler_status'
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'resque-scheduler-status'
|
6
|
+
spec.version = Resque::Plugins::SchedulerStatus::VERSION
|
7
|
+
spec.authors = ['Kamil Kieliszczyk']
|
8
|
+
spec.email = ['kamil@kieliszczyk.net']
|
9
|
+
spec.description = ''
|
10
|
+
spec.summary = spec.description
|
11
|
+
spec.homepage = 'https://github.com/kiela/resque-scheduler-status'
|
12
|
+
|
13
|
+
spec.platform = Gem::Platform::RUBY
|
14
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque-scheduler-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kamil Kieliszczyk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- kamil@kieliszczyk.net
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- Gemfile.lock
|
36
|
+
- Rakefile
|
37
|
+
- lib/resque-scheduler-status.rb
|
38
|
+
- lib/resque/plugins/scheduler_status.rb
|
39
|
+
- resque-scheduler-status.gemspec
|
40
|
+
homepage: https://github.com/kiela/resque-scheduler-status
|
41
|
+
licenses: []
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.3.6
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.2.2
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: ''
|
63
|
+
test_files: []
|