codebuild 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.codebuild/buildspec.yml +8 -0
  3. data/.codebuild/project.rb +16 -0
  4. data/.gitignore +2 -0
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +7 -0
  7. data/README.md +118 -4
  8. data/codebuild.gemspec +5 -2
  9. data/lib/codebuild/aws_services/helpers.rb +52 -0
  10. data/lib/codebuild/aws_services.rb +17 -0
  11. data/lib/codebuild/cli.rb +50 -4
  12. data/lib/codebuild/create.rb +12 -0
  13. data/lib/codebuild/delete.rb +26 -0
  14. data/lib/codebuild/deploy.rb +11 -0
  15. data/lib/codebuild/dsl/project/ssm.rb +22 -0
  16. data/lib/codebuild/dsl/project.rb +116 -0
  17. data/lib/codebuild/dsl/role.rb +40 -0
  18. data/lib/codebuild/dsl.rb +8 -0
  19. data/lib/codebuild/evaluate.rb +52 -0
  20. data/lib/codebuild/help/deploy.md +8 -0
  21. data/lib/codebuild/help/init.md +24 -0
  22. data/lib/codebuild/help/start.md +6 -0
  23. data/lib/codebuild/init.rb +75 -0
  24. data/lib/codebuild/project.rb +62 -0
  25. data/lib/codebuild/role.rb +73 -0
  26. data/lib/codebuild/sequence.rb +60 -0
  27. data/lib/codebuild/stack.rb +34 -0
  28. data/lib/codebuild/start.rb +39 -0
  29. data/lib/codebuild/update.rb +12 -0
  30. data/lib/codebuild/version.rb +1 -1
  31. data/lib/codebuild.rb +14 -2
  32. data/lib/template/.codebuild/buildspec.yml +12 -4
  33. data/lib/template/.codebuild/project.rb.tt +17 -0
  34. data/lib/template/.codebuild/role.rb +1 -0
  35. data/readme/full_dsl.md +84 -0
  36. data/readme/github_oauth.md +37 -0
  37. data/readme/lookup.md +34 -0
  38. data/spec/fixtures/app/.codebuild/project.rb +2 -0
  39. data/spec/fixtures/app/.codebuild/role.rb +1 -0
  40. data/spec/lib/cli_spec.rb +10 -30
  41. data/spec/lib/project_spec.rb +12 -0
  42. data/spec/lib/role_spec.rb +12 -0
  43. metadata +83 -10
  44. data/Gemfile.lock +0 -80
  45. data/lib/codebuild/help/hello.md +0 -5
  46. data/lib/template/.codebuild/buildspec-example.yml +0 -37
  47. data/lib/template/.codebuild/project.rb +0 -17
data/spec/lib/cli_spec.rb CHANGED
@@ -1,38 +1,18 @@
1
- require "spec_helper"
2
-
3
1
  describe Codebuild::CLI do
4
2
  before(:all) do
5
- @args = "--from Tung"
3
+ @args = "--noop"
4
+ @old_root = Dir.pwd
5
+ Dir.chdir("spec/fixtures/app")
6
+ @codebuild_bin = "../../../exe/codebuild"
7
+ end
8
+ after(:all) do
9
+ Dir.chdir(@old_root)
6
10
  end
7
11
 
8
12
  describe "codebuild" do
9
- it "hello" do
10
- out = execute("exe/codebuild hello world #{@args}")
11
- expect(out).to include("from: Tung\nHello world")
12
- end
13
-
14
- it "goodbye" do
15
- out = execute("exe/codebuild sub goodbye world #{@args}")
16
- expect(out).to include("from: Tung\nGoodbye world")
17
- end
18
-
19
- commands = {
20
- "hell" => "hello",
21
- "hello" => "name",
22
- "hello -" => "--from",
23
- "hello name" => "--from",
24
- "hello name --" => "--from",
25
- "sub goodb" => "goodbye",
26
- "sub goodbye" => "name",
27
- "sub goodbye name" => "--from",
28
- "sub goodbye name --" => "--from",
29
- "sub goodbye name --from" => "--help",
30
- }
31
- commands.each do |command, expected_word|
32
- it "completion #{command}" do
33
- out = execute("exe/codebuild completion #{command}")
34
- expect(out).to include(expected_word) # only checking for one word for simplicity
35
- end
13
+ it "deploy" do
14
+ out = execute("#{@codebuild_bin} deploy #{@args}")
15
+ expect(out).to include("Generated CloudFormation template")
36
16
  end
