hash-that-tree 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/HashThatTree/FileHashResults.html +1 -1
- data/doc/HashThatTree/MD5Compare.html +8 -7
- data/doc/HashThatTree.html +5 -11
- data/doc/created.rid +3 -3
- data/doc/lib/hashthattree_rb.html +1 -1
- data/doc/lib/version_rb.html +1 -1
- data/lib/hashthattree.rb +6 -11
- data/lib/version.rb +2 -1
- metadata +1 -1
@@ -224,7 +224,7 @@
|
|
224
224
|
|
225
225
|
<div class="method-source-code" id="new-source">
|
226
226
|
<pre>
|
227
|
-
<span class="ruby-comment"># File lib/hashthattree.rb, line
|
227
|
+
<span class="ruby-comment"># File lib/hashthattree.rb, line 75</span>
|
228
228
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-identifier">file_hash1</span>, <span class="ruby-identifier">file_hash2</span>)
|
229
229
|
<span class="ruby-ivar">@file_name</span> = <span class="ruby-identifier">file_name</span>
|
230
230
|
<span class="ruby-ivar">@file_hash1</span> = <span class="ruby-identifier">file_hash1</span>
|
@@ -215,7 +215,7 @@ analysis</p>
|
|
215
215
|
|
216
216
|
<div class="method-source-code" id="new-source">
|
217
217
|
<pre>
|
218
|
-
<span class="ruby-comment"># File lib/hashthattree.rb, line
|
218
|
+
<span class="ruby-comment"># File lib/hashthattree.rb, line 20</span>
|
219
219
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">folder1</span>, <span class="ruby-identifier">folder2</span>)
|
220
220
|
<span class="ruby-ivar">@folder1</span> = <span class="ruby-identifier">folder1</span>
|
221
221
|
<span class="ruby-ivar">@folder2</span> = <span class="ruby-identifier">folder2</span>
|
@@ -259,7 +259,7 @@ results of the comparisson</p>
|
|
259
259
|
|
260
260
|
<div class="method-source-code" id="compare-source">
|
261
261
|
<pre>
|
262
|
-
<span class="ruby-comment"># File lib/hashthattree.rb, line
|
262
|
+
<span class="ruby-comment"># File lib/hashthattree.rb, line 43</span>
|
263
263
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">compare</span>
|
264
264
|
|
265
265
|
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-ivar">@folder1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
@@ -304,16 +304,17 @@ results of the comparisson</p>
|
|
304
304
|
<div class="method-description">
|
305
305
|
|
306
306
|
<p>Dumps the contents of the <a
|
307
|
-
href="FileHashResults.html">FileHashResults</a> object
|
307
|
+
href="FileHashResults.html">FileHashResults</a> object in csv form to
|
308
|
+
standard out</p>
|
308
309
|
|
309
310
|
|
310
311
|
|
311
312
|
<div class="method-source-code" id="display_results-source">
|
312
313
|
<pre>
|
313
|
-
<span class="ruby-comment"># File lib/hashthattree.rb, line
|
314
|
+
<span class="ruby-comment"># File lib/hashthattree.rb, line 65</span>
|
314
315
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">display_results</span>
|
315
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-
|
316
|
-
<span class="ruby-ivar">@filehash</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{value.file_name}
|
316
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"FileName,#{@folder1},#{@folder2},Are Equal"</span>
|
317
|
+
<span class="ruby-ivar">@filehash</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{value.file_name},#{value.file_hash1},#{value.file_hash2}, #{value.file_hash1==value.file_hash2}"</span> }
|
317
318
|
<span class="ruby-keyword">end</span></pre>
|
318
319
|
</div><!-- display_results-source -->
|
319
320
|
|
@@ -344,7 +345,7 @@ href="FileHashResults.html">FileHashResults</a> object to standard out</p>
|
|
344
345
|
|
345
346
|
<div class="method-source-code" id="validate-source">
|
346
347
|
<pre>
|
347
|
-
<span class="ruby-comment"># File lib/hashthattree.rb, line
|
348
|
+
<span class="ruby-comment"># File lib/hashthattree.rb, line 28</span>
|
348
349
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">validate</span>
|
349
350
|
<span class="ruby-keyword">if</span>(<span class="ruby-identifier">folder1</span><span class="ruby-operator">==</span><span class="ruby-keyword">nil</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">folder1</span><span class="ruby-operator">==</span><span class="ruby-string">""</span>) <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">folder1</span>)
|
350
351
|
<span class="ruby-identifier">puts</span> <span class="ruby-string">"a valid folder path is required as argument 1"</span>
|
data/doc/HashThatTree.html
CHANGED
@@ -121,16 +121,10 @@
|
|
121
121
|
<h1 class="module">HashThatTree</h1>
|
122
122
|
|
123
123
|
<div id="description" class="description">
|
124
|
-
|
125
|
-
<
|
126
|
-
|
127
|
-
|
128
|
-
<td>
|
129
|
-
<p>Copyright © 2012 John Ryan</p>
|
130
|
-
</td></tr><tr><td class="rdoc-term"><p>License</p></td>
|
131
|
-
<td>
|
132
|
-
<p>Distributes under the same terms as Ruby</p>
|
133
|
-
</td></tr></table>
|
124
|
+
|
125
|
+
<p>The program takes two directories and creates a MD5 hash for every file
|
126
|
+
contained within. It then builds a result set that compares files with the
|
127
|
+
same name and allows for them to be outputted as a csv string</p>
|
134
128
|
|
135
129
|
</div><!-- description -->
|
136
130
|
|
@@ -150,7 +144,7 @@
|
|
150
144
|
|
151
145
|
<dt><a name="VERSION">VERSION</a></dt>
|
152
146
|
|
153
|
-
<dd class="description"></dd>
|
147
|
+
<dd class="description"><p>File containing the current version of the gem</p></dd>
|
154
148
|
|
155
149
|
|
156
150
|
</dl>
|
data/doc/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Mon, 05 Nov 2012
|
1
|
+
Mon, 05 Nov 2012 11:43:37 +0000
|
2
2
|
./Rakefile Mon, 05 Nov 2012 09:29:11 +0000
|
3
|
-
./lib/hashthattree.rb Mon, 05 Nov 2012
|
4
|
-
./lib/version.rb Mon, 05 Nov 2012
|
3
|
+
./lib/hashthattree.rb Mon, 05 Nov 2012 11:40:27 +0000
|
4
|
+
./lib/version.rb Mon, 05 Nov 2012 11:43:30 +0000
|
5
5
|
./LICENSE.txt Mon, 05 Nov 2012 09:29:11 +0000
|
6
6
|
./Gemfile Mon, 05 Nov 2012 09:29:11 +0000
|
data/doc/lib/version_rb.html
CHANGED
data/lib/hashthattree.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
require 'digest/md5'
|
2
2
|
|
3
|
-
# The program takes an initial word or phrase from
|
4
|
-
# the command line (or in the absence of a
|
5
|
-
# parameter from the first line of standard
|
6
|
-
# input). In then reads successive words or
|
7
|
-
# phrases from standard input and reports whether
|
8
|
-
# they are angrams of the first word.
|
9
|
-
|
10
|
-
#
|
11
3
|
# Author:: John Ryan (mailto:555john@gmail.com)
|
12
4
|
# Copyright:: Copyright (c) 2012 John Ryan
|
13
5
|
# License:: Distributes under the same terms as Ruby
|
14
6
|
|
7
|
+
# The program takes two directories and creates a MD5 hash for every file contained within.
|
8
|
+
# It then builds a result set that compares files with the same name and allows for them to be outputted
|
9
|
+
# as a csv string
|
15
10
|
module HashThatTree
|
16
11
|
|
17
12
|
# This class accepts two folders and provides methods to iterate
|
@@ -66,10 +61,10 @@ module HashThatTree
|
|
66
61
|
end
|
67
62
|
end
|
68
63
|
|
69
|
-
#Dumps the contents of the FileHashResults object to standard out
|
64
|
+
#Dumps the contents of the FileHashResults object in csv form to standard out
|
70
65
|
def display_results
|
71
|
-
puts "FileName
|
72
|
-
@filehash.each{ |key, value| puts "#{value.file_name}
|
66
|
+
puts "FileName,#{@folder1},#{@folder2},Are Equal"
|
67
|
+
@filehash.each{ |key, value| puts "#{value.file_name},#{value.file_hash1},#{value.file_hash2}, #{value.file_hash1==value.file_hash2}" }
|
73
68
|
end
|
74
69
|
|
75
70
|
end
|
data/lib/version.rb
CHANGED