watch-paths 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/License.txt +263 -0
- data/Manifest.txt +8 -0
- data/README.txt +31 -0
- data/Rakefile +17 -0
- data/bin/watch-paths +15 -0
- data/lib/watch-paths.rb +85 -0
- data/test/test_watch-paths.rb +63 -0
- metadata +65 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
== LICENSE
|
2
|
+
|
3
|
+
NASA OPEN SOURCE AGREEMENT VERSION 1.3
|
4
|
+
|
5
|
+
THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE,
|
6
|
+
REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN
|
7
|
+
COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT
|
8
|
+
AS REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT
|
9
|
+
AGENCY"). THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT
|
10
|
+
AGENCY, IS AN INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT
|
11
|
+
DISTRIBUTIONS OR REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO
|
12
|
+
USES, REPRODUCES, DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT
|
13
|
+
SOFTWARE, AS DEFINED HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION,
|
14
|
+
ACCEPTING IN FULL THE RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN
|
15
|
+
THIS AGREEMENT.
|
16
|
+
|
17
|
+
Government Agency: NASA Langley Research Center
|
18
|
+
Government Agency Original Software Designation: LAR-17081-1
|
19
|
+
Government Agency Original Software Title: fUnit
|
20
|
+
User Registration Requested: please see clause 3.F.
|
21
|
+
Government Agency Point of Contact: please see clause 5.F.
|
22
|
+
|
23
|
+
1. DEFINITIONS
|
24
|
+
|
25
|
+
A. "Contributor" means Government Agency, as the developer of the
|
26
|
+
Original Software, and any entity that makes a Modification.
|
27
|
+
|
28
|
+
B. "Covered Patents" mean patent claims licensable by a Contributor
|
29
|
+
that are necessarily infringed by the use or sale of its Modification
|
30
|
+
alone or when combined with the Subject Software.
|
31
|
+
|
32
|
+
C. "Display" means the showing of a copy of the Subject Software,
|
33
|
+
either directly or by means of an image, or any other device.
|
34
|
+
|
35
|
+
D. "Distribution" means conveyance or transfer of the Subject
|
36
|
+
Software, regardless of means, to another.
|
37
|
+
|
38
|
+
E. "Larger Work" means computer software that combines Subject
|
39
|
+
Software, or portions thereof, with software separate from the Subject
|
40
|
+
Software that is not governed by the terms of this Agreement.
|
41
|
+
|
42
|
+
F. "Modification" means any alteration of, including addition to or
|
43
|
+
deletion from, the substance or structure of either the Original
|
44
|
+
Software or Subject Software, and includes derivative works, as that
|
45
|
+
term is defined in the Copyright Statute, 17 USC 101. However, the
|
46
|
+
act of including Subject Software as part of a Larger Work does not in
|
47
|
+
and of itself constitute a Modification.
|
48
|
+
|
49
|
+
G. "Original Software" means the computer software first released
|
50
|
+
under this Agreement by Government Agency with Government Agency
|
51
|
+
designation NASA and entitled fUnit, including source code,
|
52
|
+
object code and accompanying documentation, if any.
|
53
|
+
|
54
|
+
H. "Recipient" means anyone who acquires the Subject Software under
|
55
|
+
this Agreement, including all Contributors.
|
56
|
+
|
57
|
+
I. "Redistribution" means Distribution of the Subject Software after a
|
58
|
+
Modification has been made.
|
59
|
+
|
60
|
+
J. "Reproduction" means the making of a counterpart, image or copy of
|
61
|
+
the Subject Software.
|
62
|
+
|
63
|
+
K. "Sale" means the exchange of the Subject Software for money or
|
64
|
+
equivalent value.
|
65
|
+
|
66
|
+
L. "Subject Software" means the Original Software, Modifications, or
|
67
|
+
any respective parts thereof.
|
68
|
+
|
69
|
+
M. "Use" means the application or employment of the Subject Software
|
70
|
+
for any purpose.
|
71
|
+
|
72
|
+
2. GRANT OF RIGHTS
|
73
|
+
|
74
|
+
A. Under Non-Patent Rights: Subject to the terms and conditions of
|
75
|
+
this Agreement, each Contributor, with respect to its own contribution
|
76
|
+
to the Subject Software, hereby grants to each Recipient a
|
77
|
+
non-exclusive, world-wide, royalty-free license to engage in the
|
78
|
+
following activities pertaining to the Subject Software:
|
79
|
+
|
80
|
+
1. Use
|
81
|
+
2. Distribution
|
82
|
+
3. Reproduction
|
83
|
+
4. Modification
|
84
|
+
5. Redistribution
|
85
|
+
6. Display
|
86
|
+
|
87
|
+
B. Under Patent Rights: Subject to the terms and conditions of this
|
88
|
+
Agreement, each Contributor, with respect to its own contribution to
|
89
|
+
the Subject Software, hereby grants to each Recipient under Covered
|
90
|
+
Patents a non-exclusive, world-wide, royalty-free license to engage in
|
91
|
+
the following activities pertaining to the Subject Software:
|
92
|
+
|
93
|
+
1. Use
|
94
|
+
2. Distribution
|
95
|
+
3. Reproduction
|
96
|
+
4. Sale
|
97
|
+
5. Offer for Sale
|
98
|
+
|
99
|
+
C. The rights granted under Paragraph B. also apply to the combination
|
100
|
+
of a Contributor's Modification and the Subject Software if, at the
|
101
|
+
time the Modification is added by the Contributor, the addition of
|
102
|
+
such Modification causes the combination to be covered by the Covered
|
103
|
+
Patents. It does not apply to any other combinations that include a
|
104
|
+
Modification.
|
105
|
+
|
106
|
+
D. The rights granted in Paragraphs A. and B. allow the Recipient to
|
107
|
+
sublicense those same rights. Such sublicense must be under the same
|
108
|
+
terms and conditions of this Agreement.
|
109
|
+
|
110
|
+
3. OBLIGATIONS OF RECIPIENT
|
111
|
+
|
112
|
+
A. Distribution or Redistribution of the Subject Software must be made
|
113
|
+
under this Agreement except for additions covered under paragraph 3H.
|
114
|
+
|
115
|
+
1. Whenever a Recipient distributes or redistributes the Subject
|
116
|
+
Software, a copy of this Agreement must be included with each copy
|
117
|
+
of the Subject Software; and
|
118
|
+
|
119
|
+
2. If Recipient distributes or redistributes the Subject Software in
|
120
|
+
any form other than source code, Recipient must also make the
|
121
|
+
source code freely available, and must provide with each copy of
|
122
|
+
the Subject Software information on how to obtain the source code
|
123
|
+
in a reasonable manner on or through a medium customarily used for
|
124
|
+
software exchange.
|
125
|
+
|
126
|
+
B. Each Recipient must ensure that the following copyright notice
|
127
|
+
appears prominently in the Subject Software:
|
128
|
+
|
129
|
+
Copyright 2007 United States Government as represented by
|
130
|
+
NASA Langley Research Center. No copyright is claimed in
|
131
|
+
the United States under Title 17, U.S. Code. All Other Rights
|
132
|
+
Reserved.
|
133
|
+
|
134
|
+
C. Each Contributor must characterize its alteration of the Subject
|
135
|
+
Software as a Modification and must identify itself as the originator
|
136
|
+
of its Modification in a manner that reasonably allows subsequent
|
137
|
+
Recipients to identify the originator of the Modification. In
|
138
|
+
fulfillment of these requirements, Contributor must include a file
|
139
|
+
(e.g., a change log file) that describes the alterations made and the
|
140
|
+
date of the alterations, identifies Contributor as originator of the
|
141
|
+
alterations, and consents to characterization of the alterations as a
|
142
|
+
Modification, for example, by including a statement that the
|
143
|
+
Modification is derived, directly or indirectly, from Original
|
144
|
+
Software provided by Government Agency. Once consent is granted, it
|
145
|
+
may not thereafter be revoked.
|
146
|
+
|
147
|
+
D. A Contributor may add its own copyright notice to the Subject
|
148
|
+
Software. Once a copyright notice has been added to the Subject
|
149
|
+
Software, a Recipient may not remove it without the express permission
|
150
|
+
of the Contributor who added the notice.
|
151
|
+
|
152
|
+
E. A Recipient may not make any representation in the Subject Software
|
153
|
+
or in any promotional, advertising or other material that may be
|
154
|
+
construed as an endorsement by Government Agency or by any prior
|
155
|
+
Recipient of any product or service provided by Recipient, or that may
|
156
|
+
seek to obtain commercial advantage by the fact of Government Agency's
|
157
|
+
or a prior Recipient's participation in this Agreement.
|
158
|
+
|
159
|
+
F. In an effort to track usage and maintain accurate records of the
|
160
|
+
Subject Software, each Recipient, upon receipt of the Subject Software,
|
161
|
+
is requested to provide Government Agency, by e-mail to the Government
|
162
|
+
Agency Point of Contact listed in clause 5.F., the following information:
|
163
|
+
name, institution (if applicable), postal code, and country.
|
164
|
+
Recipient's name and personal information shall be used for statistical
|
165
|
+
purposes only. Once a Recipient makes a Modification available, it is
|
166
|
+
requested that the Recipient inform Government Agency, by e-mail to the
|
167
|
+
Government Agency Point of Contact listed in clause 5.F., how to
|
168
|
+
access the Modification.
|
169
|
+
|
170
|
+
G. Each Contributor represents that that its Modification is believed
|
171
|
+
to be Contributor's original creation and does not violate any
|
172
|
+
existing agreements, regulations, statutes or rules, and further that
|
173
|
+
Contributor has sufficient rights to grant the rights conveyed by this
|
174
|
+
Agreement.
|
175
|
+
|
176
|
+
H. A Recipient may choose to offer, and to charge a fee for, warranty,
|
177
|
+
support, indemnity and/or liability obligations to one or more other
|
178
|
+
Recipients of the Subject Software. A Recipient may do so, however,
|
179
|
+
only on its own behalf and not on behalf of Government Agency or any
|
180
|
+
other Recipient. Such a Recipient must make it absolutely clear that
|
181
|
+
any such warranty, support, indemnity and/or liability obligation is
|
182
|
+
offered by that Recipient alone. Further, such Recipient agrees to
|
183
|
+
indemnify Government Agency and every other Recipient for any
|
184
|
+
liability incurred by them as a result of warranty, support, indemnity
|
185
|
+
and/or liability offered by such Recipient.
|
186
|
+
|
187
|
+
I. A Recipient may create a Larger Work by combining Subject Software
|
188
|
+
with separate software not governed by the terms of this agreement and
|
189
|
+
distribute the Larger Work as a single product. In such case, the
|
190
|
+
Recipient must make sure Subject Software, or portions thereof,
|
191
|
+
included in the Larger Work is subject to this Agreement.
|
192
|
+
|
193
|
+
J. Notwithstanding any provisions contained herein, Recipient is
|
194
|
+
hereby put on notice that export of any goods or technical data from
|
195
|
+
the United States may require some form of export license from the
|
196
|
+
U.S. Government. Failure to obtain necessary export licenses may
|
197
|
+
result in criminal liability under U.S. laws. Government Agency
|
198
|
+
neither represents that a license shall not be required nor that, if
|
199
|
+
required, it shall be issued. Nothing granted herein provides any
|
200
|
+
such export license.
|
201
|
+
|
202
|
+
4. DISCLAIMER OF WARRANTIES AND LIABILITIES; WAIVER AND INDEMNIFICATION
|
203
|
+
|
204
|
+
A. No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY
|
205
|
+
WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY,
|
206
|
+
INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE
|
207
|
+
WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
|
208
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM
|
209
|
+
INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
|
210
|
+
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO
|
211
|
+
THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER,
|
212
|
+
CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT
|
213
|
+
OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY
|
214
|
+
OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE.
|
215
|
+
FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES
|
216
|
+
REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE,
|
217
|
+
AND DISTRIBUTES IT "AS IS."
|
218
|
+
|
219
|
+
B. Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS
|
220
|
+
AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND
|
221
|
+
SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF
|
222
|
+
THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES,
|
223
|
+
EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM
|
224
|
+
PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT
|
225
|
+
SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED
|
226
|
+
STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
|
227
|
+
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE
|
228
|
+
REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL
|
229
|
+
TERMINATION OF THIS AGREEMENT.
|
230
|
+
|
231
|
+
5. GENERAL TERMS
|
232
|
+
|
233
|
+
A. Termination: This Agreement and the rights granted hereunder will
|
234
|
+
terminate automatically if a Recipient fails to comply with these
|
235
|
+
terms and conditions, and fails to cure such noncompliance within
|
236
|
+
thirty (30) days of becoming aware of such noncompliance. Upon
|
237
|
+
termination, a Recipient agrees to immediately cease use and
|
238
|
+
distribution of the Subject Software. All sublicenses to the Subject
|
239
|
+
Software properly granted by the breaching Recipient shall survive any
|
240
|
+
such termination of this Agreement.
|
241
|
+
|
242
|
+
B. Severability: If any provision of this Agreement is invalid or
|
243
|
+
unenforceable under applicable law, it shall not affect the validity
|
244
|
+
or enforceability of the remainder of the terms of this Agreement.
|
245
|
+
|
246
|
+
C. Applicable Law: This Agreement shall be subject to United States
|
247
|
+
federal law only for all purposes, including, but not limited to,
|
248
|
+
determining the validity of this Agreement, the meaning of its
|
249
|
+
provisions and the rights, obligations and remedies of the parties.
|
250
|
+
|
251
|
+
D. Entire Understanding: This Agreement constitutes the entire
|
252
|
+
understanding and agreement of the parties relating to release of the
|
253
|
+
Subject Software and may not be superseded, modified or amended except
|
254
|
+
by further written agreement duly executed by the parties.
|
255
|
+
|
256
|
+
E. Binding Authority: By accepting and using the Subject Software
|
257
|
+
under this Agreement, a Recipient affirms its authority to bind the
|
258
|
+
Recipient to all terms and conditions of this Agreement and that that
|
259
|
+
Recipient hereby agrees to all terms and conditions herein.
|
260
|
+
|
261
|
+
F. Point of Contact: Any Recipient contact with Government Agency is
|
262
|
+
to be directed to the designated representative as follows:
|
263
|
+
Bil.Kleb@NASA.gov
|
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
watch-paths
|
2
|
+
|
3
|
+
* http://nasarb.rubyforge.org/watch-paths
|
4
|
+
* http://rubyforge.org/projects/nasarb
|
5
|
+
* mailto:Bil.Kleb@nasa.gov
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
Scan a set of pathnames for file changes according to check sums.
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
* A poor man's configuration management
|
14
|
+
* Does not report files added since last scan
|
15
|
+
* Error handling is minimal
|
16
|
+
|
17
|
+
== SYNOPSIS:
|
18
|
+
|
19
|
+
$ watch-paths /paths/to/watch
|
20
|
+
|
21
|
+
== REQUIREMENTS:
|
22
|
+
|
23
|
+
* Ruby with Rubygems
|
24
|
+
|
25
|
+
== INSTALL:
|
26
|
+
|
27
|
+
* sudo gem install watch-paths
|
28
|
+
|
29
|
+
== LICENSE:
|
30
|
+
|
31
|
+
Released under the NASA Open Source Agreement -- see License.txt[link:files/License_txt.html] for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/watch-paths.rb'
|
6
|
+
|
7
|
+
Hoe.new( 'watch-paths', WatchPaths::VERSION ) do |p|
|
8
|
+
p.rubyforge_name = 'nasarb'
|
9
|
+
p.author = 'Bil Kleb'
|
10
|
+
p.email = 'Bil.Kleb@nasa.gov'
|
11
|
+
p.summary = p.paragraphs_of('README.txt', 3).to_s
|
12
|
+
p.description = p.paragraphs_of('README.txt', 3).to_s
|
13
|
+
p.url = p.paragraphs_of('README.txt', 1).to_s.split(/\n/)[1..-1]
|
14
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
15
|
+
end
|
16
|
+
|
17
|
+
# vim: syntax=Ruby
|
data/bin/watch-paths
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'watch-paths'
|
5
|
+
|
6
|
+
changes = WatchPaths.new.watch ARGV
|
7
|
+
|
8
|
+
if changes.empty?
|
9
|
+
exit 0
|
10
|
+
else
|
11
|
+
changes.each do |path,files|
|
12
|
+
STDERR.puts "Warning: checksum failures in #{path}:", files
|
13
|
+
end
|
14
|
+
exit 1
|
15
|
+
end
|
data/lib/watch-paths.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'digest/md5'
|
4
|
+
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
##
|
8
|
+
# A poor man's configuration management tool.
|
9
|
+
|
10
|
+
class WatchPaths
|
11
|
+
|
12
|
+
VERSION = '1.0.0'
|
13
|
+
|
14
|
+
##
|
15
|
+
# File used to record checksums in each path scanned
|
16
|
+
|
17
|
+
MANIFEST = '.chksum_manifest.yml'
|
18
|
+
|
19
|
+
##
|
20
|
+
# compares file checksums for a set of paths
|
21
|
+
|
22
|
+
def watch( paths )
|
23
|
+
chksum_errors = {}
|
24
|
+
paths.each do |path|
|
25
|
+
cd path do
|
26
|
+
begin
|
27
|
+
chksum_manifest = load
|
28
|
+
chksum_manifest = check chksum_manifest
|
29
|
+
dump chksum_manifest
|
30
|
+
rescue ChecksumError => error
|
31
|
+
chksum_errors[path] = error.message
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
chksum_errors
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Attempts to load checksum manifest YAML file,
|
40
|
+
# otherwise returns an empty hash.
|
41
|
+
|
42
|
+
def load
|
43
|
+
YAML.load_file MANIFEST rescue {}
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Write YAML file containing checksum manifest
|
48
|
+
|
49
|
+
def dump( chksum_manifest )
|
50
|
+
File.open(MANIFEST,'w'){ |f| YAML.dump chksum_manifest, f }
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Create a checksum manifest of files in current directory
|
55
|
+
|
56
|
+
def create_chksum_manifest
|
57
|
+
chksum_manifest = {}
|
58
|
+
Dir['*'].each do |file|
|
59
|
+
chksum_manifest[file] = Digest::MD5.hexdigest File.read(file)
|
60
|
+
end
|
61
|
+
chksum_manifest
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# Check old manifest against the current state.
|
66
|
+
|
67
|
+
def check( chksum_manifest )
|
68
|
+
new_chksum_manifest = create_chksum_manifest
|
69
|
+
changed = []
|
70
|
+
chksum_manifest.each do |file,chksum|
|
71
|
+
changed << file if chksum != new_chksum_manifest[file]
|
72
|
+
end
|
73
|
+
if changed.empty?
|
74
|
+
chksum_manifest = new_chksum_manifest
|
75
|
+
else
|
76
|
+
raise ChecksumError, changed
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Expection used to report checksum mismatches
|
84
|
+
|
85
|
+
class ChecksumError < RuntimeError; end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'watch-paths'
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
include FileUtils
|
6
|
+
|
7
|
+
class TestWatchPaths < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
mkdir 'fixture'
|
10
|
+
cd 'fixture' do
|
11
|
+
File.open('a_file','w'){ |f| f.puts 'contents' }
|
12
|
+
File.open('another_file','w'){ |f| f.puts 'other contents' }
|
13
|
+
end
|
14
|
+
@wp = WatchPaths.new
|
15
|
+
end
|
16
|
+
def test_creation
|
17
|
+
assert_not_nil @wp
|
18
|
+
end
|
19
|
+
def test_load_non_existent_chksum_manifest_file_returns_empty_hash
|
20
|
+
chksum_manifest = @wp.load
|
21
|
+
assert chksum_manifest.empty?, "chksum_manifest empty"
|
22
|
+
end
|
23
|
+
def test_dump_and_load
|
24
|
+
begin
|
25
|
+
dumped_manifest = { :file => :chksum }
|
26
|
+
@wp.dump dumped_manifest
|
27
|
+
assert File.exists?(WatchPaths::MANIFEST)
|
28
|
+
loaded_manifest = @wp.load
|
29
|
+
assert loaded_manifest == dumped_manifest
|
30
|
+
assert_equal 1, loaded_manifest.size
|
31
|
+
ensure
|
32
|
+
rm_rf WatchPaths::MANIFEST
|
33
|
+
end
|
34
|
+
end
|
35
|
+
def test_creates_chksum_manifest
|
36
|
+
cd 'fixture' do
|
37
|
+
chksum_manifest = @wp.create_chksum_manifest
|
38
|
+
assert_equal 2, chksum_manifest.size
|
39
|
+
assert chksum_manifest.has_key?('a_file')
|
40
|
+
assert chksum_manifest.has_key?('another_file')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
def test_check_reports_chksum_changes
|
44
|
+
@wp.watch( ['fixture'] )
|
45
|
+
cd 'fixture' do
|
46
|
+
File.open('a_file','w'){ |f| f.puts 'changed_contents' }
|
47
|
+
assert_raise ChecksumError do @wp.check @wp.load end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
def test_watch_reports_chksum_changes
|
51
|
+
@wp.watch( ['fixture'] )
|
52
|
+
cd 'fixture' do
|
53
|
+
File.open('a_file','w'){ |f| f.puts 'changed_contents' }
|
54
|
+
end
|
55
|
+
changes = @wp.watch( ['fixture'] )
|
56
|
+
assert_equal 1, changes.size
|
57
|
+
assert changes.keys.include?('fixture')
|
58
|
+
assert_equal ['a_file'], changes['fixture']
|
59
|
+
end
|
60
|
+
def teardown
|
61
|
+
rm_rf 'fixture'
|
62
|
+
end
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
4
|
+
name: watch-paths
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-08-07 00:00:00 -04:00
|
8
|
+
summary: "== FEATURES/PROBLEMS: * A poor man's configuration management * Does not report files added since last scan * Error handling is minimal"
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: Bil.Kleb@nasa.gov
|
12
|
+
homepage: "* http://rubyforge.org/projects/nasarb"
|
13
|
+
rubyforge_project: nasarb
|
14
|
+
description: "== FEATURES/PROBLEMS: * A poor man's configuration management * Does not report files added since last scan * Error handling is minimal"
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Bil Kleb
|
31
|
+
files:
|
32
|
+
- History.txt
|
33
|
+
- License.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- bin/watch-paths
|
38
|
+
- lib/watch-paths.rb
|
39
|
+
- test/test_watch-paths.rb
|
40
|
+
test_files:
|
41
|
+
- test/test_watch-paths.rb
|
42
|
+
rdoc_options:
|
43
|
+
- --main
|
44
|
+
- README.txt
|
45
|
+
extra_rdoc_files:
|
46
|
+
- History.txt
|
47
|
+
- License.txt
|
48
|
+
- Manifest.txt
|
49
|
+
- README.txt
|
50
|
+
executables:
|
51
|
+
- watch-paths
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
dependencies:
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: hoe
|
59
|
+
version_requirement:
|
60
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.2.2
|
65
|
+
version:
|