codepipeline 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile.lock +7 -7
  4. data/codepipe.gemspec +5 -1
  5. data/lib/codepipe/version.rb +1 -1
  6. data/vendor/aws_data/Gemfile +4 -0
  7. data/vendor/aws_data/Gemfile.lock +48 -0
  8. data/{docs/LICENSE → vendor/aws_data/LICENSE.txt} +4 -4
  9. data/vendor/aws_data/README.md +41 -0
  10. data/vendor/aws_data/Rakefile +6 -0
  11. data/vendor/aws_data/aws_data.gemspec +30 -0
  12. data/vendor/aws_data/bin/console +14 -0
  13. data/vendor/aws_data/bin/setup +8 -0
  14. data/vendor/aws_data/lib/aws_data.rb +89 -0
  15. data/vendor/aws_data/lib/aws_data/version.rb +3 -0
  16. data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
  17. data/vendor/aws_data/spec/spec_helper.rb +14 -0
  18. data/vendor/cfn-status/Gemfile +4 -0
  19. data/vendor/cfn-status/Gemfile.lock +49 -0
  20. data/vendor/cfn-status/LICENSE.txt +21 -0
  21. data/vendor/cfn-status/README.md +56 -0
  22. data/vendor/cfn-status/Rakefile +6 -0
  23. data/vendor/cfn-status/bin/console +14 -0
  24. data/vendor/cfn-status/bin/setup +8 -0
  25. data/vendor/cfn-status/cfn-status.gemspec +30 -0
  26. data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
  27. data/vendor/cfn-status/lib/cfn/status.rb +220 -0
  28. data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
  29. data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
  30. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  31. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  32. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  33. data/vendor/cfn-status/spec/spec_helper.rb +14 -0
  34. data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
  35. data/vendor/cfn_camelizer/Gemfile +4 -0
  36. data/vendor/cfn_camelizer/LICENSE.txt +21 -0
  37. data/vendor/cfn_camelizer/README.md +40 -0
  38. data/vendor/cfn_camelizer/Rakefile +6 -0
  39. data/vendor/cfn_camelizer/bin/console +14 -0
  40. data/vendor/cfn_camelizer/bin/setup +8 -0
  41. data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
  42. data/vendor/cfn_camelizer/lib/camelizer.yml +27 -0
  43. data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
  44. data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
  45. data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
  46. data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
  47. metadata +44 -171
  48. data/docs/.gitignore +0 -4
  49. data/docs/CNAME +0 -1
  50. data/docs/Gemfile +0 -3
  51. data/docs/README.md +0 -25
  52. data/docs/_config.yml +0 -73
  53. data/docs/_docs/contributing.md +0 -99
  54. data/docs/_docs/conventions.md +0 -42
  55. data/docs/_docs/deploy.md +0 -59
  56. data/docs/_docs/dsl.md +0 -39
  57. data/docs/_docs/dsl/approve.md +0 -62
  58. data/docs/_docs/dsl/pipeline.md +0 -55
  59. data/docs/_docs/dsl/pipeline/action.md +0 -28
  60. data/docs/_docs/dsl/pipeline/codebuild.md +0 -62
  61. data/docs/_docs/dsl/pipeline/prefix-and-suffix.md +0 -57
  62. data/docs/_docs/dsl/role.md +0 -79
  63. data/docs/_docs/dsl/schedule.md +0 -29
  64. data/docs/_docs/dsl/sns.md +0 -27
  65. data/docs/_docs/dsl/webhook.md +0 -31
  66. data/docs/_docs/ecs-deploy.md +0 -22
  67. data/docs/_docs/examples/codebuild-project.md +0 -21
  68. data/docs/_docs/examples/different-branches.md +0 -49
  69. data/docs/_docs/examples/multiple-codebuild-projects.md +0 -60
  70. data/docs/_docs/install.md +0 -14
  71. data/docs/_docs/next-steps.md +0 -16
  72. data/docs/_docs/settings.md +0 -34
  73. data/docs/_docs/start.md +0 -31
  74. data/docs/_docs/structure.md +0 -25
  75. data/docs/_includes/commands.html +0 -92
  76. data/docs/_includes/content.html +0 -25
  77. data/docs/_includes/edit-on-github.html +0 -9
  78. data/docs/_includes/example.html +0 -12
  79. data/docs/_includes/footer.html +0 -41
  80. data/docs/_includes/google_analytics.html +0 -10
  81. data/docs/_includes/head.html +0 -45
  82. data/docs/_includes/js.html +0 -15
  83. data/docs/_includes/nav.html +0 -17
  84. data/docs/_includes/prev_next.md +0 -19
  85. data/docs/_includes/reference.md +0 -1
  86. data/docs/_includes/subnav.html +0 -47
  87. data/docs/_includes/tutorials.md +0 -38
  88. data/docs/_layouts/default.html +0 -12
  89. data/docs/_reference/pipe-completion.md +0 -44
  90. data/docs/_reference/pipe-completion_script.md +0 -25
  91. data/docs/_reference/pipe-delete.md +0 -25
  92. data/docs/_reference/pipe-deploy.md +0 -26
  93. data/docs/_reference/pipe-init.md +0 -25
  94. data/docs/_reference/pipe-start.md +0 -25
  95. data/docs/_reference/pipe-version.md +0 -21
  96. data/docs/_sass/_bootstrap-overrides.scss +0 -40
  97. data/docs/_sass/_contact.scss +0 -49
  98. data/docs/_sass/_cta.scss +0 -37
  99. data/docs/_sass/_download.scss +0 -31
  100. data/docs/_sass/_features.scss +0 -47
  101. data/docs/_sass/_footer.scss +0 -49
  102. data/docs/_sass/_global.scss +0 -102
  103. data/docs/_sass/_main.scss +0 -370
  104. data/docs/_sass/_masthead.scss +0 -70
  105. data/docs/_sass/_mixins.scss +0 -79
  106. data/docs/_sass/_navbar.scss +0 -92
  107. data/docs/_sass/_syntax.scss +0 -65
  108. data/docs/_sass/_table.scss +0 -34
  109. data/docs/_sass/_timeline.scss +0 -207
  110. data/docs/_sass/_variables.scss +0 -24
  111. data/docs/bin/web +0 -8
  112. data/docs/docs.md +0 -24
  113. data/docs/img/docs/codepipeline-output.png +0 -0
  114. data/docs/img/docs/multiple-codebuild-projects-pipeline.png +0 -0
  115. data/docs/img/logos/boltops-logo-full.png +0 -0
  116. data/docs/img/logos/boltops-logo.png +0 -0
  117. data/docs/img/logos/project-logo.png +0 -0
  118. data/docs/index.html +0 -37
  119. data/docs/js/nav.js +0 -39
  120. data/docs/js/new-age.js +0 -38
  121. data/docs/js/new-age.min.js +0 -6
  122. data/docs/new-age.scss +0 -20
  123. data/docs/quick-start.md +0 -72
  124. data/docs/reference.md +0 -12
  125. data/docs/support.md +0 -22
  126. data/docs/vendor/bootstrap/css/bootstrap-grid.css +0 -1339
  127. data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +0 -1
  128. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +0 -1
  129. data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +0 -1
  130. data/docs/vendor/bootstrap/css/bootstrap-reboot.css +0 -459
  131. data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +0 -1
  132. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +0 -1
  133. data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +0 -1
  134. data/docs/vendor/bootstrap/css/bootstrap.css +0 -9320
  135. data/docs/vendor/bootstrap/css/bootstrap.css.map +0 -1
  136. data/docs/vendor/bootstrap/css/bootstrap.min.css +0 -6
  137. data/docs/vendor/bootstrap/css/bootstrap.min.css.map +0 -1
  138. data/docs/vendor/bootstrap/js/bootstrap.js +0 -3535
  139. data/docs/vendor/bootstrap/js/bootstrap.min.js +0 -7
  140. data/docs/vendor/font-awesome/css/font-awesome.css +0 -2337
  141. data/docs/vendor/font-awesome/css/font-awesome.min.css +0 -4
  142. data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  143. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  144. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
  145. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  146. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  147. data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  148. data/docs/vendor/font-awesome/less/animated.less +0 -34
  149. data/docs/vendor/font-awesome/less/bordered-pulled.less +0 -25
  150. data/docs/vendor/font-awesome/less/core.less +0 -12
  151. data/docs/vendor/font-awesome/less/fixed-width.less +0 -6
  152. data/docs/vendor/font-awesome/less/font-awesome.less +0 -18
  153. data/docs/vendor/font-awesome/less/icons.less +0 -789
  154. data/docs/vendor/font-awesome/less/larger.less +0 -13
  155. data/docs/vendor/font-awesome/less/list.less +0 -19
  156. data/docs/vendor/font-awesome/less/mixins.less +0 -60
  157. data/docs/vendor/font-awesome/less/path.less +0 -15
  158. data/docs/vendor/font-awesome/less/rotated-flipped.less +0 -20
  159. data/docs/vendor/font-awesome/less/screen-reader.less +0 -5
  160. data/docs/vendor/font-awesome/less/stacked.less +0 -20
  161. data/docs/vendor/font-awesome/less/variables.less +0 -799
  162. data/docs/vendor/font-awesome/scss/_animated.scss +0 -34
  163. data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +0 -25
  164. data/docs/vendor/font-awesome/scss/_core.scss +0 -12
  165. data/docs/vendor/font-awesome/scss/_fixed-width.scss +0 -6
  166. data/docs/vendor/font-awesome/scss/_icons.scss +0 -789
  167. data/docs/vendor/font-awesome/scss/_larger.scss +0 -13
  168. data/docs/vendor/font-awesome/scss/_list.scss +0 -19
  169. data/docs/vendor/font-awesome/scss/_mixins.scss +0 -60
  170. data/docs/vendor/font-awesome/scss/_path.scss +0 -15
  171. data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +0 -20
  172. data/docs/vendor/font-awesome/scss/_screen-reader.scss +0 -5
  173. data/docs/vendor/font-awesome/scss/_stacked.scss +0 -20
  174. data/docs/vendor/font-awesome/scss/_variables.scss +0 -799
  175. data/docs/vendor/font-awesome/scss/font-awesome.scss +0 -18
  176. data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +0 -59
  177. data/docs/vendor/jquery-easing/jquery.easing.js +0 -166
  178. data/docs/vendor/jquery-easing/jquery.easing.min.js +0 -1
  179. data/docs/vendor/jquery/jquery.js +0 -10253
  180. data/docs/vendor/jquery/jquery.min.js +0 -4
  181. data/docs/vendor/simple-line-icons/css/simple-line-icons.css +0 -778
  182. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
  183. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +0 -200
  184. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
  185. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
  186. data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
  187. data/docs/vendor/simple-line-icons/less/simple-line-icons.less +0 -982
  188. data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +0 -979
  189. data/docs/vendor/tether/tether.js +0 -1811
  190. data/docs/vendor/tether/tether.min.js +0 -1
  191. data/spec/fixtures/app/.codepipeline/pipeline.rb +0 -12
  192. data/spec/fixtures/app/.codepipeline/schedule.rb +0 -1
  193. data/spec/fixtures/app/.codepipeline/webhook.rb +0 -1
  194. data/spec/fixtures/pipelines/approve.rb +0 -22
  195. data/spec/fixtures/pipelines/approve_existing_sns.rb +0 -24
  196. data/spec/lib/cli_spec.rb +0 -18
  197. data/spec/lib/pipeline/approve_spec.rb +0 -32
  198. data/spec/lib/pipeline_spec.rb +0 -12
  199. data/spec/lib/role_spec.rb +0 -12
  200. data/spec/lib/schedule_spec.rb +0 -12
  201. data/spec/lib/webhook_spec.rb +0 -12
  202. data/spec/spec_helper.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d01768e8b5b7fd0c0df102e9722aa1142465dc4cb558b1ba8b89729f22d5b190
