ebm 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA512:
3
- metadata.gz: 5a51322fa4f1dd04b5df1fbe05f5b43365627b15600f45791be45260277396921a7987aee15b49e48dcf6f3e696508d32afac89fac8b4d8936f27dc648879d21
4
- data.tar.gz: 0effc84cefbf5ee888f4297e7bbb82bd9f49bc77c6ddc328b5ee11bb60f6e57ad4e95d3cd0be242890fd4afedaef2e779ceabcb8c9e7f0b2991ddfbefeba2915
5
2
  SHA1:
6
- metadata.gz: 0c37610db29f0af7f753745d1c06946d374aa94e
7
- data.tar.gz: e61e3bdfda2704ddf9b226f0b987b81c07ebfae9
3
+ metadata.gz: 223f7a32ac701e393907dd0909e1cf49734bea4c
4
+ data.tar.gz: 843ea1460f7e9c9e303b292bfce13abce04f5d2a
5
+ SHA512:
6
+ metadata.gz: fac82fb82f1835d6d85c33a87ea4e20b37ff1a9bb711a8d02c98fd1dc24b6bb09928713ef11f6ad19e99a94d607d9608339d467eadb259b528a537bcd27215fa
7
+ data.tar.gz: 5468fddc39eea3ce2366f16e435325738c43423374d1e47ebba7695686854d5e8dd48bee762b048c44cab5596bba0f4094ee9cda0332d405931b63e4397fb226
@@ -0,0 +1,54 @@
1
+ #
2
+ # Greg Seitz
3
+ #
4
+ # Copyright 2013, eBay Inc.
5
+ # All rights reserved.
6
+ # http://www.ebay.com
7
+ #
8
+ module Commands
9
+ class Periodic
10
+
11
+ # holds the options that were passed
12
+ # you can set any initial defaults here
13
+ def options
14
+ @options ||= {
15
+ }
16
+ end
17
+
18
+ # required options
19
+ def required_options
20
+ @required_options ||= Set.new [
21
+ :command,
22
+ :interval
23
+ ]
24
+ end
25
+
26
+ def register(opts, global_options)
27
+ opts.banner = "Usage: periodic [options]"
28
+ opts.description = "Run a periodic command"
29
+
30
+ opts.on('-c', "--command name", "Required - Command to run.") do |v|
31
+ options[:command] = v
32
+ end
33
+
34
+ opts.on('-i', "--interval value", Integer, "Required - Interval in seconds.") do |v|
35
+ options[:interval] = v
36
+ end
37
+
38
+ end
39
+
40
+ def run(global_options)
41
+
42
+ # see if we can open the config file - we append the .config suffix
43
+ # the file is expected to be in JSON format
44
+ command = options[:command]
45
+ interval = options[:interval]
46
+
47
+ while true
48
+ EbmSharedLib::CL.do_cmd_result(command)
49
+ sleep(interval)
50
+ end
51
+ end
52
+
53
+ end
54
+ end
data/lib/commands.rb CHANGED
@@ -19,3 +19,4 @@ require 'commands/list_configs'
19
19
  require 'commands/make_sample'
20
20
  require 'commands/tag'
21
21
  require 'commands/status'
22
+ require 'commands/periodic'
data/lib/ebm.rb CHANGED
@@ -48,6 +48,7 @@ class Ebm
48
48
  sub_commands[:make_sample] = Commands::MakeSample.new
49
49
  sub_commands[:tag] = Commands::Tag.new
50
50
  sub_commands[:status] = Commands::Status.new
51
+ sub_commands[:periodic] = Commands::Periodic.new
51
52
  end
52
53
 
53
54
  def setup
data/lib/info.rb CHANGED
@@ -7,6 +7,6 @@
7
7
  #
8
8
  class Info
9
9
  def self.version
10
- "0.0.8"
10
+ "0.0.9"
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Seitz
@@ -52,6 +52,7 @@ extra_rdoc_files: []
52
52
  files:
53
53
  - lib/commands/list_configs.rb
54
54
  - lib/commands/make_sample.rb
55
+ - lib/commands/periodic.rb
55
56
  - lib/commands/prepare.rb
56
57
  - lib/commands/status.rb
57
58
  - lib/commands/tag.rb