diffcrypt 0.1.0 → 0.1.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/diffcrypt/rails/encrypted_configuration.rb +8 -1
- data/lib/diffcrypt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a07ad0aa1385421550a40093fe6e724337f7697e71f7af081a7011daa05a8c
|
4
|
+
data.tar.gz: 40406c43e1a8ef7396577e70d62e3bee026db6500563e56aadf113b95203069d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f03e909e4b49740dfd7e6e8e4bdab3a39decca30556149e4645f2071156b9632e3a54827f33fc6fcac7a419443eb066bf8fca249eca98219a9be5989ef3840
|
7
|
+
data.tar.gz: 001bf874603205e1421a0a99ac8d2c14e15b187495505adb1141f84108b0270d159f58c703c730fea6d69a974b1c8e32b2268437a93b590a9adf8d851f854a37
|
@@ -29,6 +29,13 @@ module Diffcrypt
|
|
29
29
|
@active_support_encryptor = ActiveSupport::MessageEncryptor.new([key].pack('H*'), cipher: Encryptor::CIPHER)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Determines if file is using the diffable format, or still
|
33
|
+
# encrypted using default rails credentials format
|
34
|
+
# @return [Boolean]
|
35
|
+
def content_path_diffable?
|
36
|
+
content_path.binread.index('---')&.zero?
|
37
|
+
end
|
38
|
+
|
32
39
|
# Allow a config to be started without a file present
|
33
40
|
# @return [String] Returns decryped content or a blank string
|
34
41
|
def read
|
@@ -72,7 +79,7 @@ module Diffcrypt
|
|
72
79
|
|
73
80
|
updated_contents = tmp_path.binread
|
74
81
|
|
75
|
-
write(updated_contents, content_path.binread)
|
82
|
+
write(updated_contents, content_path_diffable? && content_path.binread)
|
76
83
|
ensure
|
77
84
|
FileUtils.rm(tmp_path) if tmp_path&.exist?
|
78
85
|
end
|
data/lib/diffcrypt/version.rb
CHANGED