4
- data.tar.gz: de37faf1c520534e98c098985b9c8aea780c19c31caa969b80c9b1da2861dc13
3
+ metadata.gz: 21c1dc801908feb55136bfd9fb4ee46693a81545e77ed5a0101d3d85709544cd
4
+ data.tar.gz: f8ffcf81382d89b98532394d22eacbe020b4d0d58a8ca439931c52691a4e183f
5
5
  SHA512:
6
- metadata.gz: 7bb42521c93b928e9454c2cf9d261bf2a3c0de7c2bbcd4c5514a91be7175f26051a3fdde0c3f8c120c3d92dc1d4aa8d3ff28f11da080b944214b6fa8e8222a68
7
- data.tar.gz: 10ae3dd56585edc11cd76adbaef808afdcdfdf28eb9a2935a1fa1e158b9a187bb238b8a6c058984ce91bf9cd25dc830617353fba99fcee20f800e42d6e65952c
6
+ metadata.gz: 2c7ad98f5f0ed471eaea56810f9fcd9cdf031bca8ba43864fcec9a1c54364b02f6fa315f9855952bf628c2afd8651ab8132a82639ebe36428f33ca52d6ba4d20
7
+ data.tar.gz: 5ec91787ffca34f0730ce6dc2e4dec6d27519a4962e044212cdf4d95258efcb12da0c11d299e0e9897c8562960ffa1dfd76f6dbac9215eb5d97dc904c9f4b01a
@@ -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.3.1]
7
+ - fix gem dependencies in vendor
8
+
6
9
  ## [0.3.0]
