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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION +1 -1
  3. data/lib/multi_scheduler.rb +14 -13
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWNjNDFkNjUyMDllOWI0MWNjNDY4YmI0Njg1YTU4OGVlNDFhNDYwYg==
4
+ YTg3OTJlZjQxNzc0M2IzYTQ2MGI2YTUzYWU5MWM4OWE1ODc4NGJlYw==
5
5
  data.tar.gz: !binary |-
6
- ZjhhMTY0NzU2ZjNmNDc3YzZmZmI0ZTE1NWRhODNhYmNjMTJiZDhmZg==
6
+ NDRmN2E4MjJhYmEzMzcxZGIxYTAwNTY2ZWI3ZGQwMzA2MGE5NmQ4Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDYwNDk3M2ZjY2Y1MmU0ZDZmYmI4NWJhNGQyYTI1NzQ3YmExZmYwMDRmZmEx
10
- MjRiMzlkMmY2OTE0MWZiNGJhMWI3ZmY0MDgxNmY2ZDhhYzE4MjBlZTczMzM0
11
- YTM5MTU3MmMyYWU2MGU5ZDE2NWVlOTk3NTA2MTJlMDQ5N2ZmNWU=
9
+ N2RmNzdjNGMyMWVhOGM0MTA5ZTllMmRmZGIwN2QyMzA1M2Y0ZTRmMTg5OWUy
10
+ MWQxZDFiMTQ1NjY3MzM1YTYxZTk1MjZmYTUyMmM2NmU0NmJlYmMzOGNhYjRh
11
+ YTUzMjE3NDNhZDY4Y2E0YTRiMDljNjU0YTc5ZTA0ZTc3MmNmODc=
12
12
  data.tar.gz: !binary |-
13
- OWEyODIyMWI0OGY1YzQ3ZmFjNDc1ODc2ZWMzZjlhOWViYTYxYzg5MmJhMWEz
14
- Njg4ZDg5ZDhiMDhiZDkyNWNiYWFlOWQ3YzdlMTc3Yzk1MDQwNDNjNmIyMjE5
15
- YTUyOTI1ODRmMDUwYTRiOGFiZDk0MTQzYzA3YTFjNWE5NzE3Nzg=
13
+ YzlmNWZjYzgzNDQ0YzhmM2Q3YWI0ZjEzZDVjYWM0N2I2MDUxY2EzMzE5NzAy
14
+ OGMxMGU4ZWFiNzQ2ZjYyMjk1ZjRiMTU3NDY0OWYyMzQ0YjMwYWUxNDgxMDE0
15
+ MGMyNDM5MDE3ZmI5NmIzMDdkZmQ2OGRjYzdiZTIxZmRkNjc0ODI=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,35 +1,36 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module MultiScheduler
4
- VERSION = '0.1.0'
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({ identifier: id }).stop
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 = options[:id]
28
- raise ":id is required" unless @identifier
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlphaHydrae