stax 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff348fae4586ba8565b0716cafbd57a2804fa9ead68069195ec351815833201b
4
- data.tar.gz: dcae498f9406661f84112b0034c15a844a1945ef746e19188c05fce565c8e9ed
3
+ metadata.gz: 75641822b021f927037f37d69b733a2a6fd2a894f20da3094ff922b9af846bd5
4
+ data.tar.gz: ecfa6da9d9b67ce326c199c94e4709e6f3debcf223636d57e0f0e466884e6eef
5
5
  SHA512:
6
- metadata.gz: e6469ff904a334f9fd228f14c754c59f6b273d9bd0916ca367cabdad103f72d29993f45f6101a12215249197d32fc7dd6cfa1bd78cdbe45c17508b0baa24f223
7
- data.tar.gz: 75cae424254fc98fb6696051b2d08e3f1c6a045f54c64e257fb78a6cf65ad6f86f220ab5482568803e396568ae7a5d64b677577b69674ff99f9c455095ec0b38
6
+ metadata.gz: a4ff5cdf4ffeb7bd24f5bcf2df160e725d84b45a13feb40d4886ccb351ae2f3abacff951159855da0aa23fd92025adcc620875c5b07c8ca406139268e3243903
7
+ data.tar.gz: fb6672ac0878c1bd28266d5a06ce90d9bd477c911ed0755200c9246ba5836be35d9d12add0c8d8015432d94166fc395374c03e457afd401db348b7af691d3b84
@@ -132,6 +132,12 @@ module Stax
132
132
  end
133
133
  end
134
134
 
135
+ ## run desktop open command
136
+ def os_open(*args)
137
+ cmd = RUBY_PLATFORM.end_with?('linux') ? 'xdg-open' : 'open'
138
+ system(cmd, *args)
139
+ end
140
+
135
141
  end
136
142
  end
137
- end
143
+ end
@@ -14,6 +14,7 @@ module Stax
14
14
  def stack_project_names
15
15
  @_stack_project_names ||= stack_projects.map(&:physical_resource_id)
16
16
  end
17
+
17
18
  end
18
19
 
19
20
  module Cmd
@@ -34,6 +35,17 @@ module Stax
34
35
  status = p.phase_status || (p.phase_type == 'COMPLETED' ? '' : 'in progress')
35
36
  puts "%-16s %-12s %4s %s" % [p.phase_type, color(status, COLORS), duration, p.end_time]
36
37
  end
38
+
39
+ ## latest run id for a build project
40
+ def latest_run(name)
41
+ Aws::Codebuild.builds_for_project(name, 1).first
42
+ end
43
+
44
+ ## aws console link to latest project run
45
+ def latest_run_link(name)
46
+ id = latest_run(name)
47
+ "https://console.aws.amazon.com/codesuite/codebuild/#{aws_account_id}/projects/#{name}/build/#{id}/?region=#{aws_region}"
48
+ end
37
49
  end
38
50
 
39
51
  desc 'projects', 'list projects'
@@ -118,6 +130,20 @@ module Stax
118
130
  tail build.id
119
131
  end
120
132
 
133
+ desc 'link', 'link to latest run for builds'
134
+ def link
135
+ my.stack_project_names.map do |name|
136
+ puts latest_run_link(name)
137
+ end
138
+ end
139
+
140
+ desc 'open', 'open latest run in aws console'
141
+ def open
142
+ my.stack_project_names.map do |name|
143
+ os_open(latest_run_link(name))
144
+ end
145
+ end
146
+
121
147
  end
122
148
  end
123
- end
149
+ end
@@ -14,6 +14,12 @@ module Stax
14
14
  def stack_pipeline_names
15
15
  @_stack_pipeline_names ||= stack_pipelines.map(&:physical_resource_id)
16
16
  end
17
+
18
+ ## get status string for n-th pipeline
19
+ def stack_pipeline_status(n = 0)
20
+ name = stack_pipeline_names[n]
21
+ Aws::Codepipeline.executions(name, 1)&.first&.status
22
+ end
17
23
  end
18
24
 
19
25
  module Cmd
@@ -29,6 +35,12 @@ module Stax
29
35
  disabled: :red,
30
36
  }
31
37
 
38
+ no_commands do
39
+ def pipeline_link(name)
40
+ "https://console.aws.amazon.com/codesuite/codepipeline/pipelines/#{name}/view?region=#{aws_region}"
41
+ end
42
+ end
43
+
32
44
  desc 'stages', 'list pipeline stages'
33
45
  def stages
34
46
  my.stack_pipeline_names.each do |name|
@@ -54,6 +66,14 @@ module Stax
54
66
  end
55
67
  end
56
68
 
69
+ ## print status as one of InProgress, Stopped, Stopping, Succeeded, Superseded, Failed
70
+ desc 'status', 'pipeline execution status'
71
+ def status
72
+ s = my.stack_pipeline_status
73
+ puts(s)
74
+ exit(1) if s == 'Failed'
75
+ end
76
+
57
77
  desc 'state', 'pipeline state'
58
78
  def state
59
79
  my.stack_pipeline_names.each do |name|
@@ -187,6 +207,20 @@ module Stax
187
207
  end
188
208
  end
189
209
 
210
+ desc 'link', 'link to pipelines in aws console'
211
+ def link
212
+ my.stack_pipeline_names.each do |name|
213
+ puts pipeline_link(name)
214
+ end
215
+ end
216
+
217
+ desc 'open', 'open pipelines in aws console'
218
+ def open
219
+ my.stack_pipeline_names.each do |name|
220
+ os_open(pipeline_link(name))
221
+ end
222
+ end
223
+
190
224
  end
191
225
  end
192
226
  end
@@ -1,3 +1,3 @@
1
1
  module Stax
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -624,7 +624,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
624
624
  - !ruby/object:Gem::Version
625
625
  version: '0'
626
626
  requirements: []
627
- rubygems_version: 3.0.3
627
+ rubygems_version: 3.1.2
628
628
  signing_key:
629
629
  specification_version: 4
630
630
  summary: Control Cloudformation stack and other stuff.