Module: Makesure
- Extended by:
- Makesure
- Included in:
- Makesure
- Defined in:
- lib/makesure.rb,
lib/makesure/cmd.rb,
lib/makesure/cron.rb,
lib/makesure/runner.rb,
lib/makesure/system.rb,
lib/makesure/verify.rb,
lib/makesure/version.rb,
lib/makesure/summarize.rb
Defined Under Namespace
Modules: Version
Classes: Cmd, Cron, Runner, Summarize, System, Verify
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#alert_options ⇒ Object
19
20
21
|
# File 'lib/makesure.rb', line 19
def alert_options
@alert_options
end
|
#log_level ⇒ Object
19
20
21
|
# File 'lib/makesure.rb', line 19
def log_level
@log_level
end
|
#systems ⇒ Object
56
57
58
|
# File 'lib/makesure.rb', line 56
def systems
@systems
end
|
#uid ⇒ Object
19
20
21
|
# File 'lib/makesure.rb', line 19
def uid
@uid
end
|
Instance Method Details
#debug(msg) ⇒ Object
75
76
77
|
# File 'lib/makesure.rb', line 75
def debug(msg)
log(msg, :debug) if log_level == :debug
end
|
#load_system_defs ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/makesure.rb', line 27
def load_system_defs
file = makesurefile
Makesure.log("Loading Makesurefile")
load(file)
abort "No system specifications found" unless Makesure.systems.size > 0
Makesure.log "Loaded #{Makesure.systems.size} system specifications"
rescue Exception => e
if e.instance_of?(SystemExit)
raise
else
Makesure.warn "There was an error loading #{file}"
Makesure.warn "\t" + e.message
Makesure.warn "\t" + e.backtrace.join("\n\t")
abort "Couldn't load your Makesurefile"
end
end
|
#log(msg, level = :info) ⇒ Object
67
68
69
|
# File 'lib/makesure.rb', line 67
def log(msg, level = :info)
puts "[#{Time.now.to_s}] #{level.to_s.upcase}: #{msg}"
end
|
#makesurefile ⇒ Object
23
24
25
|
# File 'lib/makesure.rb', line 23
def makesurefile
File.expand_path(File.join(Dir.pwd, "Makesurefile"))
end
|
#send_alert(title, details = "") ⇒ Object
48
49
50
51
52
|
# File 'lib/makesure.rb', line 48
def send_alert(title, details = "")
opts = { :from => "makesure@unknown" }.merge(Makesure.alert_options)
Makesure.log "Sending alert to #{opts[:to]}: #{title}"
msg = Pony.mail(opts.merge(:subject => title, :body => details))
end
|
#system(name) {|s| ... } ⇒ Object
58
59
60
61
62
63
|
# File 'lib/makesure.rb', line 58
def system(name)
Makesure.debug "Reading specification for system '#{name}'"
s = Makesure::System.new(name)
yield s
@systems << s
end
|
#system_with_name(name) ⇒ Object
44
45
46
|
# File 'lib/makesure.rb', line 44
def system_with_name(name)
systems.find { |s| s.name.to_s == name.to_s }
end
|
#warn(msg) ⇒ Object
71
72
73
|
# File 'lib/makesure.rb', line 71
def warn(msg)
log(msg, :warn)
end
|