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 +4 -4
- data/lib/cfnguardian.rb +8 -4
- data/lib/cfnguardian/codecommit.rb +11 -2
- data/lib/cfnguardian/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f1339a9ee76341525bd679f5682800ed34387de43601f92d21c9ad4b66021d7
|
4
|
+
data.tar.gz: 683b16c8373348dbdc1bb2a678631ffebd4c08e787bd41746c3b05374cc1c721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
308
|
-
|
309
|
-
|
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
|
22
|
+
def get_commit_history(branch,count)
|
23
23
|
history = []
|
24
|
-
|
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
|
|
data/lib/cfnguardian/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|