cody 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/cody/base.rb +21 -0
- data/lib/cody/cli.rb +8 -0
- data/lib/cody/evaluate.rb +2 -0
- data/lib/cody/evaluate/interface.rb +12 -0
- data/lib/cody/help/stop.md +11 -0
- data/lib/cody/logs.rb +4 -15
- data/lib/cody/stop.rb +17 -0
- data/lib/cody/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53eb7e5d569f9ac01fc442092dc96b291ecb6769b7a392b24fa3158b62afd294
|
4
|
+
data.tar.gz: 812af356ba1149b27a0fdd170b66c1b6d0a16257ce4339c46ae25597c22bc0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 563fbd9bffdc2a04a7124e6ce363c40a143dec815d382f6ecc05827e10d865eaa64b2793e56a05f28ae5ed18466a1eddb58eb59c2a9c0765184e5dbd4864b5c5
|
7
|
+
data.tar.gz: 808f60f39fd12071dd5bcc07e110f9b4e735edea2d9096a9fd149bc1ceebc64dc67e54a610aabf419c58ba3846c9e9af7bd919bd551cfa15215efd864efd75e9
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.8.2]
|
7
|
+
- #9 add cody stop command
|
8
|
+
- #10 add evaluate interface methods
|
9
|
+
|
6
10
|
## [0.8.1]
|
7
11
|
- #8 report build time at end of logs
|
8
12
|
|
data/lib/cody/base.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Base only for Stop and Start currently.
|
2
|
+
module Cody
|
3
|
+
class Base
|
4
|
+
include AwsServices
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
@project_name = options[:project_name] || inferred_project_name
|
9
|
+
@full_project_name = project_name_convention(@project_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_with_exception_handling
|
13
|
+
yield
|
14
|
+
rescue Aws::CodeBuild::Errors::ResourceNotFoundException => e
|
15
|
+
puts "ERROR: #{e.class}: #{e.message}".color(:red)
|
16
|
+
puts "CodeBuild project #{@full_project_name} not found."
|
17
|
+
rescue Aws::CodeBuild::Errors::InvalidInputException => e
|
18
|
+
puts "ERROR: #{e.class}: #{e.message}".color(:red)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/cody/cli.rb
CHANGED
@@ -41,6 +41,14 @@ module Cody
|
|
41
41
|
Start.new(options.merge(project_name: project_name)).run
|
42
42
|
end
|
43
43
|
|
44
|
+
desc "stop", "stop codebuild project."
|
45
|
+
long_desc Help.text(:stop)
|
46
|
+
option :build_id, desc: "Project build id. Defaults to most recent."
|
47
|
+
common_options.call
|
48
|
+
def stop(project_name=nil)
|
49
|
+
Stop.new(options.merge(project_name: project_name)).run
|
50
|
+
end
|
51
|
+
|
44
52
|
desc "logs", "Prints out logs for codebuild project."
|
45
53
|
long_desc Help.text(:logs)
|
46
54
|
option :build_id, desc: "Project build id. Defaults to most recent."
|
data/lib/cody/evaluate.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Cody::Evaluate
|
2
|
+
module Interface
|
3
|
+
# Useful interface methods if want to run more generalized code in the evaluated DSL files
|
4
|
+
def project_name
|
5
|
+
@options["project_name"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def full_project_name
|
9
|
+
@options["full_project_name"]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Examples
|
2
|
+
|
3
|
+
cody stop # infers the name from the parent folder
|
4
|
+
cody stop stack-name # looks up project via CloudFormation stack
|
5
|
+
cody stop demo-project # looks up project via codebuild project name
|
6
|
+
|
7
|
+
## Type Option
|
8
|
+
|
9
|
+
Examples
|
10
|
+
|
11
|
+
cody stop --type vpc
|
data/lib/cody/logs.rb
CHANGED
@@ -1,20 +1,9 @@
|
|
1
1
|
module Cody
|
2
|
-
class Logs
|
3
|
-
include AwsServices
|
4
|
-
|
5
|
-
def initialize(options)
|
6
|
-
@options = options
|
7
|
-
@project_name = options[:project_name] || inferred_project_name
|
8
|
-
@full_project_name = project_name_convention(@project_name)
|
9
|
-
end
|
10
|
-
|
2
|
+
class Logs < Base
|
11
3
|
def run
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
puts "CodeBuild project #{@full_project_name} not found."
|
16
|
-
rescue Aws::CodeBuild::Errors::InvalidInputException => e
|
17
|
-
puts "ERROR: #{e.class}: #{e.message}".color(:red)
|
4
|
+
run_with_exception_handling do
|
5
|
+
Tailer.new(@options, build_id).run
|
6
|
+
end
|
18
7
|
end
|
19
8
|
|
20
9
|
def build_id
|
data/lib/cody/stop.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Cody
|
2
|
+
class Stop < Base
|
3
|
+
def run
|
4
|
+
run_with_exception_handling do
|
5
|
+
codebuild.stop_build(id: build_id)
|
6
|
+
puts "Build has been stopped: #{build_id}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_id
|
11
|
+
return @options[:build_id] if @options[:build_id]
|
12
|
+
|
13
|
+
resp = codebuild.list_builds_for_project(project_name: @full_project_name)
|
14
|
+
resp.ids.first # most recent build_id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/cody/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cody
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -263,6 +263,7 @@ files:
|
|
263
263
|
- lib/cody/autoloader.rb
|
264
264
|
- lib/cody/aws_services.rb
|
265
265
|
- lib/cody/aws_services/helpers.rb
|
266
|
+
- lib/cody/base.rb
|
266
267
|
- lib/cody/cli.rb
|
267
268
|
- lib/cody/command.rb
|
268
269
|
- lib/cody/completer.rb
|
@@ -278,6 +279,7 @@ files:
|
|
278
279
|
- lib/cody/dsl/role.rb
|
279
280
|
- lib/cody/dsl/schedule.rb
|
280
281
|
- lib/cody/evaluate.rb
|
282
|
+
- lib/cody/evaluate/interface.rb
|
281
283
|
- lib/cody/help.rb
|
282
284
|
- lib/cody/help/completion.md
|
283
285
|
- lib/cody/help/completion_script.md
|
@@ -285,6 +287,7 @@ files:
|
|
285
287
|
- lib/cody/help/init.md
|
286
288
|
- lib/cody/help/logs.md
|
287
289
|
- lib/cody/help/start.md
|
290
|
+
- lib/cody/help/stop.md
|
288
291
|
- lib/cody/init.rb
|
289
292
|
- lib/cody/logs.rb
|
290
293
|
- lib/cody/project.rb
|
@@ -294,6 +297,7 @@ files:
|
|
294
297
|
- lib/cody/setting.rb
|
295
298
|
- lib/cody/stack.rb
|
296
299
|
- lib/cody/start.rb
|
300
|
+
- lib/cody/stop.rb
|
297
301
|
- lib/cody/tailer.rb
|
298
302
|
- lib/cody/update.rb
|
299
303
|
- lib/cody/variables.rb
|