7
10
  - update docs and cli help
8
11
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codepipeline (0.2.0)
4
+ codepipeline (0.3.1)
5
5
  activesupport
6
6
  aws-sdk-cloudformation
7
7
  aws-sdk-codepipeline
@@ -23,14 +23,14 @@ GEM
23
23
  minitest (~> 5.1)
24
24
  tzinfo (~> 1.1)
25
25
  aws-eventstream (1.0.3)
26
- aws-partitions (1.193.0)
26
+ aws-partitions (1.199.0)
27
27
  aws-sdk-cloudformation (1.25.0)
28
28
  aws-sdk-core (~> 3, >= 3.61.1)
29
29
  aws-sigv4 (~> 1.1)
30
- aws-sdk-codepipeline (1.21.0)
31
- aws-sdk-core (~> 3, >= 3.56.0)
30
+ aws-sdk-codepipeline (1.23.0)
31
+ aws-sdk-core (~> 3, >= 3.61.1)
32
32
  aws-sigv4 (~> 1.1)
33
- aws-sdk-core (3.61.1)
33
+ aws-sdk-core (3.62.0)
34
34
  aws-eventstream (~> 1.0, >= 1.0.2)
35
35
  aws-partitions (~> 1.0)
36
36
  aws-sigv4 (~> 1.1)