37
17
  end
38
18
  end
@@ -0,0 +1,12 @@
1
+ describe Codebuild::Project do
2
+ let(:project) do
3
+ Codebuild::Project.new(project_path: "spec/fixtures/app/.codebuild/project.rb")
4
+ end
5
+ context "general" do
6
+ it "builds up the template in memory" do
7
+ template = project.run
8
+ expect(template.keys).to eq ["CodeBuild"]
9
+ expect(template["CodeBuild"]).to be_a(Hash)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ describe Codebuild::Role do
2
+ let(:role) do
3
+ Codebuild::Role.new(role_path: "spec/fixtures/app/.codebuild/role.rb")
4
+ end
5
+ context "general" do
6
+ it "builds up the template in memory" do
7
+ template = role.run
8
+ expect(template.keys).to eq ["IamRole"]
9
+ expect(template["IamRole"]).to be_a(Hash)
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rainbow
28
+ name: aws-sdk-cloudformation
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: thor
42
+ name: aws-sdk-codebuild
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,49 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: aws-sdk-codebuild
56
+ name: aws-sdk-ssm
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cfn_camelizer
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rainbow
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor
57
99
  requirement: !ruby/object:Gem::Requirement
58
100
  requirements:
59
101
  - - ">="
@@ -144,11 +186,12 @@ executables:
144
186
  extensions: []
145
187
  extra_rdoc_files: []
146
188
  files:
189
+ - ".codebuild/buildspec.yml"
190
+ - ".codebuild/project.rb"
147
191
  - ".gitignore"
148
192
  - ".rspec"
149
193
  - CHANGELOG.md
150
194
  - Gemfile
151
- - Gemfile.lock
152
195
  - Guardfile
153
196
  - LICENSE.txt
154
197
  - README.md
@@ -156,20 +199,46 @@ files:
156
199
  - codebuild.gemspec
157
200
  - exe/codebuild
158
201
  - lib/codebuild.rb
202
+ - lib/codebuild/aws_services.rb
203
+ - lib/codebuild/aws_services/helpers.rb
159
204
  - lib/codebuild/cli.rb
160
205
  - lib/codebuild/command.rb
161
206
  - lib/codebuild/completer.rb
162
207
  - lib/codebuild/completer/script.rb
163
208
  - lib/codebuild/completer/script.sh
209
+ - lib/codebuild/create.rb
210
+ - lib/codebuild/delete.rb
211
+ - lib/codebuild/deploy.rb
212
+ - lib/codebuild/dsl.rb
213
+ - lib/codebuild/dsl/project.rb
214
+ - lib/codebuild/dsl/project/ssm.rb
215
+ - lib/codebuild/dsl/role.rb
216
+ - lib/codebuild/evaluate.rb
164
217
  - lib/codebuild/help.rb
165
218
  - lib/codebuild/help/completion.md
166
219
  - lib/codebuild/help/completion_script.md
167
- - lib/codebuild/help/hello.md
220
+ - lib/codebuild/help/deploy.md
221
+ - lib/codebuild/help/init.md
222
+ - lib/codebuild/help/start.md
223
+ - lib/codebuild/init.rb
224
+ - lib/codebuild/project.rb
225
+ - lib/codebuild/role.rb
226
+ - lib/codebuild/sequence.rb
227
+ - lib/codebuild/stack.rb
228
+ - lib/codebuild/start.rb
229
+ - lib/codebuild/update.rb
168
230
  - lib/codebuild/version.rb
169
- - lib/template/.codebuild/buildspec-example.yml
170
231
  - lib/template/.codebuild/buildspec.yml
171
- - lib/template/.codebuild/project.rb
232
+ - lib/template/.codebuild/project.rb.tt
233
+ - lib/template/.codebuild/role.rb
234
+ - readme/full_dsl.md
235
+ - readme/github_oauth.md
236
+ - readme/lookup.md
237
+ - spec/fixtures/app/.codebuild/project.rb
238
+ - spec/fixtures/app/.codebuild/role.rb
172
239
  - spec/lib/cli_spec.rb
240
+ - spec/lib/project_spec.rb
241
+ - spec/lib/role_spec.rb
173
242
  - spec/spec_helper.rb
174
243
  homepage: https://github.com/tongueroo/codebuild
175
244
  licenses:
@@ -193,7 +262,11 @@ requirements: []
193
262
  rubygems_version: 3.0.2
