codebuild 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/codebuild.gemspec +8 -3
  4. data/lib/codebuild/version.rb +1 -1
  5. data/vendor/aws_data/CHANGELOG.md +7 -0
  6. data/vendor/aws_data/Gemfile +4 -0
  7. data/{docs/LICENSE → vendor/aws_data/LICENSE.txt} +4 -4
  8. data/vendor/aws_data/README.md +42 -0
  9. data/vendor/aws_data/Rakefile +6 -0
  10. data/vendor/aws_data/aws_data.gemspec +30 -0
  11. data/vendor/aws_data/bin/console +14 -0
  12. data/vendor/aws_data/bin/setup +8 -0
  13. data/vendor/aws_data/lib/aws_data.rb +91 -0
  14. data/vendor/aws_data/lib/aws_data/version.rb +3 -0
  15. data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
  16. data/vendor/aws_data/spec/spec_helper.rb +14 -0
  17. data/vendor/cfn-status/Gemfile +4 -0
  18. data/vendor/cfn-status/LICENSE.txt +21 -0
  19. data/vendor/cfn-status/README.md +56 -0
  20. data/vendor/cfn-status/Rakefile +6 -0
  21. data/vendor/cfn-status/bin/console +14 -0
  22. data/vendor/cfn-status/bin/setup +8 -0
  23. data/vendor/cfn-status/cfn-status.gemspec +30 -0
  24. data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
  25. data/vendor/cfn-status/lib/cfn/status.rb +220 -0
  26. data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
  27. data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
  28. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  29. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  30. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  31. data/vendor/cfn-status/spec/spec_helper.rb +14 -0
  32. data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
  33. data/vendor/cfn_camelizer/Gemfile +4 -0
  34. data/vendor/cfn_camelizer/LICENSE.txt +21 -0
  35. data/vendor/cfn_camelizer/README.md +40 -0
  36. data/vendor/cfn_camelizer/Rakefile +6 -0
  37. data/vendor/cfn_camelizer/bin/console +14 -0
  38. data/vendor/cfn_camelizer/bin/setup +8 -0
  39. data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
  40. data/vendor/cfn_camelizer/lib/camelizer.yml +33 -0
  41. data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
  42. data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
  43. data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
  44. data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
  45. metadata +46 -173
  46. data/docs/.gitignore +0 -4
  47. data/docs/CNAME +0 -1
  48. data/docs/Gemfile +0 -3
  49. data/docs/README.md +0 -25
  50. data/docs/_config.yml +0 -73
  51. data/docs/_docs/contributing.md +0 -99
  52. data/docs/_docs/conventions.md +0 -51
  53. data/docs/_docs/deploy.md +0 -69
  54. data/docs/_docs/dsl.md +0 -12
  55. data/docs/_docs/dsl/project.md +0 -80
  56. data/docs/_docs/dsl/role.md +0 -79
  57. data/docs/_docs/dsl/schedule.md +0 -29
  58. data/docs/_docs/examples.md +0 -12
  59. data/docs/_docs/examples/ecs.md +0 -107
  60. data/docs/_docs/examples/jets.md +0 -79
  61. data/docs/_docs/examples/ruby.md +0 -44
  62. data/docs/_docs/github_oauth.md +0 -51
  63. data/docs/_docs/install.md +0 -14
  64. data/docs/_docs/next-steps.md +0 -16
  65. data/docs/_docs/settings.md +0 -34
  66. data/docs/_docs/start.md +0 -51
  67. data/docs/_docs/type-option.md +0 -72
  68. data/docs/_docs/variables.md +0 -117
  69. data/docs/_includes/commands.html +0 -88
  70. data/docs/_includes/content.html +0 -25
  71. data/docs/_includes/edit-on-github.html +0 -9
  72. data/docs/_includes/examples-steps.md +0 -17
  73. data/docs/_includes/footer.html +0 -41
  74. data/docs/_includes/google_analytics.html +0 -10
  75. data/docs/_includes/head.html +0 -45
  76. data/docs/_includes/js.html +0 -15
  77. data/docs/_includes/nav.html +0 -17
  78. data/docs/_includes/prev_next.md +0 -19
  79. data/docs/_includes/reference.md +0 -1
  80. data/docs/_includes/subnav.html +0 -38
  81. data/docs/_includes/tutorials.md +0 -38
  82. data/docs/_layouts/default.html +0 -12
  83. data/docs/_reference/cb-completion.md +0 -44
  84. data/docs/_reference/cb-completion_script.md +0 -25
  85. data/docs/_reference/cb-delete.md +0 -26
  86. data/docs/_reference/cb-deploy.md +0 -58
  87. data/docs/_reference/cb-init.md +0 -88
  88. data/docs/_reference/cb-start.md +0 -43
  89. data/docs/_reference/cb-version.md +0 -21
  90. data/docs/_sass/_bootstrap-overrides.scss +0 -40
  91. data/docs/_sass/_contact.scss +0 -49
  92. data/docs/_sass/_cta.scss +0 -37
  93. data/docs/_sass/_download.scss +0 -31
  94. data/docs/_sass/_features.scss +0 -47
  95. data/docs/_sass/_footer.scss +0 -49
  96. data/docs/_sass/_global.scss +0 -102
  97. data/docs/_sass/_main.scss +0 -364
  98. data/docs/_sass/_masthead.scss +0 -70
  99. data/docs/_sass/_mixins.scss +0 -79
  100. data/docs/_sass/_navbar.scss +0 -92
  101. data/docs/_sass/_syntax.scss +0 -65
  102. data/docs/_sass/_table.scss +0 -34
  103. data/docs/_sass/_timeline.scss +0 -207
  104. data/docs/_sass/_variables.scss +0 -24
  105. data/docs/bin/web +0 -8
  106. data/docs/docs.md +0 -22
  107. data/docs/img/docs/codebuild-output.png +0 -0
  108. data/docs/img/logos/boltops-logo-full.png +0 -0
  109. data/docs/img/logos/boltops-logo.png +0 -0
  110. data/docs/img/logos/project-logo.png +0 -0
  111. data/docs/index.html +0 -35
  112. data/docs/js/nav.js +0 -39
  113. data/docs/js/new-age.js +0 -38
  114. data/docs/js/new-age.min.js +0 -6
  115. data/docs/new-age.scss +0 -20
  116. data/docs/quick-start.md +0 -72
  117. data/docs/reference.md +0 -12
  118. data/docs/support.md +0 -22
  119. data/docs/vendor/bootstrap/css/bootstrap-grid.css +0 -1339
  120. data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +0 -1
  121. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +0 -1
  122. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +0 -1
  123. data/docs/vendor/bootstrap/css/bootstrap-reboot.css +0 -459
  124. data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +0 -1
  125. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +0 -1
  126. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +0 -1
  127. data/docs/vendor/bootstrap/css/bootstrap.css +0 -9320
  128. data/docs/vendor/bootstrap/css/bootstrap.css.map +0 -1
  129. data/docs/vendor/bootstrap/css/bootstrap.min.css +0 -6
  130. data/docs/vendor/bootstrap/css/bootstrap.min.css.map +0 -1
  131. data/docs/vendor/bootstrap/js/bootstrap.js +0 -3535
  132. data/docs/vendor/bootstrap/js/bootstrap.min.js +0 -7
  133. data/docs/vendor/font-awesome/css/font-awesome.css +0 -2337
  134. data/docs/vendor/font-awesome/css/font-awesome.min.css +0 -4
  135. data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  136. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  137. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
  138. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  139. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  140. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  141. data/docs/vendor/font-awesome/less/animated.less +0 -34
  142. data/docs/vendor/font-awesome/less/bordered-pulled.less +0 -25
  143. data/docs/vendor/font-awesome/less/core.less +0 -12
  144. data/docs/vendor/font-awesome/less/fixed-width.less +0 -6
  145. data/docs/vendor/font-awesome/less/font-awesome.less +0 -18
  146. data/docs/vendor/font-awesome/less/icons.less +0 -789
  147. data/docs/vendor/font-awesome/less/larger.less +0 -13
  148. data/docs/vendor/font-awesome/less/list.less +0 -19
  149. data/docs/vendor/font-awesome/less/mixins.less +0 -60
  150. data/docs/vendor/font-awesome/less/path.less +0 -15
  151. data/docs/vendor/font-awesome/less/rotated-flipped.less +0 -20
  152. data/docs/vendor/font-awesome/less/screen-reader.less +0 -5
  153. data/docs/vendor/font-awesome/less/stacked.less +0 -20
  154. data/docs/vendor/font-awesome/less/variables.less +0 -799
  155. data/docs/vendor/font-awesome/scss/_animated.scss +0 -34
  156. data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +0 -25
  157. data/docs/vendor/font-awesome/scss/_core.scss +0 -12
  158. data/docs/vendor/font-awesome/scss/_fixed-width.scss +0 -6
  159. data/docs/vendor/font-awesome/scss/_icons.scss +0 -789
  160. data/docs/vendor/font-awesome/scss/_larger.scss +0 -13
  161. data/docs/vendor/font-awesome/scss/_list.scss +0 -19
  162. data/docs/vendor/font-awesome/scss/_mixins.scss +0 -60
  163. data/docs/vendor/font-awesome/scss/_path.scss +0 -15
  164. data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +0 -20
  165. data/docs/vendor/font-awesome/scss/_screen-reader.scss +0 -5
  166. data/docs/vendor/font-awesome/scss/_stacked.scss +0 -20
  167. data/docs/vendor/font-awesome/scss/_variables.scss +0 -799
  168. data/docs/vendor/font-awesome/scss/font-awesome.scss +0 -18
  169. data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +0 -59
  170. data/docs/vendor/jquery-easing/jquery.easing.js +0 -166
  171. data/docs/vendor/jquery-easing/jquery.easing.min.js +0 -1
  172. data/docs/vendor/jquery/jquery.js +0 -10253
  173. data/docs/vendor/jquery/jquery.min.js +0 -4
  174. data/docs/vendor/simple-line-icons/css/simple-line-icons.css +0 -778
  175. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
  176. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +0 -200
  177. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
  178. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
  179. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
  180. data/docs/vendor/simple-line-icons/less/simple-line-icons.less +0 -982
  181. data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +0 -979
  182. data/docs/vendor/tether/tether.js +0 -1811
  183. data/docs/vendor/tether/tether.min.js +0 -1
  184. data/spec/fixtures/app/.codebuild/project.rb +0 -2
  185. data/spec/fixtures/app/.codebuild/role.rb +0 -1
  186. data/spec/fixtures/app/.codebuild/schedule.rb +0 -1
  187. data/spec/fixtures/app/.codebuild/settings.yml +0 -13
  188. data/spec/lib/cli_spec.rb +0 -13
  189. data/spec/lib/project_spec.rb +0 -12
  190. data/spec/lib/role_spec.rb +0 -12
  191. data/spec/lib/schedule_spec.rb +0 -12
  192. data/spec/spec_helper.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: badd1e72fa3c3f4789dab4d592f6d26d14b75e6544b4dc2f51b0e363a95ca60c
