hash-that-tree 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -1
- data/README.md +8 -0
- data/hash-that-tree.gemspec +4 -2
- data/lib/{hashthattree.rb → compare.rb} +8 -9
- data/lib/version.rb +1 -1
- metadata +22 -53
- data/doc/Gemfile.html +0 -96
- data/doc/HashThatTree.html +0 -171
- data/doc/HashThatTree/FileHashResults.html +0 -258
- data/doc/HashThatTree/MD5Compare.html +0 -386
- data/doc/LICENSE_txt.html +0 -114
- data/doc/Rakefile.html +0 -94
- data/doc/created.rid +0 -6
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -74
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/lib/hashthattree_rb.html +0 -54
- data/doc/lib/version_rb.html +0 -52
- data/doc/rdoc.css +0 -763
- data/doc/spec/file3_txt~.html +0 -118
- data/doc/spec/file4_txt~.html +0 -118
- data/doc/spec/testfiles/1/file1_txt.html +0 -112
- data/doc/spec/testfiles/1/file2_txt.html +0 -112
- data/doc/spec/testfiles/1/file3_txt.html +0 -114
- data/doc/spec/testfiles/1/file4_txt.html +0 -114
- data/doc/spec/testfiles/2/file1_txt.html +0 -112
- data/doc/spec/testfiles/2/file2_txt.html +0 -112
- data/doc/spec/testfiles/2/file3_txt.html +0 -114
- data/doc/spec/testfiles/2/file4_txt.html +0 -114
- data/doc/spec/testfiles/2/fileA_txt.html +0 -112
- data/doc/spec/testfiles/2/fileB_txt.html +0 -112
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -42,3 +42,11 @@ Or install it yourself as:
|
|
42
42
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
43
|
4. Push to the branch (`git push origin my-new-feature`)
|
44
44
|
5. Create new Pull Request
|
45
|
+
|
46
|
+
## TODO
|
47
|
+
I have a few items to do in upcoming releases
|
48
|
+
* Add a Command Line Interface
|
49
|
+
* Allow multiple folders to be specified
|
50
|
+
* Add folder recursion option
|
51
|
+
* Add SHA1
|
52
|
+
|
data/hash-that-tree.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "hash-that-tree"
|
8
8
|
gem.version = HashThatTree::VERSION
|
9
9
|
gem.authors = ["John Ryan"]
|
10
|
-
gem.email = ["
|
11
|
-
gem.description = "
|
10
|
+
gem.email = ["555john@gmail.com"]
|
11
|
+
gem.description = "Compares the MD5 hashes of the files in two different folders"
|
12
12
|
gem.summary = "Allows the user to enter two folder locations and the gem will iterate through the files, creating and comparing the MD5 hashes of the files with the same name"
|
13
13
|
gem.homepage = "http://github.com/jnyryan/hash-that-tree"
|
14
14
|
|
@@ -16,4 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "thor"
|
19
21
|
end
|
@@ -18,11 +18,12 @@ module HashThatTree
|
|
18
18
|
|
19
19
|
#initialize the class with the folders to be compared
|
20
20
|
def initialize(folder1, folder2)
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
@folder1 = folder1
|
22
|
+
@folder2 = folder2
|
23
|
+
@filehash = Hash.new
|
24
24
|
validate
|
25
25
|
end
|
26
|
+
|
26
27
|
|
27
28
|
# Validates the input ensuring the arguments are both valid folders
|
28
29
|
def validate
|
@@ -45,6 +46,7 @@ module HashThatTree
|
|
45
46
|
Dir.foreach(@folder1) do |item|
|
46
47
|
next if item == '.' or item == '..'
|
47
48
|
the_hash = Digest::MD5.hexdigest(File.read(File.join(@folder1, item)))
|
49
|
+
item = item.downcase
|
48
50
|
filedata = FileHashResults.new(item, the_hash, nil)
|
49
51
|
@filehash[item] = filedata
|
50
52
|
end
|
@@ -52,12 +54,13 @@ module HashThatTree
|
|
52
54
|
Dir.foreach(@folder2) do |item|
|
53
55
|
next if item == '.' or item == '..'
|
54
56
|
the_hash = Digest::MD5.hexdigest(File.read(File.join(@folder2, item)))
|
55
|
-
|
57
|
+
item = item.downcase
|
58
|
+
if(@filehash[item]==nil)
|
56
59
|
filedata = FileHashResults.new(item, nil, the_hash)
|
57
60
|
@filehash[item] = filedata
|
58
61
|
next
|
59
62
|
end
|
60
|
-
@filehash[item].file_hash2 = the_hash
|
63
|
+
@filehash[item.downcase].file_hash2 = the_hash
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
@@ -78,8 +81,4 @@ module HashThatTree
|
|
78
81
|
@file_hash2 = file_hash2
|
79
82
|
end
|
80
83
|
end
|
81
|
-
|
82
|
-
htt = MD5Compare.new(ARGV[0], ARGV[1])
|
83
|
-
htt.compare
|
84
|
-
htt.display_results
|
85
84
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash-that-tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2012-11-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Compares the MD5 hashes of the files in two different folders
|
15
31
|
email:
|
16
|
-
-
|
32
|
+
- 555john@gmail.com
|
17
33
|
executables: []
|
18
34
|
extensions: []
|
19
35
|
extra_rdoc_files: []
|
@@ -24,55 +40,8 @@ files:
|
|
24
40
|
- LICENSE.txt
|
25
41
|
- README.md
|
26
42
|
- Rakefile
|
27
|
-
- doc/Gemfile.html
|
28
|
-
- doc/HashThatTree.html
|
29
|
-
- doc/HashThatTree/FileHashResults.html
|
30
|
-
- doc/HashThatTree/MD5Compare.html
|
31
|
-
- doc/LICENSE_txt.html
|
32
|
-
- doc/Rakefile.html
|
33
|
-
- doc/created.rid
|
34
|
-
- doc/images/brick.png
|
35
|
-
- doc/images/brick_link.png
|
36
|
-
- doc/images/bug.png
|
37
|
-
- doc/images/bullet_black.png
|
38
|
-
- doc/images/bullet_toggle_minus.png
|
39
|
-
- doc/images/bullet_toggle_plus.png
|
40
|
-
- doc/images/date.png
|
41
|
-
- doc/images/find.png
|
42
|
-
- doc/images/loadingAnimation.gif
|
43
|
-
- doc/images/macFFBgHack.png
|
44
|
-
- doc/images/package.png
|
45
|
-
- doc/images/page_green.png
|
46
|
-
- doc/images/page_white_text.png
|
47
|
-
- doc/images/page_white_width.png
|
48
|
-
- doc/images/plugin.png
|
49
|
-
- doc/images/ruby.png
|
50
|
-
- doc/images/tag_green.png
|
51
|
-
- doc/images/wrench.png
|
52
|
-
- doc/images/wrench_orange.png
|
53
|
-
- doc/images/zoom.png
|
54
|
-
- doc/index.html
|
55
|
-
- doc/js/darkfish.js
|
56
|
-
- doc/js/jquery.js
|
57
|
-
- doc/js/quicksearch.js
|
58
|
-
- doc/js/thickbox-compressed.js
|
59
|
-
- doc/lib/hashthattree_rb.html
|
60
|
-
- doc/lib/version_rb.html
|
61
|
-
- doc/rdoc.css
|
62
|
-
- doc/spec/file3_txt~.html
|
63
|
-
- doc/spec/file4_txt~.html
|
64
|
-
- doc/spec/testfiles/1/file1_txt.html
|
65
|
-
- doc/spec/testfiles/1/file2_txt.html
|
66
|
-
- doc/spec/testfiles/1/file3_txt.html
|
67
|
-
- doc/spec/testfiles/1/file4_txt.html
|
68
|
-
- doc/spec/testfiles/2/file1_txt.html
|
69
|
-
- doc/spec/testfiles/2/file2_txt.html
|
70
|
-
- doc/spec/testfiles/2/file3_txt.html
|
71
|
-
- doc/spec/testfiles/2/file4_txt.html
|
72
|
-
- doc/spec/testfiles/2/fileA_txt.html
|
73
|
-
- doc/spec/testfiles/2/fileB_txt.html
|
74
43
|
- hash-that-tree.gemspec
|
75
|
-
- lib/
|
44
|
+
- lib/compare.rb
|
76
45
|
- lib/version.rb
|
77
46
|
- spec/doc/created.rid
|
78
47
|
- spec/doc/images/brick.png
|
data/doc/Gemfile.html
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
-
<head>
|
7
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
-
|
9
|
-
<title>File: Gemfile [RDoc Documentation]</title>
|
10
|
-
|
11
|
-
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
-
|
13
|
-
<script src="./js/jquery.js" type="text/javascript"
|
14
|
-
charset="utf-8"></script>
|
15
|
-
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
-
charset="utf-8"></script>
|
17
|
-
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
-
charset="utf-8"></script>
|
19
|
-
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
-
charset="utf-8"></script>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body class="file">
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="./index.html">Home</a>
|
29
|
-
<a href="./index.html#classes">Classes</a>
|
30
|
-
<a href="./index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="project-metadata">
|
36
|
-
|
37
|
-
|
38
|
-
<div id="fileindex-section" class="section project-section">
|
39
|
-
<h3 class="section-header">Files</h3>
|
40
|
-
<ul>
|
41
|
-
|
42
|
-
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
|
43
|
-
|
44
|
-
<li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
|
45
|
-
|
46
|
-
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
47
|
-
|
48
|
-
</ul>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
|
52
|
-
<div id="classindex-section" class="section project-section">
|
53
|
-
<h3 class="section-header">Class Index
|
54
|
-
<span class="search-toggle"><img src="./images/find.png"
|
55
|
-
height="16" width="16" alt="[+]"
|
56
|
-
title="show/hide quicksearch" /></span></h3>
|
57
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
58
|
-
<fieldset>
|
59
|
-
<legend>Quicksearch</legend>
|
60
|
-
<input type="text" name="quicksearch" value=""
|
61
|
-
class="quicksearch-field" />
|
62
|
-
</fieldset>
|
63
|
-
</form>
|
64
|
-
|
65
|
-
<ul class="link-list">
|
66
|
-
|
67
|
-
<li><a href="./HashThatTree.html">HashThatTree</a></li>
|
68
|
-
|
69
|
-
<li><a href="./HashThatTree/FileHashResults.html">HashThatTree::FileHashResults</a></li>
|
70
|
-
|
71
|
-
<li><a href="./HashThatTree/MD5Compare.html">HashThatTree::MD5Compare</a></li>
|
72
|
-
|
73
|
-
</ul>
|
74
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
|
78
|
-
</div>
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<div id="documentation">
|
82
|
-
|
83
|
-
<p>source ‘<a href="https://rubygems.org">rubygems.org</a>’</p>
|
84
|
-
|
85
|
-
<p># Specify your gem’s dependencies in hash-that-tree.gemspec gemspec</p>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
<div id="validator-badges">
|
90
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
91
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
92
|
-
Rdoc Generator</a> 2</small>.</p>
|
93
|
-
</div>
|
94
|
-
</body>
|
95
|
-
</html>
|
96
|
-
|
data/doc/HashThatTree.html
DELETED
@@ -1,171 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
|
-
|
8
|
-
<title>Module: HashThatTree</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
-
|
12
|
-
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
-
|
17
|
-
</head>
|
18
|
-
<body id="top" class="module">
|
19
|
-
|
20
|
-
<div id="metadata">
|
21
|
-
<div id="home-metadata">
|
22
|
-
<div id="home-section" class="section">
|
23
|
-
<h3 class="section-header">
|
24
|
-
<a href="./index.html">Home</a>
|
25
|
-
<a href="./index.html#classes">Classes</a>
|
26
|
-
<a href="./index.html#methods">Methods</a>
|
27
|
-
</h3>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<div id="file-metadata">
|
32
|
-
<div id="file-list-section" class="section">
|
33
|
-
<h3 class="section-header">In Files</h3>
|
34
|
-
<div class="section-body">
|
35
|
-
<ul>
|
36
|
-
|
37
|
-
<li><a href="./lib/hashthattree_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="lib/hashthattree.rb">lib/hashthattree.rb</a></li>
|
39
|
-
|
40
|
-
<li><a href="./lib/version_rb.html?TB_iframe=true&height=550&width=785"
|
41
|
-
class="thickbox" title="lib/version.rb">lib/version.rb</a></li>
|
42
|
-
|
43
|
-
</ul>
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
|
47
|
-
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<div id="class-metadata">
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
<!-- Namespace Contents -->
|
57
|
-
<div id="namespace-list-section" class="section">
|
58
|
-
<h3 class="section-header">Namespace</h3>
|
59
|
-
<ul class="link-list">
|
60
|
-
|
61
|
-
<li><span class="type">CLASS</span> <a href="HashThatTree/FileHashResults.html">HashThatTree::FileHashResults</a></li>
|
62
|
-
|
63
|
-
<li><span class="type">CLASS</span> <a href="HashThatTree/MD5Compare.html">HashThatTree::MD5Compare</a></li>
|
64
|
-
|
65
|
-
</ul>
|
66
|
-
</div>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
</div>
|
73
|
-
|
74
|
-
<div id="project-metadata">
|
75
|
-
|
76
|
-
|
77
|
-
<div id="fileindex-section" class="section project-section">
|
78
|
-
<h3 class="section-header">Files</h3>
|
79
|
-
<ul>
|
80
|
-
|
81
|
-
<li class="file"><a href="./Gemfile.html">Gemfile</a></li>
|
82
|
-
|
83
|
-
<li class="file"><a href="./LICENSE_txt.html">LICENSE.txt</a></li>
|
84
|
-
|
85
|
-
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
86
|
-
|
87
|
-
</ul>
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
<div id="classindex-section" class="section project-section">
|
92
|
-
<h3 class="section-header">Class/Module Index
|
93
|
-
<span class="search-toggle"><img src="./images/find.png"
|
94
|
-
height="16" width="16" alt="[+]"
|
95
|
-
title="show/hide quicksearch" /></span></h3>
|
96
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
97
|
-
<fieldset>
|
98
|
-
<legend>Quicksearch</legend>
|
99
|
-
<input type="text" name="quicksearch" value=""
|
100
|
-
class="quicksearch-field" />
|
101
|
-
</fieldset>
|
102
|
-
</form>
|
103
|
-
|
104
|
-
<ul class="link-list">
|
105
|
-
|
106
|
-
<li><a href="./HashThatTree.html">HashThatTree</a></li>
|
107
|
-
|
108
|
-
<li><a href="./HashThatTree/FileHashResults.html">HashThatTree::FileHashResults</a></li>
|
109
|
-
|
110
|
-
<li><a href="./HashThatTree/MD5Compare.html">HashThatTree::MD5Compare</a></li>
|
111
|
-
|
112
|
-
</ul>
|
113
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
|
117
|
-
</div>
|
118
|
-
</div>
|
119
|
-
|
120
|
-
<div id="documentation">
|
121
|
-
<h1 class="module">HashThatTree</h1>
|
122
|
-
|
123
|
-
<div id="description" class="description">
|
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>
|
128
|
-
|
129
|
-
</div><!-- description -->
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<!-- Constants -->
|
141
|
-
<div id="constants-list" class="section">
|
142
|
-
<h3 class="section-header">Constants</h3>
|
143
|
-
<dl>
|
144
|
-
|
145
|
-
<dt><a name="VERSION">VERSION</a></dt>
|
146
|
-
|
147
|
-
<dd class="description"><p>File containing the current version of the gem</p></dd>
|
148
|
-
|
149
|
-
|
150
|
-
</dl>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<!-- Methods -->
|
157
|
-
|
158
|
-
</div><!-- 5Buntitled-5D -->
|
159
|
-
|
160
|
-
|
161
|
-
</div><!-- documentation -->
|
162
|
-
|
163
|
-
<div id="validator-badges">
|
164
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
165
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
166
|
-
Rdoc Generator</a> 2</small>.</p>
|
167
|
-
</div>
|
168
|
-
|
169
|
-
</body>
|
170
|
-
</html>
|
171
|
-
|