194
263
  signing_key:
195
264
  specification_version: 4
196
- summary: Codebuild tool
265
+ summary: CodeBuild DSL Tool to Quickly Create CodeBuild Project
197
266
  test_files:
267
+ - spec/fixtures/app/.codebuild/project.rb
268
+ - spec/fixtures/app/.codebuild/role.rb
198
269
  - spec/lib/cli_spec.rb
270
+ - spec/lib/project_spec.rb
271
+ - spec/lib/role_spec.rb
199
272
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,80 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- codebuild (0.1.0)
5
- activesupport
6
- aws-sdk-codebuild
7
- rainbow
8
- thor
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- activesupport (5.2.3)
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
18
- aws-eventstream (1.0.2)
19
- aws-partitions (1.148.0)
20
- aws-sdk-codebuild (1.32.0)
21
- aws-sdk-core (~> 3, >= 3.48.2)
22
- aws-sigv4 (~> 1.1)
23
- aws-sdk-core (3.48.3)
24
- aws-eventstream (~> 1.0, >= 1.0.2)
25
- aws-partitions (~> 1.0)
26
- aws-sigv4 (~> 1.1)
27
- jmespath (~> 1.0)
28
- aws-sigv4 (1.1.0)
29
- aws-eventstream (~> 1.0, >= 1.0.2)
30
- byebug (11.0.1)
31
- cli_markdown (0.1.0)
32
- codeclimate-test-reporter (1.0.9)
33
- simplecov (<= 0.13)
34
- concurrent-ruby (1.1.5)
35
- diff-lcs (1.3)
36
- docile (1.1.5)
37
- i18n (1.6.0)
38
- concurrent-ruby (~> 1.0)
39
- jmespath (1.4.0)
40
- json (2.2.0)
41
- minitest (5.11.3)
42
- rainbow (3.0.0)
43
- rake (12.3.2)
44
- rspec (3.8.0)
45
- rspec-core (~> 3.8.0)
46
- rspec-expectations (~> 3.8.0)
47
- rspec-mocks (~> 3.8.0)
48
- rspec-core (3.8.0)
49
- rspec-support (~> 3.8.0)
50
- rspec-expectations (3.8.2)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.8.0)
53
- rspec-mocks (3.8.0)
54
- diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.8.0)
56
- rspec-support (3.8.0)
57
- simplecov (0.13.0)
58
- docile (~> 1.1.0)
59
- json (>= 1.8, < 3)
60
- simplecov-html (~> 0.10.0)
61
- simplecov-html (0.10.2)
62
- thor (0.20.3)
63
- thread_safe (0.3.6)
64
- tzinfo (1.2.5)
65
- thread_safe (~> 0.1)
66
-
67
- PLATFORMS
68
- ruby
69
-
70
- DEPENDENCIES
71
- bundler
72
- byebug
73
- cli_markdown
74
- codebuild!
75
- codeclimate-test-reporter
76
- rake
77
- rspec
78
-
79
- BUNDLED WITH
80
- 2.0.1
@@ -1,5 +0,0 @@
1
- Examples:
2
-
3
- codebuild hello
4
- codebuild hello NAME
5
- codebuild hello NAME --from me
@@ -1,37 +0,0 @@
1
- version: 0.2
2
-
3
- #env:
4
- #variables:
5
- # key: "value"
6
- # key: "value"
7
- #parameter-store:
8
- # key: "value"
9
- # key: "value"
10
-
11
- phases:
12
- #install:
13
- #commands:
14
- # - command
15
- # - command
16
- #pre_build:
17
- #commands:
18
- # - command
19
- # - command
20
- build:
21
- commands:
22
- # - command
23
- # - command
24
- #post_build:
25
- #commands:
26
- # - command
27
- # - command
28
- #artifacts:
29
- #files:
30
- # - location
31
- # - location
32
- #name: $(date +%Y-%m-%d)
33
- #discard-paths: yes
34
- #base-directory: location
35
- #cache:
36
- #paths:
37
- # - paths
@@ -1,17 +0,0 @@
1
- # name
2
- # description
3
- # source
4
- # artifacts
5
- # cache
6
- # environment
7
- # service_role
8
- # timeout_in_minutes
9
-
10
- # badge_enabled
11
- # encryption_key
12
- # logs_config
13
- # queued_timeout_in_minutes
14
- # tags
15
- # vpc_config
16
- # secondary_artifacts
17
- # secondary_sources