@@ -65,7 +65,7 @@ GEM
65
65
  memoist (0.16.0)
66
66
  minitest (5.11.3)
67
67
  rainbow (3.0.0)
68
- rake (12.3.2)
68
+ rake (12.3.3)
69
69
  render_me_pretty (0.8.2)
70
70
  activesupport
71
71
  rainbow
@@ -74,7 +74,7 @@ GEM
74
74
  rspec-core (~> 3.8.0)
75
75
  rspec-expectations (~> 3.8.0)
76
76
  rspec-mocks (~> 3.8.0)
77
- rspec-core (3.8.1)
77
+ rspec-core (3.8.2)
78
78
  rspec-support (~> 3.8.0)
79
79
  rspec-expectations (3.8.4)
80
80
  diff-lcs (>= 1.2.0, < 2.0)
@@ -12,7 +12,11 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/tongueroo/codepipeline"
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)/})
@@ -1,3 +1,3 @@
1
1
  module Codepipe
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aws_data.gemspec
4
+ gemspec
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aws_data (0.1.0)
5
+ aws-sdk-core
6
+ memoist
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ aws-eventstream (1.0.3)
12
+ aws-partitions (1.176.0)
13
+ aws-sdk-core (3.56.0)
14
+ aws-eventstream (~> 1.0, >= 1.0.2)
15
+ aws-partitions (~> 1.0)
16
+ aws-sigv4 (~> 1.1)
17
+ jmespath (~> 1.0)
18
+ aws-sigv4 (1.1.0)
19
+ aws-eventstream (~> 1.0, >= 1.0.2)
20
+ diff-lcs (1.3)
21
+ jmespath (1.4.0)
22
+ memoist (0.16.0)
23
+ rake (10.5.0)
24
+ rspec (3.8.0)
25
+ rspec-core (~> 3.8.0)
26
+ rspec-expectations (~> 3.8.0)
27
+ rspec-mocks (~> 3.8.0)
28
+ rspec-core (3.8.1)
29
+ rspec-support (~> 3.8.0)
30
+ rspec-expectations (3.8.4)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.8.0)
33
+ rspec-mocks (3.8.1)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.8.0)
36
+ rspec-support (3.8.2)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ aws_data!
43
+ bundler (~> 2.0)
44
+ rake (~> 10.0)
45
+ rspec (~> 3.0)
46
+
47
+ BUNDLED WITH
48
+ 2.0.1
@@ -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,41 @@
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
+ aws = AwsData.new
25
+ aws.account # account id
26
+ aws.region # account id
27
+ ```
28
+
29
+ ## Development
30
+
31
+ 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.
32
+
33
+ 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).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws_data.
38
+
39
+ ## License
40
+
41
+ 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,89 @@
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
+ # ensure region set, required for sts.get_caller_identity.account to work
55
+ ENV['AWS_REGION'] ||= region
56
+ begin
57
+ sts.get_caller_identity.account
58
+ rescue Aws::Errors::MissingCredentialsError
59
+ puts "INFO: You're missing AWS credentials. Only local services are currently available"
60
+ end
61
+ end
62
+ memoize :account
63
+
64
+ private
65
+ def test?
66
+ ENV['TEST']
67
+ end
68
+
69
+ # Cross-platform way of finding an executable in the $PATH.
70
+ #
71
+ # which('ruby') #=> /usr/bin/ruby
72
+ #
73
+ # source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
74
+ def which(cmd)
75
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
76
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
77
+ exts.each { |ext|
78
+ exe = File.join(path, "#{cmd}#{ext}")
79
+ return exe if File.executable?(exe) && !File.directory?(exe)
80
+ }
81
+ end
82
+ return nil
83
+ end
84
+
85
+ def sts
86
+ Aws::STS::Client.new
87
+ end
88
+ memoize :sts
89
+ 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,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cfn-status (0.1.0)
5
+ aws-sdk-cloudformation
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aws-eventstream (1.0.3)
11
+ aws-partitions (1.170.0)
12
+ aws-sdk-cloudformation (1.22.0)
13
+ aws-sdk-core (~> 3, >= 3.53.0)
14
+ aws-sigv4 (~> 1.1)
15
+ aws-sdk-core (3.54.1)
16
+ aws-eventstream (~> 1.0, >= 1.0.2)
17
+ aws-partitions (~> 1.0)
18
+ aws-sigv4 (~> 1.1)
19
+ jmespath (~> 1.0)
20
+ aws-sigv4 (1.1.0)
21
+ aws-eventstream (~> 1.0, >= 1.0.2)
22
+ diff-lcs (1.3)
23
+ jmespath (1.4.0)
24
+ rake (10.5.0)
25
+ rspec (3.8.0)
26
+ rspec-core (~> 3.8.0)
27
+ rspec-expectations (~> 3.8.0)
28
+ rspec-mocks (~> 3.8.0)
29
+ rspec-core (3.8.0)
30
+ rspec-support (~> 3.8.0)
31
+ rspec-expectations (3.8.3)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.8.0)
34
+ rspec-mocks (3.8.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.8.0)
37
+ rspec-support (3.8.0)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ bundler (~> 2.0)
44
+ cfn-status!
45
+ rake (~> 10.0)
46
+ rspec (~> 3.0)
47
+
48
+ BUNDLED WITH
49
+ 2.0.1
@@ -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.