diffcrypt 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 123f8eedd18059e8df8ceee8ab1d8bf67db179c05102f13fc0eb826e05c5d1de
4
- data.tar.gz: 9ea816271de575fc3e101b2bc7898ab85513beffc0ab126426a286e86310ebdc
3
+ metadata.gz: b9a07ad0aa1385421550a40093fe6e724337f7697e71f7af081a7011daa05a8c
4
+ data.tar.gz: 40406c43e1a8ef7396577e70d62e3bee026db6500563e56aadf113b95203069d
5
5
  SHA512:
6
- metadata.gz: 8a97bbbd2f9c0f3f5ec04acb7ab65514b747da321fa1bf1d295c9e7a8a98b755d711b653cc888c60fa44b26a1e115a87061ee80d01788e6680a05e42eb5c8162
7
- data.tar.gz: 5a1b1446b201762d5463d0774638dee995af9c26c6aad375f804f0682dd0efb8ce74c4fb40c7c048ba306a1e24fa18bc37408173f4bbe1852e12bd552522f25d
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diffcrypt
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffcrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Qualie