multi_scheduler 0.1.1 → 0.1.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
- YTg3OTJlZjQxNzc0M2IzYTQ2MGI2YTUzYWU5MWM4OWE1ODc4NGJlYw==
4
+ ZDY0NDIwNmEzMjJmYjYzMTVhMzM3Y2MxYmIzZjAxYTI0MjQ5Zjk2Mg==
5
5
  data.tar.gz: !binary |-
6
- NDRmN2E4MjJhYmEzMzcxZGIxYTAwNTY2ZWI3ZGQwMzA2MGE5NmQ4Zg==
6
+ MDc0NGM4NDhmZDAzYTUyMzczZWM0MGJhOGYxYTQ2M2I2MzE5MjVjNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2RmNzdjNGMyMWVhOGM0MTA5ZTllMmRmZGIwN2QyMzA1M2Y0ZTRmMTg5OWUy
10
- MWQxZDFiMTQ1NjY3MzM1YTYxZTk1MjZmYTUyMmM2NmU0NmJlYmMzOGNhYjRh
11
- YTUzMjE3NDNhZDY4Y2E0YTRiMDljNjU0YTc5ZTA0ZTc3MmNmODc=
9
+ OWE2YjQxOTE0OWIzYjAyMjgyYmU4OTk5OTliY2MyYTVjZGVhMzkyNzY5OGY2
10
+ MjlkZDM3MWFjNTlhZGUyMTg0YjMyMzRmNGI5YTk4MmVjNDI4ZGU4NzE0MmM0
11
+ ODM5OGJmZGIxOTQ0NzZmN2UwZDI4N2JkODY5OTUwYzAzYTU0YmU=
12
12
  data.tar.gz: !binary |-
13
- YzlmNWZjYzgzNDQ0YzhmM2Q3YWI0ZjEzZDVjYWM0N2I2MDUxY2EzMzE5NzAy
14
- OGMxMGU4ZWFiNzQ2ZjYyMjk1ZjRiMTU3NDY0OWYyMzQ0YjMwYWUxNDgxMDE0
15
- MGMyNDM5MDE3ZmI5NmIzMDdkZmQ2OGRjYzdiZTIxZmRkNjc0ODI=
13
+ OTA4ZjQ0ZGY0MzliNDE0MzgwOTI0OGZlYTNhOTQwZWRjNTNiYzUzMGM0M2I1
14
+ N2VhODdmNTIxZDE4ZThmMWIxMTBjMDQzZGMxYzdkYWFmOTllZDgxZmE0NzZm
15
+ MjM3YWIwNzUyYTI0YWEzNzFkMDM4Yjc3NGZmODlkYmMzMTAyODM=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,36 +1,17 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module MultiScheduler
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
 
6
6
  def self.schedule id, options = {}
7
- scheduler(id, options).start
8
- end
9
-
10
- def self.unschedule id, options = {}
11
- scheduler(id, options).stop
12
- end
13
-
14
- def self.scheduler id, options = {}
15
- case RbConfig::CONFIG['host_os']
7
+ host_os = RbConfig::CONFIG['host_os']
8
+ case host_os
16
9
  when /darwin/i
17
10
  Launchd.new id, options
18
- else
11
+ when /linux/i
19
12
  Whenever.new id, options
20
- end
21
- end
22
-
23
- private
24
-
25
- class Scheduler
26
-
27
- def initialize id, options = {}
28
-
29
- @identifier = id
30
- raise "identifier is required" unless @identifier
31
-
32
- @command_arguments = [ options[:args] ].flatten.compact
33
- @command = options[:command] || @command_arguments.shift
13
+ else
14
+ raise "Unsupported host operating system '#{host_os}'"
34
15
  end
35
16
  end
36
17
  end
@@ -0,0 +1,19 @@
1
+
2
+ module MultiScheduler
3
+
4
+ class Schedule
5
+ attr_reader :identifier, :command, :command_arguments
6
+
7
+ def initialize id, options = {}
8
+
9
+ @identifier = id
10
+ raise "identifier is required" unless @identifier
11
+
12
+ @command_arguments = [ options[:args] ].flatten.compact
13
+ @command = options[:command] || @command_arguments.shift
14
+ raise "command is required" unless @command
15
+ end
16
+ end
17
+ end
18
+
19
+ Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }
@@ -3,7 +3,7 @@ require 'fileutils'
3
3
 
4
4
  module MultiScheduler
5
5
 
6
- class Launchd < Scheduler
6
+ class Launchd < Schedule
7
7
 
8
8
  def start
9
9
  stop
@@ -2,7 +2,7 @@
2
2
 
3
3
  module MultiScheduler
4
4
 
5
- class Whenever < Scheduler
5
+ class Whenever < Schedule
6
6
 
7
7
  def start
8
8
  raise 'Not yet implemented on this operating system'
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlphaHydrae
@@ -150,8 +150,9 @@ files:
150
150
  - README.md
151
151
  - VERSION
152
152
  - lib/multi_scheduler.rb
153
- - lib/multi_scheduler/launchd.rb
154
- - lib/multi_scheduler/whenever.rb
153
+ - lib/multi_scheduler/schedule.rb
154
+ - lib/multi_scheduler/schedule/launchd.rb
155
+ - lib/multi_scheduler/schedule/whenever.rb
155
156
  homepage: http://github.com/AlphaHydrae/multi_scheduler
156
157
  licenses:
157
158
  - MIT