ops_team 0.10.2 → 0.10.3

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: d9a12cfab8e68251d5651fdb580efaf961d21333a083df1bc7a8bc14ca08e498
4
- data.tar.gz: 0ddea0179d89116a9ed85c8c6f18dd24e9420cff0d3ae1c1a39aa2b983d0e7e3
3
+ metadata.gz: a78e3661dac6cc0796d00dc840eeb9fedbbc7f358bf3c6af4609d37175e8d53e
4
+ data.tar.gz: f919b18cdcec154a9dac78020c20f229771b3bd870baf86ef020002c74394acc
5
5
  SHA512:
6
- metadata.gz: 3b17c7f2bfb516da3ffa82acc5b1ac754a41f2b1a762e460c881a83561b874a925ed8cbdc555c53b5a9500681d77a46551086685936c58a4a1b35c9634614f56
7
- data.tar.gz: 3ddde96d1009c84725c2312e6df25a39e2743b12792e55e300a5dce8b61aac8453527f78c632a573c2507678c948a924d16d96155c9fac7fc5b28de1753a5c1a
6
+ metadata.gz: 54d21b402bce3e50963b679be2393a7cf1cd993fa51c2c73481c348c4fa019748d5511a4654d9c94c175a985bb7545580cf000594fd2a7c05c7a43d849895cdd
7
+ data.tar.gz: 64ef22c5c1a2264b3734166fef0b0752c2cc3ae18003ee376d1a86e0cba97d49fdb1c3de74606e0eb0aef050899d8e20c306165190d5cefc78dc030abe26997c
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class AppConfig
4
+ class ParsingError < StandardError; end
5
+
4
6
  class << self
5
7
  def load
6
8
  new(app_config_path).load
@@ -36,8 +38,7 @@ class AppConfig
36
38
  def config
37
39
  @config ||= file_contents ? YAML.safe_load(file_contents) : {}
38
40
  rescue YAML::SyntaxError => e
39
- Output.error("Error parsing config data: #{e}")
40
- {}
41
+ raise ParsingError, "Error parsing config data: #{e}"
41
42
  end
42
43
 
43
44
  def file_contents
data/lib/ops.rb CHANGED
@@ -18,6 +18,7 @@ class Ops
18
18
 
19
19
  INVALID_SYNTAX_EXIT_CODE = 64
20
20
  UNKNOWN_ACTION_EXIT_CODE = 65
21
+ ERROR_LOADING_APP_CONFIG_EXIT_CODE = 66
21
22
 
22
23
  class << self
23
24
  def project_name
@@ -60,6 +61,9 @@ class Ops
60
61
 
61
62
  Output.notice("Running '#{action}' from #{CONFIG_FILE} in environment '#{ENV['environment']}'...")
62
63
  action.run
64
+ rescue AppConfig::ParsingError => e
65
+ Output.error("Error parsing app config: #{e}")
66
+ exit(ERROR_LOADING_APP_CONFIG_EXIT_CODE)
63
67
  end
64
68
 
65
69
  def builtin
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'open3'
4
5
 
5
6
  require 'output'
6
7
  require 'app_config'
@@ -38,6 +39,19 @@ class Secrets < AppConfig
38
39
  end
39
40
 
40
41
  def file_contents
41
- @file_contents ||= @filename.match(/\.ejson$/) ? `ejson decrypt #{@filename}` : super
42
+ @file_contents ||= begin
43
+ @filename.match(/\.ejson$/) ? ejson_contents : super
44
+ end
45
+ end
46
+
47
+ def ejson_contents
48
+ @ejson_contents ||= begin
49
+ out, err, _status = Open3.capture3("ejson decrypt #{@filename}")
50
+
51
+ # TODO: err is only nil in testing, but I can't figure out why the stubbing isn't working
52
+ raise ParsingError, "Error decrypting EJSON file: #{err}" unless err.nil? || err.empty?
53
+
54
+ out
55
+ end
42
56
  end
43
57
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '0.10.2'
5
+ s.version = '0.10.3'
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.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com