encrypt_env 0.0.3 → 0.0.6

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/encrypt_env +23 -27
  3. data/lib/encrypt_env.rb +10 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 792c9708e5058a7818825c9ac5e92fb5f425516f35341e00761015bc00a991d2
4
- data.tar.gz: '09637106b5e42667606663df587cd60232f29ed45d474ad250272936e68b59a9'
3
+ metadata.gz: 41d12bf487f110976e474d60a5b2cbe5d825bbd325a6f0fb0b003a807e0a7557
4
+ data.tar.gz: 8096fb94b5f9b8768b74534e80dacc380025094b50138d5956e4cf5c19e2e72c
5
5
  SHA512:
6
- metadata.gz: ac51802016d36480678e85d6f5bab85e14e97f5e7b27eb4d3e299e4da195f3a3e362738c5da05832f1381ddf4cde8093263398dff1bbf28c989f2a9cb3febabe
7
- data.tar.gz: b0a7958e6cfc5807dc97f3d33e8da5d1d4c4e4b005c2d6928da7a1eb6e4bc3864d1215874025a78693d7836aec661472c7bc6e1e68a2641ca1f81b0f08c716da
6
+ metadata.gz: d437b495ce9af36732e207ec44310c086acff7234df2aa6386fb4c356210cdc7ec924e632f6eeb7fcf3bd500835cd47cefa474289320db24ea03564bdc46181d
7
+ data.tar.gz: 21f126a3e6bd20bda36b686953c268b2f4626c34d49fef97c5e437228bc7c3c10c2b196aa6ee3af0ea58b5b88a229acf6055142eb40239199c94e1daacd84bb0
data/bin/encrypt_env CHANGED
@@ -4,36 +4,32 @@
4
4
 
5
5
  require 'encrypt_env'
6
6
 
7
- COMMANDS = {
8
- 'setup' => EncryptEnv.setup,
9
- 'secrets' => EncryptEnv.secrets,
10
- 'secrets_all' => EncryptEnv.secrets_all,
11
- 'edit' => EncryptEnv.edit
12
- }.freeze
13
-
14
7
  argv = ARGV
15
8
  action = argv.shift
16
- command_class = COMMANDS[action]
17
- unless command_class
18
- if ['help', '--help', '-h'].include?(action)
19
- puts <<~HELP
20
- Usage:
21
- encrypt_env setup
22
- encrypt_env secrets
23
- encrypt_env secrets_all
24
- encrypt_env edit
25
- HELP
26
9
 
27
- exit 0
28
- else
29
- puts "Unknown action: #{action}"
30
- exit 1
31
- end
32
- end
10
+ if action == 'setup'
11
+ EncryptEnv.setup
12
+ exit 0
13
+ elsif action == 'show'
14
+ EncryptEnv.show
15
+ exit 0
16
+ elsif action == 'all'
17
+ EncryptEnv.show_all
18
+ exit 0
19
+ elsif action == 'edit'
20
+ EncryptEnv.edit
21
+ exit 0
22
+ elsif ['help', '--help', '-h'].include?(action)
23
+ puts <<~HELP
24
+ Usage:
25
+ encrypt_env setup
26
+ encrypt_env secrets
27
+ encrypt_env secrets_all
28
+ encrypt_env edit
29
+ HELP
33
30
 
34
- begin
35
- command_class.call
36
- rescue ArgumentError => e
37
- puts e.message
31
+ exit 0
32
+ else
33
+ puts "Unknown action: #{action}"
38
34
  exit 1
39
35
  end
data/lib/encrypt_env.rb CHANGED
@@ -82,6 +82,8 @@ class EncryptEnv
82
82
  end
83
83
 
84
84
  def self.secrets
85
+ return @decrypted if @decrypted
86
+
85
87
  path_root unless @path_root
86
88
  @decrypted = HashWithIndifferentAccess.new(YAML.safe_load(
87
89
  decrypt, aliases: true
@@ -112,4 +114,12 @@ class EncryptEnv
112
114
  secrets unless @decrypted
113
115
  @decrypted[:staging]
114
116
  end
117
+
118
+ def self.show
119
+ puts secrets.inspect
120
+ end
121
+
122
+ def self.show_all
123
+ puts secrets_all.inspect
124
+ end
115
125
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encrypt_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nhu Tan
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
- rubygems_version: 3.3.7
41
+ rubygems_version: 3.0.3.1
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Ecrypt secrets.yml file