cfn-guardian 0.6.5 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e13aeec66b2fd0beaaefac66257555ab629c777b3377e41829c16106a5fbde8a
4
- data.tar.gz: 3e2a2f21d9bbc278f055a08256a4653e13649705f608f3f083d1e637bb4198d4
3
+ metadata.gz: 6f1339a9ee76341525bd679f5682800ed34387de43601f92d21c9ad4b66021d7
4
+ data.tar.gz: 683b16c8373348dbdc1bb2a678631ffebd4c08e787bd41746c3b05374cc1c721
5
5
  SHA512:
6
- metadata.gz: 6d617f561808d69040b13835627e07b0a5993750dfed7b0d97086b567542647f0189934994e29d651a06106879ada46f185fa0cc7eafd17dc8486fbf121aa0cb
7
- data.tar.gz: 01b5c57874c7df8bff6ea5b3853e43cbec02c140c8043c89fa110b73130a5a124da4f521cd1fbb0c1a4136c6aa0e7d9f1d6b163c9cf36f9c5347931e2d663f92
6
+ metadata.gz: d5bee032c069e3995094fe772946fb64ccd929d0817bfbac830e9170af989996178f2fd466ef07400450ac6b8ae8d50bf7cf671b6a28e45cab9d9af487f68642
7
+ data.tar.gz: ea60eea9cc8fb21677234b04a37a60c772191a8f1a39c330af7c44c7c595e0f84927b04d29658618d1aef2625b090013f6940fb3afe8d3b9e493c5f0d24fb36a
data/lib/cfnguardian.rb CHANGED
@@ -299,14 +299,18 @@ module CfnGuardian
299
299
  LONG
300
300
  method_option :region, aliases: :r, type: :string, desc: "set the AWS region"
301
301
  method_option :repository, type: :string, default: 'guardian', desc: "codecommit repository name"
302
+ method_option :branch, type: :string, default: 'master', desc: "codecommit branch"
303
+ method_option :count, type: :numeric, default: 10, desc: "number of last commits to retrieve"
302
304
 
303
305
  def show_config_history
304
306
  set_region(options[:region],true)
305
307
 
306
- history = CfnGuardian::CodeCommit.new(options[:repository]).get_commit_history()
307
- puts Terminal::Table.new(
308
- :headings => history.first.keys.map{|h| h.to_s.to_heading},
309
- :rows => history.map(&:values))
308
+ history = CfnGuardian::CodeCommit.new(options[:repository]).get_commit_history(options[:branch], options[:count])
309
+ if history.any?
310
+ puts Terminal::Table.new(
311
+ :headings => history.first.keys.map{|h| h.to_s.to_heading},
312
+ :rows => history.map(&:values))
313
+ end
310
314
  end
311
315
 
312
316
  desc "show-pipeline", "Shows the current state of the AWS code pipeline"
@@ -19,9 +19,18 @@ module CfnGuardian
19
19
  return resp.branch.commit_id
20
20
  end
21
21
 
22
- def get_commit_history(branch='master',count=10)
22
+ def get_commit_history(branch,count)
23
23
  history = []
24
- commit = get_last_commit(branch)
24
+
25
+ begin
26
+ commit = get_last_commit(branch)
27
+ rescue Aws::CodeCommit::Errors::BranchDoesNotExistException => e
28
+ logger.error "Branch #{branch} does not exist in the #{@repo_name} repository"
29
+ return []
30
+ rescue Aws::CodeCommit::Errors::RepositoryDoesNotExistException => e
31
+ logger.error "Respository #{@repo_name} does not exist in this AWS account or region"
32
+ return []
33
+ end
25
34
 
26
35
  count.times do
27
36
 
@@ -1,4 +1,4 @@
1
1
  module CfnGuardian
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  CHANGE_SET_VERSION = VERSION.gsub('.', '-').freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-guardian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guslington
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor