hash-that-tree 0.0.4 → 0.0.6
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/Gemfile.lock +4 -1
- data/README.md +28 -14
- data/bin/hashthattree +21 -0
- data/hash-that-tree.gemspec +5 -5
- data/lib/compare.rb +1 -4
- metadata +9 -7
- data/lib/version.rb +0 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#hash-that-tree
|
2
|
-
|
2
|
+
A ruby command line app that compares the MD5 hashes of the files in different folders
|
3
3
|
|
4
|
-
|
4
|
+
It allows the user to enter folder locations, then iterats through the files, creating and comparing the MD5 hashes of the files with the same name
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -19,11 +19,12 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
e.g
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
|
23
|
+
hashthattree help
|
24
|
+
|
25
|
+
hashthattree CompareMD5 spec/testfiles/1 spec/testfiles/2
|
26
26
|
|
27
|
+
|
27
28
|
## Creating Documentation
|
28
29
|
Run the following command to generate the documantation
|
29
30
|
|
@@ -31,9 +32,15 @@ Or install it yourself as:
|
|
31
32
|
|
32
33
|
## Create a gem
|
33
34
|
|
34
|
-
|
35
|
-
gem build hash-that-tree.gemspec
|
36
|
-
gem
|
35
|
+
Build and Test Locally
|
36
|
+
-gem build hash-that-tree.gemspec
|
37
|
+
-gem install hash-that-tree-X.X.X # where X.X.X is the version of the compiled gemspec
|
38
|
+
-hashthattree
|
39
|
+
|
40
|
+
Build and deploy to rubygems.org
|
41
|
+
-gem update --system
|
42
|
+
-gem build hash-that-tree.gemspec
|
43
|
+
-gem push hash-that-tree-0.0.1.gem # where X.X.X is the version of the compiled gemspec
|
37
44
|
|
38
45
|
## Contributing
|
39
46
|
|
@@ -43,10 +50,17 @@ Or install it yourself as:
|
|
43
50
|
4. Push to the branch (`git push origin my-new-feature`)
|
44
51
|
5. Create new Pull Request
|
45
52
|
|
53
|
+
##References
|
54
|
+
|
55
|
+
Looking into bundling with https://github.com/radar/guides/blob/master/gem-development.md
|
56
|
+
http://whatisthor.com/
|
57
|
+
|
46
58
|
## TODO
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
59
|
+
|
60
|
+
I have a few items to do in upcoming releases
|
61
|
+
* Add Unit Tests
|
62
|
+
* Allow to be used as an API as well as a Command Line Tool
|
63
|
+
* Allow multiple folders to be specified
|
64
|
+
* Add folder recursion option
|
65
|
+
* Add SHA1
|
52
66
|
|
data/bin/hashthattree
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require_relative '../lib/compare'
|
3
|
+
|
4
|
+
# Command Line Program that takes two directories and creates a MD5 hash for every file contained within.
|
5
|
+
# It then builds a result set that compares files with the same name and allows for them to be outputted
|
6
|
+
# as a csv string
|
7
|
+
module HashThatTree
|
8
|
+
class CLI < Thor
|
9
|
+
option :recurse
|
10
|
+
|
11
|
+
desc "compare FOLDER1 FOLDER2", "Create a hash of all files in the folders, compare them and output the results in CSV format"
|
12
|
+
def compare(folder1, folder2)
|
13
|
+
htt = CompareMD5.new(folder1, folder2)
|
14
|
+
htt.compare
|
15
|
+
htt.display_results
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
CLI.start(ARGV)
|
20
|
+
|
21
|
+
end
|
data/hash-that-tree.gemspec
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |gem|
|
7
6
|
gem.name = "hash-that-tree"
|
8
|
-
gem.version =
|
7
|
+
gem.version = "0.0.6"
|
9
8
|
gem.authors = ["John Ryan"]
|
10
9
|
gem.email = ["555john@gmail.com"]
|
11
|
-
gem.description = "
|
12
|
-
gem.summary = "Allows the user to enter
|
10
|
+
gem.description = "Command line app that compares the MD5 hashes of the files in different folders"
|
11
|
+
gem.summary = "Allows the user to enter folder locations iterating through the files, creating and comparing the MD5 hashes of the files with the same name"
|
13
12
|
gem.homepage = "http://github.com/jnyryan/hash-that-tree"
|
14
|
-
|
13
|
+
gem.has_rdoc = true
|
15
14
|
gem.files = `git ls-files`.split($/)
|
16
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.executable = 'hashthattree'
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
data/lib/compare.rb
CHANGED
@@ -4,16 +4,13 @@ require 'digest/md5'
|
|
4
4
|
# Copyright:: Copyright (c) 2012 John Ryan
|
5
5
|
# License:: Distributes under the same terms as Ruby
|
6
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
|
10
7
|
module HashThatTree
|
11
8
|
|
12
9
|
# This class accepts two folders and provides methods to iterate
|
13
10
|
# through them creating a hash of each file within and can display
|
14
11
|
# the results for analysis
|
15
12
|
|
16
|
-
class
|
13
|
+
class CompareMD5
|
17
14
|
attr_accessor :folder1, :folder2
|
18
15
|
|
19
16
|
#initialize the class with the folders to be compared
|
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.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -27,10 +27,12 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
description:
|
30
|
+
description: Command line app that compares the MD5 hashes of the files in different
|
31
|
+
folders
|
31
32
|
email:
|
32
33
|
- 555john@gmail.com
|
33
|
-
executables:
|
34
|
+
executables:
|
35
|
+
- hashthattree
|
34
36
|
extensions: []
|
35
37
|
extra_rdoc_files: []
|
36
38
|
files:
|
@@ -40,9 +42,9 @@ files:
|
|
40
42
|
- LICENSE.txt
|
41
43
|
- README.md
|
42
44
|
- Rakefile
|
45
|
+
- bin/hashthattree
|
43
46
|
- hash-that-tree.gemspec
|
44
47
|
- lib/compare.rb
|
45
|
-
- lib/version.rb
|
46
48
|
- spec/doc/created.rid
|
47
49
|
- spec/doc/images/brick.png
|
48
50
|
- spec/doc/images/brick_link.png
|
@@ -113,8 +115,8 @@ rubyforge_project:
|
|
113
115
|
rubygems_version: 1.8.24
|
114
116
|
signing_key:
|
115
117
|
specification_version: 3
|
116
|
-
summary: Allows the user to enter
|
117
|
-
|
118
|
+
summary: Allows the user to enter folder locations iterating through the files, creating
|
119
|
+
and comparing the MD5 hashes of the files with the same name
|
118
120
|
test_files:
|
119
121
|
- spec/doc/created.rid
|
120
122
|
- spec/doc/images/brick.png
|
data/lib/version.rb
DELETED