4
- data.tar.gz: d7b8bd1d7e44f670b526acacc9efd00a8c102366379cd359e23e131814cb8ed2
3
+ metadata.gz: 695f236eeb7863aeaba5303ee06f684faef3baf7b3f6981dd33846c0257b2680
4
+ data.tar.gz: a86ee5e38adae8337da9ae4d615434a83a7c7bc9b4e04ad3ad703ca77a62da40
5
5
  SHA512:
6
- metadata.gz: a129f41b1259bb1611fe919244a3d4bf21145bc0378b6a1da652399351a587fce014ef34498b93282eda7ddc186eb8a4a34b174bd0a701fab439f6766dd1c6af
7
- data.tar.gz: 4e92c824e7c1d59bf9dfd1585bce64ad5acfe158927ea2dd7f33b291699d700b6e47fe065f764798b4c63aa015f488e0bc7c0c58d6358b4ae0c5b487f6ec435f
6
+ metadata.gz: 4bc2c08398900cc33f1bff9205e673b0aae7c051eeddd29a9999212cd1abd107ddf610ccbb3a4e7b5a2448b8b76f0f8a978d3df834000b36c505f9c15abf0a6b
7
+ data.tar.gz: c73e6436dd724bbd08ede3ca24c02dc2f65f8171314af3850bc7e715fe930f4b21f191407cb492331d03d39d3c2ef941320614b64c255d0513047d19e8ce5721
@@ -3,6 +3,9 @@
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.6.4]
7
+ - fix vendor gem dependencies in gem package
8
+
6
9
  ## [0.6.3]
