jobmanager 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/FAQ.txt +151 -0
- data/History.txt +2 -0
- data/LICENSE +20 -0
- data/Manifest.txt +42 -0
- data/README.txt +395 -0
- data/Rakefile +17 -0
- data/bin/jobmanager +20 -0
- data/examples/email_settings.rb +14 -0
- data/examples/example.rb +23 -0
- data/examples/jobmanager.yaml +66 -0
- data/examples/mysql_backup.rb +18 -0
- data/lib/jobmanager.rb +1 -0
- data/lib/jobmanager/application.rb +455 -0
- data/lib/jobmanager/applicationconfig.rb +89 -0
- data/lib/jobmanager/applicationlogger.rb +306 -0
- data/lib/jobmanager/applicationoptionparser.rb +163 -0
- data/lib/jobmanager/system.rb +240 -0
- data/lib/jobmanager/teestream.rb +78 -0
- data/lib/jobmanager/util.rb +25 -0
- data/test/configs/all_values.yaml +33 -0
- data/test/configs/bad_email_condition.yaml +7 -0
- data/test/configs/bad_no_central_log_file.yaml +7 -0
- data/test/configs/bad_number_of_job_logs.yaml +7 -0
- data/test/configs/bad_timeout_zero.yaml +7 -0
- data/test/configs/email_settings.rb +16 -0
- data/test/configs/incomplete_1.yaml +23 -0
- data/test/configs/jobmanager_1.yaml +9 -0
- data/test/configs/jobmanager_2.yaml +11 -0
- data/test/configs/jobmanager_3.yaml +13 -0
- data/test/configs/jobmanager_4_bad_central_log_file.yaml +9 -0
- data/test/configs/jobmanager_4_bad_email_settings_file.yaml +9 -0
- data/test/configs/jobmanager_4_bad_job_logs_directory_1.yaml +9 -0
- data/test/configs/jobmanager_4_bad_job_logs_directory_2.yaml +9 -0
- data/test/configs/minimum_plus_email_settings.yaml +9 -0
- data/test/configs/minimum_required.yaml +5 -0
- data/test/helpers.rb +7 -0
- data/test/mock_syslog.rb +68 -0
- data/test/test_applicationlogger.rb +145 -0
- data/test/test_config.rb +208 -0
- data/test/test_jobmanager.rb +443 -0
- data/test/test_system.rb +206 -0
- data/test/test_teestream.rb +55 -0
- metadata +172 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'stringio'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'relative'
|
8
|
+
|
9
|
+
require 'jobmanager/teestream'
|
10
|
+
|
11
|
+
require 'test/unit'
|
12
|
+
require_relative('helpers')
|
13
|
+
|
14
|
+
#
|
15
|
+
# This class tests the JobManager::TeeStream class.
|
16
|
+
#
|
17
|
+
|
18
|
+
class TestTeeStream < Test::Unit::TestCase
|
19
|
+
include TestHelpers
|
20
|
+
|
21
|
+
def setup
|
22
|
+
teardown()
|
23
|
+
|
24
|
+
Dir.mkdir(TEMP_DIR)
|
25
|
+
end
|
26
|
+
|
27
|
+
def teardown
|
28
|
+
FileUtils::rm_r(TEMP_DIR, :force => true)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_case
|
32
|
+
string_io = StringIO.new
|
33
|
+
|
34
|
+
file_name = File.join(TEMP_DIR, "output.dat")
|
35
|
+
file_stream = File.open(file_name, "w")
|
36
|
+
|
37
|
+
tee_stream = JobManager::TeeStream.new(:string_io => string_io,
|
38
|
+
:file_stream => file_stream)
|
39
|
+
|
40
|
+
tee_stream << "1\n2\n3\n"
|
41
|
+
tee_stream.puts "4"
|
42
|
+
tee_stream.print "5\n"
|
43
|
+
|
44
|
+
tee_stream.flush
|
45
|
+
tee_stream.close
|
46
|
+
|
47
|
+
str_string_io = string_io.string
|
48
|
+
str_file = IO.read(file_name)
|
49
|
+
expected = "1\n2\n3\n4\n5\n"
|
50
|
+
|
51
|
+
assert_equal(expected, str_string_io)
|
52
|
+
assert_equal(expected, str_file)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jobmanager
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- DesigningPatterns
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-08-06 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: simpleemail
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: configtoolkit
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "2.2"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: relative
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: logrotate
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: SyslogLogger
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: sys-host
|
67
|
+
type: :runtime
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: "0"
|
74
|
+
version:
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: hoe
|
77
|
+
type: :development
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.7.0
|
84
|
+
version:
|
85
|
+
description: "This package makes managing cron jobs on unix systems a breeze! It is composed of a single program, +jobmanager+, which is intended to be invoked by cron, or a cron-like application. +jobmanager+, in turn, invokes the specified cron job, in addition to providing the following added value: * Logs the output of the cron jobs. * Rotates the cron job logs. * Manages a central log which records all cron events (when each job starts, finishes, the job's success, etc). * Emails the user the results of the cron job on a configurable condition (on failure only, on success only, etc.) via sendmail or smtp. * Times out a cron job that runs past the configurable timeout. * Easily scales to handle multiple users' cron jobs. * Both the default behavior and the per-cron job behavior are highly configurable."
|
86
|
+
email:
|
87
|
+
- technical.inquiries@designingpatterns.com
|
88
|
+
executables:
|
89
|
+
- jobmanager
|
90
|
+
extensions: []
|
91
|
+
|
92
|
+
extra_rdoc_files:
|
93
|
+
- Manifest.txt
|
94
|
+
- History.txt
|
95
|
+
- FAQ.txt
|
96
|
+
- README.txt
|
97
|
+
files:
|
98
|
+
- Manifest.txt
|
99
|
+
- LICENSE
|
100
|
+
- History.txt
|
101
|
+
- FAQ.txt
|
102
|
+
- README.txt
|
103
|
+
- Rakefile
|
104
|
+
- bin/jobmanager
|
105
|
+
- examples/email_settings.rb
|
106
|
+
- examples/example.rb
|
107
|
+
- examples/mysql_backup.rb
|
108
|
+
- examples/jobmanager.yaml
|
109
|
+
- lib/jobmanager.rb
|
110
|
+
- lib/jobmanager/applicationconfig.rb
|
111
|
+
- lib/jobmanager/applicationlogger.rb
|
112
|
+
- lib/jobmanager/applicationoptionparser.rb
|
113
|
+
- lib/jobmanager/application.rb
|
114
|
+
- lib/jobmanager/system.rb
|
115
|
+
- lib/jobmanager/teestream.rb
|
116
|
+
- lib/jobmanager/util.rb
|
117
|
+
- test/helpers.rb
|
118
|
+
- test/mock_syslog.rb
|
119
|
+
- test/test_applicationlogger.rb
|
120
|
+
- test/test_config.rb
|
121
|
+
- test/test_jobmanager.rb
|
122
|
+
- test/test_system.rb
|
123
|
+
- test/test_teestream.rb
|
124
|
+
- test/configs/email_settings.rb
|
125
|
+
- test/configs/all_values.yaml
|
126
|
+
- test/configs/bad_email_condition.yaml
|
127
|
+
- test/configs/bad_no_central_log_file.yaml
|
128
|
+
- test/configs/bad_number_of_job_logs.yaml
|
129
|
+
- test/configs/bad_timeout_zero.yaml
|
130
|
+
- test/configs/incomplete_1.yaml
|
131
|
+
- test/configs/jobmanager_1.yaml
|
132
|
+
- test/configs/jobmanager_2.yaml
|
133
|
+
- test/configs/jobmanager_3.yaml
|
134
|
+
- test/configs/jobmanager_4_bad_central_log_file.yaml
|
135
|
+
- test/configs/jobmanager_4_bad_email_settings_file.yaml
|
136
|
+
- test/configs/jobmanager_4_bad_job_logs_directory_1.yaml
|
137
|
+
- test/configs/jobmanager_4_bad_job_logs_directory_2.yaml
|
138
|
+
- test/configs/minimum_plus_email_settings.yaml
|
139
|
+
- test/configs/minimum_required.yaml
|
140
|
+
has_rdoc: true
|
141
|
+
homepage: "Project Page: http://rubyforge.org/projects/jobmanager/"
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options:
|
144
|
+
- --main
|
145
|
+
- README.txt
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: "0"
|
153
|
+
version:
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: "0"
|
159
|
+
version:
|
160
|
+
requirements: []
|
161
|
+
|
162
|
+
rubyforge_project: jobmanager
|
163
|
+
rubygems_version: 1.2.0
|
164
|
+
signing_key:
|
165
|
+
specification_version: 2
|
166
|
+
summary: This package makes managing cron jobs on unix systems a breeze! It is composed of a single program, +jobmanager+, which is intended to be invoked by cron, or a cron-like application
|
167
|
+
test_files:
|
168
|
+
- test/test_jobmanager.rb
|
169
|
+
- test/test_config.rb
|
170
|
+
- test/test_applicationlogger.rb
|
171
|
+
- test/test_teestream.rb
|
172
|
+
- test/test_system.rb
|