codepipeline 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +7 -7
- data/codepipe.gemspec +5 -1
- data/lib/codepipe/version.rb +1 -1
- data/vendor/aws_data/Gemfile +4 -0
- data/vendor/aws_data/Gemfile.lock +48 -0
- data/{docs/LICENSE → vendor/aws_data/LICENSE.txt} +4 -4
- data/vendor/aws_data/README.md +41 -0
- data/vendor/aws_data/Rakefile +6 -0
- data/vendor/aws_data/aws_data.gemspec +30 -0
- data/vendor/aws_data/bin/console +14 -0
- data/vendor/aws_data/bin/setup +8 -0
- data/vendor/aws_data/lib/aws_data.rb +89 -0
- data/vendor/aws_data/lib/aws_data/version.rb +3 -0
- data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
- data/vendor/aws_data/spec/spec_helper.rb +14 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/Gemfile.lock +49 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
- data/vendor/cfn-status/lib/cfn/status.rb +220 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +27 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +44 -171
- data/docs/.gitignore +0 -4
- data/docs/CNAME +0 -1
- data/docs/Gemfile +0 -3
- data/docs/README.md +0 -25
- data/docs/_config.yml +0 -73
- data/docs/_docs/contributing.md +0 -99
- data/docs/_docs/conventions.md +0 -42
- data/docs/_docs/deploy.md +0 -59
- data/docs/_docs/dsl.md +0 -39
- data/docs/_docs/dsl/approve.md +0 -62
- data/docs/_docs/dsl/pipeline.md +0 -55
- data/docs/_docs/dsl/pipeline/action.md +0 -28
- data/docs/_docs/dsl/pipeline/codebuild.md +0 -62
- data/docs/_docs/dsl/pipeline/prefix-and-suffix.md +0 -57
- data/docs/_docs/dsl/role.md +0 -79
- data/docs/_docs/dsl/schedule.md +0 -29
- data/docs/_docs/dsl/sns.md +0 -27
- data/docs/_docs/dsl/webhook.md +0 -31
- data/docs/_docs/ecs-deploy.md +0 -22
- data/docs/_docs/examples/codebuild-project.md +0 -21
- data/docs/_docs/examples/different-branches.md +0 -49
- data/docs/_docs/examples/multiple-codebuild-projects.md +0 -60
- data/docs/_docs/install.md +0 -14
- data/docs/_docs/next-steps.md +0 -16
- data/docs/_docs/settings.md +0 -34
- data/docs/_docs/start.md +0 -31
- data/docs/_docs/structure.md +0 -25
- data/docs/_includes/commands.html +0 -92
- data/docs/_includes/content.html +0 -25
- data/docs/_includes/edit-on-github.html +0 -9
- data/docs/_includes/example.html +0 -12
- data/docs/_includes/footer.html +0 -41
- data/docs/_includes/google_analytics.html +0 -10
- data/docs/_includes/head.html +0 -45
- data/docs/_includes/js.html +0 -15
- data/docs/_includes/nav.html +0 -17
- data/docs/_includes/prev_next.md +0 -19
- data/docs/_includes/reference.md +0 -1
- data/docs/_includes/subnav.html +0 -47
- data/docs/_includes/tutorials.md +0 -38
- data/docs/_layouts/default.html +0 -12
- data/docs/_reference/pipe-completion.md +0 -44
- data/docs/_reference/pipe-completion_script.md +0 -25
- data/docs/_reference/pipe-delete.md +0 -25
- data/docs/_reference/pipe-deploy.md +0 -26
- data/docs/_reference/pipe-init.md +0 -25
- data/docs/_reference/pipe-start.md +0 -25
- data/docs/_reference/pipe-version.md +0 -21
- data/docs/_sass/_bootstrap-overrides.scss +0 -40
- data/docs/_sass/_contact.scss +0 -49
- data/docs/_sass/_cta.scss +0 -37
- data/docs/_sass/_download.scss +0 -31
- data/docs/_sass/_features.scss +0 -47
- data/docs/_sass/_footer.scss +0 -49
- data/docs/_sass/_global.scss +0 -102
- data/docs/_sass/_main.scss +0 -370
- data/docs/_sass/_masthead.scss +0 -70
- data/docs/_sass/_mixins.scss +0 -79
- data/docs/_sass/_navbar.scss +0 -92
- data/docs/_sass/_syntax.scss +0 -65
- data/docs/_sass/_table.scss +0 -34
- data/docs/_sass/_timeline.scss +0 -207
- data/docs/_sass/_variables.scss +0 -24
- data/docs/bin/web +0 -8
- data/docs/docs.md +0 -24
- data/docs/img/docs/codepipeline-output.png +0 -0
- data/docs/img/docs/multiple-codebuild-projects-pipeline.png +0 -0
- data/docs/img/logos/boltops-logo-full.png +0 -0
- data/docs/img/logos/boltops-logo.png +0 -0
- data/docs/img/logos/project-logo.png +0 -0
- data/docs/index.html +0 -37
- data/docs/js/nav.js +0 -39
- data/docs/js/new-age.js +0 -38
- data/docs/js/new-age.min.js +0 -6
- data/docs/new-age.scss +0 -20
- data/docs/quick-start.md +0 -72
- data/docs/reference.md +0 -12
- data/docs/support.md +0 -22
- data/docs/vendor/bootstrap/css/bootstrap-grid.css +0 -1339
- data/docs/vendor/bootstrap/css/bootstrap-grid.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-grid.min.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css +0 -459
- data/docs/vendor/bootstrap/css/bootstrap-reboot.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css +0 -1
- data/docs/vendor/bootstrap/css/bootstrap-reboot.min.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap.css +0 -9320
- data/docs/vendor/bootstrap/css/bootstrap.css.map +0 -1
- data/docs/vendor/bootstrap/css/bootstrap.min.css +0 -6
- data/docs/vendor/bootstrap/css/bootstrap.min.css.map +0 -1
- data/docs/vendor/bootstrap/js/bootstrap.js +0 -3535
- data/docs/vendor/bootstrap/js/bootstrap.min.js +0 -7
- data/docs/vendor/font-awesome/css/font-awesome.css +0 -2337
- data/docs/vendor/font-awesome/css/font-awesome.min.css +0 -4
- data/docs/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/docs/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/docs/vendor/font-awesome/less/animated.less +0 -34
- data/docs/vendor/font-awesome/less/bordered-pulled.less +0 -25
- data/docs/vendor/font-awesome/less/core.less +0 -12
- data/docs/vendor/font-awesome/less/fixed-width.less +0 -6
- data/docs/vendor/font-awesome/less/font-awesome.less +0 -18
- data/docs/vendor/font-awesome/less/icons.less +0 -789
- data/docs/vendor/font-awesome/less/larger.less +0 -13
- data/docs/vendor/font-awesome/less/list.less +0 -19
- data/docs/vendor/font-awesome/less/mixins.less +0 -60
- data/docs/vendor/font-awesome/less/path.less +0 -15
- data/docs/vendor/font-awesome/less/rotated-flipped.less +0 -20
- data/docs/vendor/font-awesome/less/screen-reader.less +0 -5
- data/docs/vendor/font-awesome/less/stacked.less +0 -20
- data/docs/vendor/font-awesome/less/variables.less +0 -799
- data/docs/vendor/font-awesome/scss/_animated.scss +0 -34
- data/docs/vendor/font-awesome/scss/_bordered-pulled.scss +0 -25
- data/docs/vendor/font-awesome/scss/_core.scss +0 -12
- data/docs/vendor/font-awesome/scss/_fixed-width.scss +0 -6
- data/docs/vendor/font-awesome/scss/_icons.scss +0 -789
- data/docs/vendor/font-awesome/scss/_larger.scss +0 -13
- data/docs/vendor/font-awesome/scss/_list.scss +0 -19
- data/docs/vendor/font-awesome/scss/_mixins.scss +0 -60
- data/docs/vendor/font-awesome/scss/_path.scss +0 -15
- data/docs/vendor/font-awesome/scss/_rotated-flipped.scss +0 -20
- data/docs/vendor/font-awesome/scss/_screen-reader.scss +0 -5
- data/docs/vendor/font-awesome/scss/_stacked.scss +0 -20
- data/docs/vendor/font-awesome/scss/_variables.scss +0 -799
- data/docs/vendor/font-awesome/scss/font-awesome.scss +0 -18
- data/docs/vendor/jquery-easing/jquery.easing.compatibility.js +0 -59
- data/docs/vendor/jquery-easing/jquery.easing.js +0 -166
- data/docs/vendor/jquery-easing/jquery.easing.min.js +0 -1
- data/docs/vendor/jquery/jquery.js +0 -10253
- data/docs/vendor/jquery/jquery.min.js +0 -4
- data/docs/vendor/simple-line-icons/css/simple-line-icons.css +0 -778
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.eot +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.svg +0 -200
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.ttf +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff +0 -0
- data/docs/vendor/simple-line-icons/fonts/Simple-Line-Icons.woff2 +0 -0
- data/docs/vendor/simple-line-icons/less/simple-line-icons.less +0 -982
- data/docs/vendor/simple-line-icons/scss/simple-line-icons.scss +0 -979
- data/docs/vendor/tether/tether.js +0 -1811
- data/docs/vendor/tether/tether.min.js +0 -1
- data/spec/fixtures/app/.codepipeline/pipeline.rb +0 -12
- data/spec/fixtures/app/.codepipeline/schedule.rb +0 -1
- data/spec/fixtures/app/.codepipeline/webhook.rb +0 -1
- data/spec/fixtures/pipelines/approve.rb +0 -22
- data/spec/fixtures/pipelines/approve_existing_sns.rb +0 -24
- data/spec/lib/cli_spec.rb +0 -18
- data/spec/lib/pipeline/approve_spec.rb +0 -32
- data/spec/lib/pipeline_spec.rb +0 -12
- data/spec/lib/role_spec.rb +0 -12
- data/spec/lib/schedule_spec.rb +0 -12
- data/spec/lib/webhook_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c1dc801908feb55136bfd9fb4ee46693a81545e77ed5a0101d3d85709544cd
|
4
|
+
data.tar.gz: f8ffcf81382d89b98532394d22eacbe020b4d0d58a8ca439931c52691a4e183f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7ad98f5f0ed471eaea56810f9fcd9cdf031bca8ba43864fcec9a1c54364b02f6fa315f9855952bf628c2afd8651ab8132a82639ebe36428f33ca52d6ba4d20
|
7
|
+
data.tar.gz: 5ec91787ffca34f0730ce6dc2e4dec6d27519a4962e044212cdf4d95258efcb12da0c11d299e0e9897c8562960ffa1dfd76f6dbac9215eb5d97dc904c9f4b01a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
codepipeline (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.
|
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.
|
31
|
-
aws-sdk-core (~> 3, >= 3.
|
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.
|
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.
|
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.
|
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)
|
data/codepipe.gemspec
CHANGED
@@ -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
|
-
|
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)/})
|
data/lib/codepipe/version.rb
CHANGED
@@ -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
|
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
|
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,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,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,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,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.
|