runsible 0.1.4.3 → 0.1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/runsible.rb +15 -0
  4. data/runsible.gemspec +0 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d98266f134d55a614fb28d95ef94fd025cb748fa
4
- data.tar.gz: c003878d2bf6afc4c7a1dc095c0a08cf66306a6d
3
+ metadata.gz: 3c6e97e7684c0473f0b015ef7458fd181e3758aa
4
+ data.tar.gz: 0683c11734db25fb288d7c27ccc0ec15dfb607c1
5
5
  SHA512:
6
- metadata.gz: b6378116f873e96a2f421cf9ce9be3b999be0741bd99fb8d40f3501b55cf75049e7cdf49691840cc056ef9c68d3b21159ea5509f019ecb92949a47381fda0d02
7
- data.tar.gz: 733f030f5f7b692a090f9e47dcf466533d6ba8a922f37c3d3f93550fd881937b48b8605d1a147dd915a9b8197dd6e857dc3dbbcec71e3b42058137174c4a6d80
6
+ metadata.gz: ec0617e974d77b203aeb318c14c9ec132e1f3907cde4ef02b4e68185559d018931993eb33b7fb82bf630b0abc509e750ea749a6909d789df136eaa15180e8302
7
+ data.tar.gz: efea1d51af58e32a02ff17a49b85ecc8b29da012c47357245d681e78b053ea9c31cfc990355d575a4f3bffecf310d8044baaa772ab236a44316f1fd7c14977f9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4.3
1
+ 0.1.4.5
@@ -26,10 +26,12 @@ module Runsible
26
26
  # Utility stuff
27
27
  #
28
28
 
29
+ # provide a better string representation for all Exceptions
29
30
  def self.excp(excp)
30
31
  "#{excp.class}: #{excp.message}"
31
32
  end
32
33
 
34
+ # return SETTINGS with string keys
33
35
  def self.default_settings
34
36
  hsh = {}
35
37
  SETTINGS.each { |sym, v|
@@ -38,10 +40,12 @@ module Runsible
38
40
  hsh
39
41
  end
40
42
 
43
+ # read VERSION from filesystem
41
44
  def self.version
42
45
  File.read(File.join(__dir__, '..', 'VERSION'))
43
46
  end
44
47
 
48
+ # send alert depending on settings['alerts']['backend']
45
49
  def self.alert(topic, message, settings)
46
50
  backend = settings['alerts'] && settings['alerts']['backend']
47
51
  case backend
@@ -60,11 +64,13 @@ module Runsible
60
64
  end
61
65
  end
62
66
 
67
+ # send warnings to both STDOUT and STDERR
63
68
  def self.warn(msg)
64
69
  $stdout.puts msg
65
70
  $stderr.puts msg
66
71
  end
67
72
 
73
+ # warn, alert, exit 1
68
74
  def self.die!(msg, settings)
69
75
  self.warn(msg)
70
76
  self.alert("runsible:fatal:#{Process.pid}", msg, settings)
@@ -85,6 +91,7 @@ module Runsible
85
91
  self.ssh_runlist(settings, yaml['runlist'] || Array.new, ssh_options, yaml)
86
92
  end
87
93
 
94
+ # parse CLI arguments
88
95
  def self.slop_parse
89
96
  d = SETTINGS # display defaults
90
97
  Slop.parse do |o|
@@ -109,6 +116,7 @@ module Runsible
109
116
  end
110
117
  end
111
118
 
119
+ # load yaml from CLI arguments
112
120
  def self.extract_yaml(opts)
113
121
  yaml_filename = opts.arguments.shift
114
122
  self.usage(opts, "yaml_file is required") if yaml_filename.nil?
@@ -121,6 +129,7 @@ module Runsible
121
129
  yaml
122
130
  end
123
131
 
132
+ # provide a friendly message for the user
124
133
  def self.usage(opts, msg=nil)
125
134
  puts opts
126
135
  puts
@@ -234,6 +243,8 @@ module Runsible
234
243
  # Necessities
235
244
  #
236
245
 
246
+ # opts has symbol keys, overrides settings (string keys)
247
+ # return a hash with string keys
237
248
  def self.merge(opts, settings)
238
249
  Runsible::SETTINGS.keys.each { |sym|
239
250
  settings[sym.to_s] = opts[sym] if opts[sym]
@@ -242,18 +253,22 @@ module Runsible
242
253
  settings
243
254
  end
244
255
 
256
+ # delimits the beginning of command output
245
257
  def self.begin_banner(msg)
246
258
  "RUNSIBLE >>> [#{self.timestamp}] >>> #{msg} >>>>>"
247
259
  end
248
260
 
261
+ # delimits the end of command output
249
262
  def self.end_banner(msg)
250
263
  "<<<<< #{msg} <<< [#{self.timestamp}] <<< RUNSIBLE"
251
264
  end
252
265
 
266
+ # self-explanatory
253
267
  def self.timestamp(t = Time.now)
254
268
  t.strftime("%b%d %H:%M:%S")
255
269
  end
256
270
 
271
+ # display begin/end banners, yielding to the block in between
257
272
  def self.banner_wrap(msg)
258
273
  self.warn self.begin_banner(msg)
259
274
  val = block_given? ? yield : true
@@ -21,6 +21,4 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency 'pony', '~> 1.0'
22
22
 
23
23
  s.add_development_dependency 'buildar', '~> 2.0'
24
-
25
- s.has_rdoc = false
26
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runsible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.3
4
+ version: 0.1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Hull