directory-digest 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/lib/directory-digest/digest.rb +10 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 712a04620d53d7789977935e441c37cc9c029c53
|
4
|
+
data.tar.gz: 69f20583777c881851a8496adb63c61c69f88ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 683cf16fa483599216d4138a367ed31da766fc921d52f848e0eb045124329b4c3665705fb18320b1f135eb843d11c7d94d84f8dd5241658be8465e871c5b5af2
|
7
|
+
data.tar.gz: a833bf25400426641a5629b5b95011b876a927960076a3ecdfd35678d341e1a18a1423019926cb97b1549a89edb625b636ab2596abbe08cf3607966c8b783426
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'openssl'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module DirectoryDigest
|
4
5
|
# DirectoryDigest::Digest - Creates a SHA256 digest of a directory's content
|
@@ -51,5 +52,14 @@ module DirectoryDigest
|
|
51
52
|
unchanged: other.file_digests.select { |path, digest| file_digests.key?(path) && digest == file_digests[path] }
|
52
53
|
}
|
53
54
|
end
|
55
|
+
|
56
|
+
def to_json
|
57
|
+
JSON.pretty_generate(directory_digest: directory_digest, file_digests: file_digests)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.from_json(json)
|
61
|
+
json = JSON.parse(json)
|
62
|
+
Digest.new(json['directory_digest'], json['file_digests'])
|
63
|
+
end
|
54
64
|
end
|
55
65
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directory-digest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Heald
|
@@ -58,9 +58,9 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.4'
|
61
|
-
description:
|
62
|
-
|
63
|
-
|
61
|
+
description: Creates a SHA256 digest of all of the files in a directory. See the project
|
62
|
+
home page for more information.
|
63
|
+
email: andrew@heald.uk
|
64
64
|
executables: []
|
65
65
|
extensions: []
|
66
66
|
extra_rdoc_files: []
|