ops_team 0.3.0 → 0.4.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/secrets.rb +14 -4
  3. data/ops_team.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff1832331084939d3f2b4d0b58fa2e50715051bdff1c82e984dfb289aee64a15
4
- data.tar.gz: e2ecb1f387ce50d5c81500c29f0c67e727d105c66007dc090f67400c1617a4a5
3
+ metadata.gz: a818c3a6f9c810468c58fac9589aec995198d01ecdf1c226ba7531e50b7f8976
4
+ data.tar.gz: 0d25bf9e8e30e73939e134f2c258a12d087c4724d1ae4819f66813873e289771
5
5
  SHA512:
6
- metadata.gz: cac44a0b4576375fac4210493292537c84b7ef0be6d3c38a16cf17f854058026184f0e96d3a61d4d6a54c226db4b90256844980f5d746120b5e0c3530610c0c0
7
- data.tar.gz: b9d1c6be114864c3890b9a391f0f82f481c1bd556349500e8787fbfe960c30604ce04d8f5f5d94f5445c0912cf941798b414343e3f6a55d56c13ff14c0df8488
6
+ metadata.gz: d1dacb5ff0fc5c4839143ab957d86c20b0e17d304ba11fec4784ea59c496ed86995aed268dca23df8b2e32712934ff6d8f1f248704b3ef628e7d4444a5b81e9d
7
+ data.tar.gz: a1bc4be2d8f04c81cc48de7944cb4bbb2e49c9bad7c0962bbefd925ada750ba8fa4cc5690c6e64ee817c7580cd8112d832dd644222a04fdfde31ee8b13eadd0f
@@ -9,22 +9,28 @@ require 'options'
9
9
  class Secrets < AppConfig
10
10
  class << self
11
11
  def load
12
- Secrets.new(expand_path(Options.get("secrets.path"))).load
12
+ Secrets.new(secrets_path).load
13
13
  end
14
14
 
15
15
  private
16
16
 
17
+ def secrets_path
18
+ expand_path(Options.get("secrets.path"))
19
+ end
20
+
17
21
  def expand_path(path)
18
22
  `echo #{path}`.chomp
19
23
  end
20
24
  end
21
25
 
26
+ def initialize(filename = "")
27
+ @filename = filename.empty? ? default_filename : actual_filename_for(filename)
28
+ end
29
+
22
30
  private
23
31
 
24
32
  def default_filename
25
- return default_ejson_filename if File.exist?(default_ejson_filename)
26
-
27
- default_json_filename
33
+ File.exist?(default_ejson_filename) ? default_ejson_filename : default_json_filename
28
34
  end
29
35
 
30
36
  def default_ejson_filename
@@ -35,6 +41,10 @@ class Secrets < AppConfig
35
41
  "config/#{environment}/secrets.json"
36
42
  end
37
43
 
44
+ def actual_filename_for(filename)
45
+ File.exist?(filename) ? filename : filename.sub(".ejson", ".json")
46
+ end
47
+
38
48
  def file_contents
39
49
  @file_contents ||= @filename.match(/\.ejson$/) ? `ejson decrypt #{@filename}` : super
40
50
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '0.3.0'
5
+ s.version = '0.4.1'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_team
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com