makesure 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
- = makesure
1
+ = Makesure
2
2
 
3
- Description goes here.
3
+ Makesure is a set of tools to define, verify and monitor systems in a unix environment. It allows you to schedule commands that constitue a system via cron (and monitors the execution of those commands), it gives you a way to verify the state of a system (and alerts you when there are problems), and it provides a simple mechanism for collecting statistics about that system.
4
4
 
5
5
  == Contributing to makesure
6
6
 
@@ -6,6 +6,7 @@ require 'makesure'
6
6
  require 'optparse'
7
7
 
8
8
  cron_path = '/etc/cron.d/makesure.cron'
9
+ rvm = false
9
10
 
10
11
  parser = OptionParser.new do |opts|
11
12
  opts.banner = "Usage: makesure [options] COMMAND"
@@ -17,6 +18,10 @@ parser = OptionParser.new do |opts|
17
18
  cron_path = path
18
19
  end
19
20
 
21
+ opts.on("-r", "--[no-]rvm", "Whether or not Makesure should wrap the commands in its cron file for use with RVM") do |r|
22
+ rvm = r
23
+ end
24
+
20
25
  opts.on("-h", "--help", "Show this message") do
21
26
  puts opts
22
27
  exit
@@ -28,7 +33,7 @@ parser = OptionParser.new do |opts|
28
33
  opts.separator " update Updates cron with commands scheduled by your system definitions"
29
34
  end
30
35
 
31
- parser.parse!
36
+ parser.parse!(ARGV)
32
37
 
33
38
  case ARGV[0]
34
39
  when 'init'
@@ -71,7 +76,7 @@ FILE
71
76
  end
72
77
  when 'update'
73
78
  Makesure.load_system_defs
74
- Makesure::Cron.new(:cron_path => cron_path)
79
+ Makesure::Cron.new(:cron_path => cron_path, :rvm => rvm)
75
80
  else
76
81
  puts parser.help
77
82
  end
@@ -5,13 +5,14 @@ module Makesure
5
5
  # specify a file (or directory containing files) to load system specifications from
6
6
  def initialize(opts = {})
7
7
  opts = {
8
- :cron_path => "/etc/cron.d/makesure.cron"
8
+ :cron_path => "/etc/cron.d/makesure.cron",
9
+ :rvm => false
9
10
  }.merge(opts)
10
11
 
11
12
  Makesure.log "updating '#{opts[:cron_path]}'"
12
13
 
13
14
  cron_file = File.expand_path(opts[:cron_path])
14
- crontab = build_crontab_output
15
+ crontab = build_crontab_output(opts)
15
16
  Makesure.debug "#{cron_file}:\n#{crontab}"
16
17
 
17
18
  File.open(cron_file, "w") do |f|
@@ -19,7 +20,7 @@ module Makesure
19
20
  end
20
21
  end
21
22
 
22
- def build_crontab_output
23
+ def build_crontab_output(opts)
23
24
  chdir = Makesure.chdir || File.dirname(Makesure.makesurefile)
24
25
  crontab = ""
25
26
  crontab << "# Autogenerated by makesure: you probably don't want to edit this file\n\n"
@@ -35,14 +36,29 @@ module Makesure
35
36
  crontab << "#{c.cron}\t"
36
37
  crontab << "#{uid} " if uid
37
38
  crontab << "cd #{chdir} && "
38
- crontab << "makesure-runner run #{c.command.inspect}\n"
39
+
40
+ cmd = "makesure-runner run #{c.command.inspect}"
41
+ crontab << if (opts[:rvm])
42
+ "/bin/bash -l -c '#{cmd}'"
43
+ else
44
+ cmd
45
+ end
46
+ crontab << "\n"
39
47
  end
48
+
40
49
  crontab << "# Verification\n"
41
50
  s.verifies.each do |v|
42
51
  crontab << "#{v.cron}\t"
43
52
  crontab << "#{uid} " if uid
44
53
  crontab << "cd #{chdir} && "