7
10
  - add aws_data gem dependency
8
11
 
@@ -12,24 +12,29 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/tongueroo/codebuild"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.files = `git ls-files`.split($/)
15
+ vendor_files = Dir.glob("vendor/**/*")
16
+ gem_files = `git -C "#{File.dirname(__FILE__)}" ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features|docs)/})
18
+ end
19
+ spec.files = gem_files + vendor_files
16
20
  spec.bindir = "exe"
17
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
23
  spec.require_paths = ["lib"]
20
24
 
21
25
  spec.add_dependency "activesupport"
22
- spec.add_dependency "aws_data"
23
26
  spec.add_dependency "aws-sdk-cloudformation"
24
27
  spec.add_dependency "aws-sdk-codebuild"
25
28
  spec.add_dependency "aws-sdk-ssm"
26
- # spec.add_dependency "cfn_camelizer" # using vendor/cfn_camelizer for now
27
29
  spec.add_dependency "memoist"
28
30
  spec.add_dependency "rainbow"
29
31
  spec.add_dependency "render_me_pretty"
30
32
  spec.add_dependency "thor"
31
33
  spec.add_dependency "zeitwerk"
32
34
 
35
+ # spec.add_dependency "aws_data" # using vendor/cfn_camelizer for now
36
+ # spec.add_dependency "cfn_camelizer" # using vendor/cfn_camelizer for now
37
+
33
38
  spec.add_development_dependency "bundler"
34
39
  spec.add_development_dependency "byebug"
35
40
  spec.add_development_dependency "cli_markdown"
@@ -1,3 +1,3 @@
1
1
  module Codebuild
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
@@ -0,0 +1,7 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [0.1.0]
7
+ - Initial release
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aws_data.gemspec
4
+ gemspec
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # AwsData
2
+
3
+ Simple AWS data library helper. Info like region and account id.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'aws_data'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install aws_data
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ require "aws_data"
25
+ aws = AwsData.new
26
+ aws.account # account id
27
+ aws.region # region
28
+ ```
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws_data.
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "aws_data/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "aws_data"
7
+ spec.version = AwsData::VERSION
8
+ spec.authors = ["Tung Nguyen"]
9
+ spec.email = ["tongueroo@gmail.com"]
10
+
11
+ spec.summary = "AWS info like region and account id"
12
+ spec.homepage = "https://github.com/tongueroo/aws_data"
13
+ spec.license = "MIT"
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "memoist"
25
+ spec.add_dependency "aws-sdk-core" # contains sts service
26
+
27
+ spec.add_development_dependency "bundler", "~> 2.0"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aws_data"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,91 @@
1
+ require "aws_data/version"
2
+ require "aws-sdk-core"
3
+ require "aws-sdk-sts"
4
+ require "memoist"
5
+
6
+ class AwsData
7
+ class Error < StandardError; end
8
+ extend Memoist
9
+
10
+ def region
11
+ return 'us-east-1' if test?
12
+
13
+ return ENV['AWS_REGION'] if ENV['AWS_REGION'] # highest precedence
14
+
15
+ region = nil
16
+
17
+ # First if aws binary is available
18
+ # try to get it from the ~/.aws/config
19
+ if which('aws')
20
+ region = `aws configure get region 2>&1`.strip rescue nil
21
+ exit_code = $?.exitstatus
22
+ if exit_code != 0
23
+ exception_message = region.split("\n").grep(/botocore\.exceptions/).first
24
+ if exception_message
25
+ puts "WARN: #{exception_message}".color(:yellow)
26
+ else
27
+ # show full message as warning
28
+ puts region.color(:yellow)
29
+ end
30
+ puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
31
+ region = nil
32
+ end
33
+ region = nil if region == ''
34
+ return region if region
35
+ end
36
+
37
+ # Second try the metadata endpoint, should be available on AWS Lambda environment
38
+ # https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance
39
+ begin
40
+ az = `curl -s --max-time 3 --connect-timeout 5 http://169.254.169.254/latest/meta-data/placement/availability-zone`
41
+ region = az.strip.chop # remove last char
42
+ region = nil if region == ''
43
+ rescue
44
+ end
45
+ return region if region
46
+
47
+ 'us-east-1' # default if all else fails
48
+ end
49
+ memoize :region
50
+
51
+ # aws sts get-caller-identity
52
+ def account
53
+ return '123456789' if test?
54
+ return ENV['AWS_ACCOUNT'] if ENV['AWS_ACCOUNT']
55
+
56
+ # ensure region set, required for sts.get_caller_identity.account to work
57
+ ENV['AWS_REGION'] ||= region
58
+ begin
59
+ sts.get_caller_identity.account
60
+ rescue Aws::Errors::MissingCredentialsError
61
+ puts "INFO: You're missing AWS credentials. Only local services are currently available"
62
+ end
63
+ end
64
+ memoize :account
65
+
66
+ private
67
+ def test?
68
+ ENV['TEST']
69
+ end
70
+
71
+ # Cross-platform way of finding an executable in the $PATH.
72
+ #
73
+ # which('ruby') #=> /usr/bin/ruby
74
+ #
75
+ # source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
76
+ def which(cmd)
77
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
78
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
79
+ exts.each { |ext|
80
+ exe = File.join(path, "#{cmd}#{ext}")
81
+ return exe if File.executable?(exe) && !File.directory?(exe)
82
+ }
83
+ end
84
+ return nil
85
+ end
86
+
87
+ def sts
88
+ Aws::STS::Client.new
89
+ end
90
+ memoize :sts
91
+ end
@@ -0,0 +1,3 @@
1
+ class AwsData
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.describe AwsData do
2
+ it "has a version number" do
3
+ expect(AwsData::VERSION).not_to be nil
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require "bundler/setup"
2
+ require "aws_data"
3
+
4
+ RSpec.configure do |config|
5
+ # Enable flags like --only-failures and --next-failure
6
+ config.example_status_persistence_file_path = ".rspec_status"
7
+
8
+ # Disable RSpec exposing methods globally on `Module` and `main`
9
+ config.disable_monkey_patching!
10
+
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = :expect
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cfn-status.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Tung Nguyen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,56 @@
1
+ # Cfn Status
2
+
3
+ Helper library provides status of CloudFormation stack.
4
+
5
+ ## Usage
6
+
7
+ Add this line to your gem's gemspec:
8
+
9
+ ```ruby
10
+ gem.add_development_dependency "cfn-status"
11
+ ```
12
+
13
+ Require it to your library:
14
+
15
+ ```ruby
16
+ require "cfn/status"
17
+ ```
18
+
19
+ Use like so:
20
+
21
+ ```ruby
22
+ status = Cfn::Status.new(stack_name)
23
+ status.run # prints out stack events
24
+ ```
25
+
26
+ The `status.run` will:
27
+
28
+ * print out the most recent stack events and return right away if the stack is in a completed state.
29
+ * print out the most recent stack events and poll for more events until the stack in a completed state.
30
+
31
+ To find out whether the most recent completed state of the stack was a success or a fail, you can use `status.success?`.
32
+
33
+ ```ruby
34
+ status.success?
35
+ ```
36
+
37
+ If you need to just wait for the stack to complete, you can also use `status.wait`.
38
+
39
+ ```ruby
40
+ status.wait
41
+ status.success?
42
+ ```
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cfn-status.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cfn/status"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "cfn/status/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cfn-status"
8
+ spec.version = Cfn::Status::VERSION
9
+ spec.authors = ["Tung Nguyen"]
10
+ spec.email = ["tongueroo@gmail.com"]
11
+
12
+ spec.summary = "CloudFormation status library"
13
+ spec.homepage = "https://github.com/tongueroo/cfn-status"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "aws-sdk-cloudformation"
26
+
27
+ spec.add_development_dependency "bundler", "~> 2.0"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end