dotenvcrypt 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25e9da553397ec83d27cdbb1319b602a21943a829a35a983c3b2a47ac236b950
4
- data.tar.gz: 9b2366d939e79d8d0ddb7113a62b0d47150e8fc252f5daa66cac54289e4670a3
3
+ metadata.gz: 1ead91de7add08540af64e47ff6f32f8c0a3e0f552fdd6b5a04a0485dc618909
4
+ data.tar.gz: fef0232606440a15f36b5f9e3ab39588df74780cd110697e53c4cfc1a5ca1f48
5
5
  SHA512:
6
- metadata.gz: a62e65dd35df66335424686223269606b04039c52c5c9248ed325c7f86c92d0c73fe14d4f6adad14e8b7f7478a3e378e7439f7ac688a6bad79cd681698a3cfad
7
- data.tar.gz: 706ca24d30f12ce314e18da8bb9f9a63fbbf089dab8f3082474cd9a34719157a4f57c78227b16f696d8acb8afb6a10e695d89781ad9e4d07da005b8958b2632b
6
+ metadata.gz: 64aa077f96823950f7c354f9a08f61c671e042d2fefd17df84c5776f53cbc21c590b6716c22d3d696baa2cf67804142b6a44cef5fc7acde87c5fc182f4ffbbea
7
+ data.tar.gz: 2600fa1f56ae93551ad6649f7dca32cebb2dbfd3bec63c5501a5c836162110d4aa2eff7efaccde382a0044c312ac0dce44cb890dc54c9e0b1bde9eea9b02249d
@@ -48,16 +48,22 @@ module Dotenvcrypt
48
48
  def edit_file(encrypted_file)
49
49
  temp_file = Tempfile.new('dotenvcrypt')
50
50
 
51
+ original_content = encryptor.decrypt(File.read(encrypted_file))
52
+
51
53
  File.open(temp_file.path, 'w') do |f|
52
- f.write encryptor.decrypt(File.read(encrypted_file))
54
+ f.write original_content
53
55
  end
54
56
 
55
57
  puts "Waiting for file to be saved. Abort with Ctrl-C."
56
58
 
57
59
  system("#{ENV['EDITOR'] || 'vim'} #{temp_file.path}")
58
60
 
59
- File.open(encrypted_file, 'w') do |f|
60
- f.write encryptor.encrypt(File.read(temp_file.path))
61
+ updated_content = File.read(temp_file.path)
62
+
63
+ if updated_content != original_content
64
+ File.open(encrypted_file, 'w') do |f|
65
+ f.write encryptor.encrypt(updated_content)
66
+ end
61
67
  end
62
68
 
63
69
  puts "🔒 Encrypted and saved #{encrypted_file}"
@@ -1,3 +1,3 @@
1
1
  module Dotenvcrypt
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenvcrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Loman