45
- crontab << "makesure-runner verify #{s.name} #{v.name}\n"
54
+
55
+ cmd = "makesure-runner verify #{s.name} #{v.name}"
56
+ crontab << if (opts[:rvm])
57
+ "/bin/bash -l -c '#{cmd}'"
58
+ else
59
+ cmd
60
+ end
61
+ crontab << "\n"
46
62
  end
47
63
  # TODO summarizes
48
64
  end
@@ -2,7 +2,7 @@ module Makesure
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 5
5
+ PATCH = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{makesure}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eric Waller"]
12
- s.date = %q{2011-02-28}
12
+ s.date = %q{2011-05-05}
13
13
  s.description = %q{Makesure is a set of tools to define, verify and monitor systems in a unix environment. It allows you to schedule commands that constitue a system via cron (and monitors the execution of those commands), it gives you a way to verify the state of a system (and alerts you when there are problems), and it provides a simple mechanism for collecting statistics about that system.}
14
14
  s.email = %q{eric@seatgeek.com}
15
15
  s.executables = ["makesure", "makesure-runner"]
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.homepage = %q{http://github.com/seatgeek/makesure}
44
44
  s.licenses = ["MIT"]
45
45
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.7}
46
+ s.rubygems_version = %q{1.5.0}
47
47
  s.summary = %q{Continuous (Production) Verification: Define and Monitor Systems in Ruby}
48
48
  s.test_files = [
49
49
  "test/helper.rb",
@@ -51,7 +51,6 @@ Gem::Specification.new do |s|
51
51
  ]
52
52
 
53
53
  if s.respond_to? :specification_version then
54
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
55
54
  s.specification_version = 3
56
55
 
57
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makesure
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 5
9
- version: 0.0.5
4
+ prerelease:
5
+ version: 0.0.6
10
6
  platform: ruby
11
7
  authors:
12
8
  - Eric Waller
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-02-28 00:00:00 -05:00
13
+ date: 2011-05-05 00:00:00 -04:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -24,9 +20,6 @@ dependencies:
24
20
  requirements:
25
21
  - - ">="
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
23
  version: "1.0"
31
24
  type: :runtime
32
25
  prerelease: false
@@ -38,8 +31,6 @@ dependencies:
38
31
  requirements:
39
32
  - - ">="
40
33
  - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
34
  version: "0"
44
35
  type: :development
45
36
  prerelease: false
@@ -51,10 +42,6 @@ dependencies:
51
42
  requirements:
52
43
  - - ~>
53
44
  - !ruby/object:Gem::Version
54
- segments:
55
- - 1
56
- - 0
57
- - 0
58
45
  version: 1.0.0
59
46
  type: :development
60
47
  prerelease: false
@@ -66,10 +53,6 @@ dependencies:
66
53
  requirements:
67
54
  - - ~>
68
55
  - !ruby/object:Gem::Version
69
- segments:
70
- - 1
71
- - 5
72
- - 2
73
56
  version: 1.5.2
74
57
  type: :development
75
58
  prerelease: false
@@ -81,8 +64,6 @@ dependencies:
81
64
  requirements:
82
65
  - - ">="
83
66
  - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
67
  version: "0"
87
68
  type: :development
88
69
  prerelease: false
@@ -94,9 +75,6 @@ dependencies:
94
75
  requirements:
95
76
  - - ">="
96
77
  - !ruby/object:Gem::Version
97
- segments:
98
- - 1
99
- - 0
100
78
  version: "1.0"
101
79
  type: :runtime
102
80
  prerelease: false
@@ -147,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
125
  requirements:
148
126
  - - ">="
149
127
  - !ruby/object:Gem::Version
150
- hash: 611779293
128
+ hash: -1531056845273534742
151
129
  segments:
152
130
  - 0
153
131
  version: "0"
@@ -156,13 +134,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
134
  requirements:
157
135
  - - ">="
158
136
  - !ruby/object:Gem::Version
159
- segments:
160
- - 0
161
137
  version: "0"
162
138
  requirements: []
163
139
 
164
140
  rubyforge_project:
165
- rubygems_version: 1.3.7
141
+ rubygems_version: 1.5.0
166
142
  signing_key:
167
143
  specification_version: 3
168
144
  summary: "Continuous (Production) Verification: Define and Monitor Systems in Ruby"