sparehand 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/Manifest.txt +17 -0
- data/README.txt +37 -0
- data/Rakefile +54 -0
- data/bin/comment_block +8 -0
- data/coverage/index.html +259 -0
- data/coverage/lib-comment_block_rb.html +670 -0
- data/lib/comment_block.rb +52 -0
- data/lib/safe_modify.rb +18 -0
- data/lib/sparehand/version.rb +9 -0
- data/setup.rb +1585 -0
- data/test/comment_block_cli_test.rb +28 -0
- data/test/comment_block_test.rb +66 -0
- data/test/fixtures/example_hosts_file +7 -0
- data/test/fixtures/safe_modify_data +1 -0
- data/test/safe_modify_test.rb +28 -0
- data/test/test_helper.rb +8 -0
- metadata +64 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
bin/comment_block
|
6
|
+
coverage/index.html
|
7
|
+
coverage/lib-comment_block_rb.html
|
8
|
+
lib/comment_block.rb
|
9
|
+
lib/safe_modify.rb
|
10
|
+
lib/sparehand/version.rb
|
11
|
+
setup.rb
|
12
|
+
test/comment_block_cli_test.rb
|
13
|
+
test/comment_block_test.rb
|
14
|
+
test/fixtures/example_hosts_file
|
15
|
+
test/fixtures/safe_modify_data
|
16
|
+
test/safe_modify_test.rb
|
17
|
+
test/test_helper.rb
|
data/README.txt
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
Sparehand
|
2
|
+
http://rubyforge.org/projects/phillyonrails/
|
3
|
+
mat.schaffer@gmail.com
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Sparehand is a set of system administration utilities provided as both ruby
|
8
|
+
libraries and shell scripts.
|
9
|
+
|
10
|
+
== INSTALL:
|
11
|
+
|
12
|
+
+ sudo gem install sparehand
|
13
|
+
|
14
|
+
== LICENSE:
|
15
|
+
|
16
|
+
(The MIT License)
|
17
|
+
|
18
|
+
Copyright (c) 2007 Mat Schaffer
|
19
|
+
|
20
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
21
|
+
a copy of this software and associated documentation files (the
|
22
|
+
'Software'), to deal in the Software without restriction, including
|
23
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
24
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
25
|
+
permit persons to whom the Software is furnished to do so, subject to
|
26
|
+
the following conditions:
|
27
|
+
|
28
|
+
The above copyright notice and this permission notice shall be
|
29
|
+
included in all copies or substantial portions of the Software.
|
30
|
+
|
31
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
32
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
33
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
34
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
35
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
36
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
37
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/contrib/rubyforgepublisher'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'hoe'
|
11
|
+
include FileUtils
|
12
|
+
require File.join(File.dirname(__FILE__), 'lib', 'sparehand', 'version')
|
13
|
+
|
14
|
+
AUTHOR = "Mat Schaffer" # can also be an array of Authors
|
15
|
+
EMAIL = "mat.schaffer@gmail.com"
|
16
|
+
DESCRIPTION = "A collection of utilities for system manipulations both from Ruby or CLI."
|
17
|
+
GEM_NAME = "sparehand"
|
18
|
+
RUBYFORGE_PROJECT = "phillyonrails"
|
19
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/sparehand"
|
20
|
+
|
21
|
+
|
22
|
+
NAME = "sparehand"
|
23
|
+
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
24
|
+
VERS = ENV['VERSION'] || (Sparehand::VERSION::STRING + (REV ? ".#{REV}" : ""))
|
25
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
26
|
+
RDOC_OPTS = ['--quiet', '--title', "sparehand documentation",
|
27
|
+
"--opname", "index.html",
|
28
|
+
"--line-numbers",
|
29
|
+
"--main", "README",
|
30
|
+
"--inline-source"]
|
31
|
+
|
32
|
+
class Hoe
|
33
|
+
def extra_deps
|
34
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Generate all the Rake tasks
|
39
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
40
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
41
|
+
p.author = AUTHOR
|
42
|
+
p.description = DESCRIPTION
|
43
|
+
p.email = EMAIL
|
44
|
+
p.summary = DESCRIPTION
|
45
|
+
p.url = HOMEPATH
|
46
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
|
+
p.test_globs = ["test/**/*_test.rb"]
|
48
|
+
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
49
|
+
|
50
|
+
# == Optional
|
51
|
+
#p.changes - A description of the release's latest changes.
|
52
|
+
#p.extra_deps - An array of rubygem dependencies.
|
53
|
+
#p.spec_extras - A hash of extra values to set in the gemspec.
|
54
|
+
end
|
data/bin/comment_block
ADDED
data/coverage/index.html
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<title>C0 code coverage information</title>
|
5
|
+
<style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
|
6
|
+
<style type='text/css'>span.cross-ref-title {
|
7
|
+
font-size: 140%;
|
8
|
+
}
|
9
|
+
span.cross-ref a {
|
10
|
+
text-decoration: none;
|
11
|
+
}
|
12
|
+
span.cross-ref {
|
13
|
+
background-color:#f3f7fa;
|
14
|
+
border: 1px dashed #333;
|
15
|
+
margin: 1em;
|
16
|
+
padding: 0.5em;
|
17
|
+
overflow: hidden;
|
18
|
+
}
|
19
|
+
a.crossref-toggle {
|
20
|
+
text-decoration: none;
|
21
|
+
}
|
22
|
+
span.marked0 {
|
23
|
+
background-color: rgb(185, 210, 200);
|
24
|
+
display: block;
|
25
|
+
}
|
26
|
+
span.marked1 {
|
27
|
+
background-color: rgb(190, 215, 205);
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
span.inferred0 {
|
31
|
+
background-color: rgb(175, 200, 200);
|
32
|
+
display: block;
|
33
|
+
}
|
34
|
+
span.inferred1 {
|
35
|
+
background-color: rgb(180, 205, 205);
|
36
|
+
display: block;
|
37
|
+
}
|
38
|
+
span.uncovered0 {
|
39
|
+
background-color: rgb(225, 110, 110);
|
40
|
+
display: block;
|
41
|
+
}
|
42
|
+
span.uncovered1 {
|
43
|
+
background-color: rgb(235, 120, 120);
|
44
|
+
display: block;
|
45
|
+
}
|
46
|
+
span.overview {
|
47
|
+
border-bottom: 8px solid black;
|
48
|
+
}
|
49
|
+
div.overview {
|
50
|
+
border-bottom: 8px solid black;
|
51
|
+
}
|
52
|
+
body {
|
53
|
+
font-family: verdana, arial, helvetica;
|
54
|
+
}
|
55
|
+
div.footer {
|
56
|
+
font-size: 68%;
|
57
|
+
margin-top: 1.5em;
|
58
|
+
}
|
59
|
+
h1, h2, h3, h4, h5, h6 {
|
60
|
+
margin-bottom: 0.5em;
|
61
|
+
}
|
62
|
+
h5 {
|
63
|
+
margin-top: 0.5em;
|
64
|
+
}
|
65
|
+
.hidden {
|
66
|
+
display: none;
|
67
|
+
}
|
68
|
+
div.separator {
|
69
|
+
height: 10px;
|
70
|
+
}
|
71
|
+
/* Commented out for better readability, esp. on IE */
|
72
|
+
/*
|
73
|
+
table tr td, table tr th {
|
74
|
+
font-size: 68%;
|
75
|
+
}
|
76
|
+
td.value table tr td {
|
77
|
+
font-size: 11px;
|
78
|
+
}
|
79
|
+
*/
|
80
|
+
table.percent_graph {
|
81
|
+
height: 12px;
|
82
|
+
border: #808080 1px solid;
|
83
|
+
empty-cells: show;
|
84
|
+
}
|
85
|
+
table.percent_graph td.covered {
|
86
|
+
height: 10px;
|
87
|
+
background: #00f000;
|
88
|
+
}
|
89
|
+
table.percent_graph td.uncovered {
|
90
|
+
height: 10px;
|
91
|
+
background: #e00000;
|
92
|
+
}
|
93
|
+
table.percent_graph td.NA {
|
94
|
+
height: 10px;
|
95
|
+
background: #eaeaea;
|
96
|
+
}
|
97
|
+
table.report {
|
98
|
+
border-collapse: collapse;
|
99
|
+
width: 100%;
|
100
|
+
}
|
101
|
+
table.report td.heading {
|
102
|
+
background: #dcecff;
|
103
|
+
border: #d0d0d0 1px solid;
|
104
|
+
font-weight: bold;
|
105
|
+
text-align: center;
|
106
|
+
}
|
107
|
+
table.report td.heading:hover {
|
108
|
+
background: #c0ffc0;
|
109
|
+
}
|
110
|
+
table.report td.text {
|
111
|
+
border: #d0d0d0 1px solid;
|
112
|
+
}
|
113
|
+
table.report td.value {
|
114
|
+
text-align: right;
|
115
|
+
border: #d0d0d0 1px solid;
|
116
|
+
}
|
117
|
+
table.report tr.light {
|
118
|
+
background-color: rgb(240, 240, 245);
|
119
|
+
}
|
120
|
+
table.report tr.dark {
|
121
|
+
background-color: rgb(230, 230, 235);
|
122
|
+
}
|
123
|
+
</style>
|
124
|
+
<script type='text/javascript'>
|
125
|
+
// <![CDATA[
|
126
|
+
function toggleCode( id ) {
|
127
|
+
if ( document.getElementById )
|
128
|
+
elem = document.getElementById( id );
|
129
|
+
else if ( document.all )
|
130
|
+
elem = eval( "document.all." + id );
|
131
|
+
else
|
132
|
+
return false;
|
133
|
+
|
134
|
+
elemStyle = elem.style;
|
135
|
+
|
136
|
+
if ( elemStyle.display != "block" ) {
|
137
|
+
elemStyle.display = "block"
|
138
|
+
} else {
|
139
|
+
elemStyle.display = "none"
|
140
|
+
}
|
141
|
+
|
142
|
+
return true;
|
143
|
+
}
|
144
|
+
|
145
|
+
// Make cross-references hidden by default
|
146
|
+
document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
|
147
|
+
// ]]>
|
148
|
+
</script>
|
149
|
+
</head>
|
150
|
+
<body>
|
151
|
+
<h3>C0 code coverage information</h3>
|
152
|
+
<p>Generated on Sat Feb 10 19:57:44 -0500 2007 with <a href='http://eigenclass.org/hiki.rb?rcov'>rcov 0.7.0</a>
|
153
|
+
</p>
|
154
|
+
<hr /> <table class='report'>
|
155
|
+
<thead>
|
156
|
+
<tr>
|
157
|
+
<td class='heading'>Name</td>
|
158
|
+
<td class='heading'>Total lines</td>
|
159
|
+
<td class='heading'>Lines of code</td>
|
160
|
+
<td class='heading'>Total coverage</td>
|
161
|
+
<td class='heading'>Code coverage</td>
|
162
|
+
</tr>
|
163
|
+
</thead>
|
164
|
+
<tbody>
|
165
|
+
<tr class='light'>
|
166
|
+
<td>TOTAL</td>
|
167
|
+
<td class='value'>
|
168
|
+
<tt>41</tt>
|
169
|
+
</td>
|
170
|
+
<td class='value'>
|
171
|
+
<tt>36</tt>
|
172
|
+
</td>
|
173
|
+
<td>
|
174
|
+
<table cellspacing='0' cellpadding='0' align='right'>
|
175
|
+
<tr>
|
176
|
+
<td>
|
177
|
+
<tt>68.3%</tt> </td>
|
178
|
+
<td>
|
179
|
+
<table cellspacing='0' class='percent_graph' cellpadding='0' width='100'>
|
180
|
+
<tr>
|
181
|
+
<td class='covered' width='68' />
|
182
|
+
<td class='uncovered' width='32' />
|
183
|
+
</tr>
|
184
|
+
</table>
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
</table>
|
188
|
+
</td>
|
189
|
+
<td>
|
190
|
+
<table cellspacing='0' cellpadding='0' align='right'>
|
191
|
+
<tr>
|
192
|
+
<td>
|
193
|
+
<tt>69.4%</tt> </td>
|
194
|
+
<td>
|
195
|
+
<table cellspacing='0' class='percent_graph' cellpadding='0' width='100'>
|
196
|
+
<tr>
|
197
|
+
<td class='covered' width='69' />
|
198
|
+
<td class='uncovered' width='31' />
|
199
|
+
</tr>
|
200
|
+
</table>
|
201
|
+
</td>
|
202
|
+
</tr>
|
203
|
+
</table>
|
204
|
+
</td>
|
205
|
+
</tr>
|
206
|
+
<tr class='dark'>
|
207
|
+
<td>
|
208
|
+
<a href='lib-comment_block_rb.html'>lib/comment_block.rb</a>
|
209
|
+
</td>
|
210
|
+
<td class='value'>
|
211
|
+
<tt>41</tt>
|
212
|
+
</td>
|
213
|
+
<td class='value'>
|
214
|
+
<tt>36</tt>
|
215
|
+
</td>
|
216
|
+
<td>
|
217
|
+
<table cellspacing='0' cellpadding='0' align='right'>
|
218
|
+
<tr>
|
219
|
+
<td>
|
220
|
+
<tt>68.3%</tt> </td>
|
221
|
+
<td>
|
222
|
+
<table cellspacing='0' class='percent_graph' cellpadding='0' width='100'>
|
223
|
+
<tr>
|
224
|
+
<td class='covered' width='68' />
|
225
|
+
<td class='uncovered' width='32' />
|
226
|
+
</tr>
|
227
|
+
</table>
|
228
|
+
</td>
|
229
|
+
</tr>
|
230
|
+
</table>
|
231
|
+
</td>
|
232
|
+
<td>
|
233
|
+
<table cellspacing='0' cellpadding='0' align='right'>
|
234
|
+
<tr>
|
235
|
+
<td>
|
236
|
+
<tt>69.4%</tt> </td>
|
237
|
+
<td>
|
238
|
+
<table cellspacing='0' class='percent_graph' cellpadding='0' width='100'>
|
239
|
+
<tr>
|
240
|
+
<td class='covered' width='69' />
|
241
|
+
<td class='uncovered' width='31' />
|
242
|
+
</tr>
|
243
|
+
</table>
|
244
|
+
</td>
|
245
|
+
</tr>
|
246
|
+
</table>
|
247
|
+
</td>
|
248
|
+
</tr>
|
249
|
+
</tbody>
|
250
|
+
</table><hr /> <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a> version 0.7.0.</p><p>
|
251
|
+
<a href='http://validator.w3.org/check/referer'>
|
252
|
+
<img src='http://www.w3.org/Icons/valid-xhtml11' height='31' alt='Valid XHTML 1.1!' width='88' />
|
253
|
+
</a>
|
254
|
+
<a href='http://jigsaw.w3.org/css-validator/check/referer'>
|
255
|
+
<img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
|
256
|
+
</a>
|
257
|
+
</p>
|
258
|
+
</body>
|
259
|
+
</html>
|