encrypt_env 1.3.4 → 1.3.7

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: '0108116f53998a69c29a421d3f0726cbaeb9affa7a194b891a4bcec681d0823e'
4
- data.tar.gz: 0e13e28fa7e990f0ffc3950fbe429e1c5b49b0f986c8ee26e6a45f7da3007b66
3
+ metadata.gz: dd634e7fc896cefbe4579145c0a73894ed1fe51be4971d8d195f0cbc0eb39b7d
4
+ data.tar.gz: f1471056a4779bfa5cef533495ca0abc09707bd6b13a35482a9d16642356e0e6
5
5
  SHA512:
6
- metadata.gz: 5c0ad88fdf14079b84b9a0364a8ef1e1381e1862083b608adc15706f2bcbdcc305de6cd943d5cd49b6b4d2b947458ea222da9105cd686a86d447e01fff29f56b
7
- data.tar.gz: 4ae071fc5a3ce618cec111bb75b665f084def3e75debee1da01f445c555e46d56f91c88af521b9c5ff48421e94397b22645e6ec545483e76a0f5c72b0646dd6e
6
+ metadata.gz: aa1e838872bade1d4d17cd0d222bc3c4e0c614738cd3e257a161dfc83198b41be2ff7a964f48ad11d5dc5cab2a9cda1373fc29dc3746e04c26e2a7fc83762097
7
+ data.tar.gz: 914b09bd8214792cb400753f5605ba7ba68fdcf2abd20e4254bd548768076ff0cf24a55312cd1c1f29e54370f56875e4371f7e359f6feaa3ab61cae1520b5fe5
data/bin/encrypt_env CHANGED
@@ -7,14 +7,23 @@ require 'optparse'
7
7
  require_relative '../lib/encrypt_env/version'
8
8
 
9
9
  options = {}
10
- parsers = OptionParser.new do |parser|
11
- parser.on('-e', '--environment ENVIRONMENT', 'environment')
12
- parser.on('-s', '--set VALUE', 'value')
13
- parser.on('-t', '--type TYPE', 'type of variable')
14
- parser.on('-a', '--all', 'show all') do
15
- EncryptEnv.show('all')
16
- exit
10
+ OptionParser.new do |parser|
11
+ parser.on('-e', '--environment ENVIRONMENT', 'environment') do |opts|
12
+ options[:environment] = opts
13
+ end
14
+
15
+ parser.on('-s', '--set VALUE', 'value') do |opts|
16
+ options[:set] = opts
17
17
  end
18
+
19
+ parser.on('-t', '--type TYPE', 'type of variable') do |opts|
20
+ options[:type] = opts
21
+ end
22
+
23
+ parser.on('-a', '--all', 'show all') do |_opts|
24
+ options[:all] = true
25
+ end
26
+
18
27
  parser.on('-v', '--version', 'version') do
19
28
  puts Version::VERSION
20
29
  exit
@@ -46,9 +55,9 @@ parsers = OptionParser.new do |parser|
46
55
  HELP
47
56
  exit
48
57
  end
49
- end
58
+ end.parse!
50
59
 
51
- parsers.parse!(into: options)
60
+ # parsers.parse!
52
61
 
53
62
  argv = ARGV
54
63
  action = argv.shift
@@ -59,6 +68,10 @@ when 'setup'
59
68
  EncryptEnv.setup
60
69
 
61
70
  when 'show', 'edit'
71
+ if action == 'show' && options[:all]
72
+ EncryptEnv.show('all')
73
+ exit
74
+ end
62
75
  EncryptEnv.send(action, options[:environment], variable_name)
63
76
 
64
77
  when 'create'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '1.3.4'
4
+ VERSION = '1.3.7'
5
5
  end
data/lib/encrypt_env.rb CHANGED
@@ -121,7 +121,6 @@ class EncryptEnv
121
121
  raise e.message
122
122
  end
123
123
 
124
- puts 'Decrypting...'
125
124
  decipher = OpenSSL::Cipher.new('aes-128-gcm')
126
125
  decipher.decrypt
127
126
  data = load_encrypted_data(env)
@@ -293,13 +292,13 @@ class EncryptEnv
293
292
  end
294
293
 
295
294
  private_class_method def self.type_coercion(value, type)
295
+ type = define_type_new_variable if type.nil?
296
+
296
297
  unless %w[integer float string boolean].include?(type)
297
298
  puts "Variable's type must be 'interger', 'float', 'string' or 'boolean'!"
298
299
  exit
299
300
  end
300
301
 
301
- type = define_type_new_variable if type.nil?
302
-
303
302
  case type
304
303
  when 'integer'
305
304
  value.to_i
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encrypt_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nhu Tan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-15 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print