multi_scheduler 0.1.0 → 0.1.1
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 +8 -8
- data/VERSION +1 -1
- data/lib/multi_scheduler.rb +14 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTg3OTJlZjQxNzc0M2IzYTQ2MGI2YTUzYWU5MWM4OWE1ODc4NGJlYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDRmN2E4MjJhYmEzMzcxZGIxYTAwNTY2ZWI3ZGQwMzA2MGE5NmQ4Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2RmNzdjNGMyMWVhOGM0MTA5ZTllMmRmZGIwN2QyMzA1M2Y0ZTRmMTg5OWUy
|
10
|
+
MWQxZDFiMTQ1NjY3MzM1YTYxZTk1MjZmYTUyMmM2NmU0NmJlYmMzOGNhYjRh
|
11
|
+
YTUzMjE3NDNhZDY4Y2E0YTRiMDljNjU0YTc5ZTA0ZTc3MmNmODc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzlmNWZjYzgzNDQ0YzhmM2Q3YWI0ZjEzZDVjYWM0N2I2MDUxY2EzMzE5NzAy
|
14
|
+
OGMxMGU4ZWFiNzQ2ZjYyMjk1ZjRiMTU3NDY0OWYyMzQ0YjMwYWUxNDgxMDE0
|
15
|
+
MGMyNDM5MDE3ZmI5NmIzMDdkZmQ2OGRjYzdiZTIxZmRkNjc0ODI=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/multi_scheduler.rb
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module MultiScheduler
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.1'
|
5
5
|
|
6
|
-
def schedule options = {}
|
7
|
-
scheduler(options).start
|
6
|
+
def self.schedule id, options = {}
|
7
|
+
scheduler(id, options).start
|
8
8
|
end
|
9
9
|
|
10
|
-
def unschedule id
|
11
|
-
scheduler(
|
10
|
+
def self.unschedule id, options = {}
|
11
|
+
scheduler(id, options).stop
|
12
12
|
end
|
13
13
|
|
14
|
-
def scheduler options = {}
|
14
|
+
def self.scheduler id, options = {}
|
15
15
|
case RbConfig::CONFIG['host_os']
|
16
16
|
when /darwin/i
|
17
|
-
Launchd.new options
|
17
|
+
Launchd.new id, options
|
18
18
|
else
|
19
|
-
Whenever.new options
|
19
|
+
Whenever.new id, options
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
private
|
24
|
+
|
23
25
|
class Scheduler
|
24
26
|
|
25
|
-
def initialize options = {}
|
27
|
+
def initialize id, options = {}
|
26
28
|
|
27
|
-
@identifier =
|
28
|
-
raise "
|
29
|
+
@identifier = id
|
30
|
+
raise "identifier is required" unless @identifier
|
29
31
|
|
30
|
-
@command_arguments = options[:args]
|
32
|
+
@command_arguments = [ options[:args] ].flatten.compact
|
31
33
|
@command = options[:command] || @command_arguments.shift
|
32
|
-
raise ":command is required" unless @command
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|