MovableInkAWS 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -2
- data/lib/movable_ink/aws.rb +10 -2
- data/lib/movable_ink/version.rb +1 -1
- data/spec/aws_spec.rb +4 -3
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 736e66396e9986a44f555ab3acf2485d6817c447489a21935981ed947604b2cb
|
4
|
+
data.tar.gz: b0cabff39b80b52dc4a85ddf873976237493fa25c9572079cf497e3869dacab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecf21073bb6f7896133b704e234b0e9d9d2f96da770c0180822ff033a32fd352689647242e1c00c4f1c246d3165e261696c00ffd6ae2c0f5d67202b85a86436b
|
7
|
+
data.tar.gz: 333cc92d26a46d816b5a1fde5bd671d0a01bdef0f31222189b1eb5b689e8bd24cd7aceddbe4702ac6c4def90671adf5764338257aeba9130924c2fe98f74ef92
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
4
|
- 2.2
|
4
5
|
|
@@ -6,3 +7,12 @@ bundler_args: "--retry=3"
|
|
6
7
|
|
7
8
|
script:
|
8
9
|
- rspec spec/
|
10
|
+
|
11
|
+
deploy:
|
12
|
+
provider: rubygems
|
13
|
+
api_key:
|
14
|
+
secure: NAHVFo9MwOnAYhq1NzZz22/2p34Iw/L71ZNt2WHSbWuMVnA/xyvVu7Ja/S25aQmaV/btNkxTYtbJbf83QZTO9/IwkashWFcWJtLiptZkBRdpkiunMPWX9Gw3Ap5fODUIPxLFyLYWd53huNBJppBCVQTUPwkLEcWJcQZP4MU7dkhW5QKdQgmyNTlMy8epxyMqCQe7V0n98LCwreUsHxHMToe6/V0FemysjYjpnyNvcFpGFa9kf28VQw8ZpDR0iobw9hg6qs61Xj69Y3ns9fWI3sdnk8VjY29M+V415/ksyn7kzCjYiQsGGCFerzjMffIt/4PXqX81GRvcymxmpXWwtikJYP95kiHYbLGFUNS5GJngbyVgO5+amjx7vSZfaBGSXcUCSkxLV1Ki4QfMYnA4ihogwTdQhIALSEV9GzOfFt147lUok2LgZDzNfn9nCPL+qKMBNaBRe7/YoWGuvLQG/smYjunPYhis0ynAQ1Sytc7lgtbdEtLFzfET87ITVS4Y2F9TQ+z1fxROAn/YwMmdSPyiaXVLEOIUc/gx0BjJneTl43M4l6ZId8Q6maJTNG2Fd0yK0hwLJcsN/257HbnPEiTTgkXBcg58E6/ABfZqwDnJrP3sQPem85M4BxLJIPUvfBkYzyeAEV+ALYDJx+KLaqYCCgavF9M+41VbkkNZyKU=
|
15
|
+
gem: MovableInkAWS
|
16
|
+
on:
|
17
|
+
tags: true
|
18
|
+
repo: movableink/awslib
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,11 +6,19 @@
|
|
6
6
|
|
7
7
|
## "Publishing"
|
8
8
|
|
9
|
-
|
9
|
+
Travis will automatically publish your gem to rubygems.org when you tag a release and push to origin.
|
10
|
+
Before you do so, ensure that the version in `lib/movable_ink/version.rb` matches the tag you're creating,
|
11
|
+
e.g. Version `1.0.0` in `lib/movable_ink/version.rb` should be tagged as `v1.0.0`
|
10
12
|
|
11
13
|
## Installing
|
12
14
|
|
13
|
-
|
15
|
+
### From rubygems.org
|
16
|
+
|
17
|
+
`gem install MovableInkAWS -v <VERSION>`
|
18
|
+
|
19
|
+
### Locally
|
20
|
+
|
21
|
+
`gem install MovableInkAWS-<VERSION>.gem`
|
14
22
|
|
15
23
|
## Using
|
16
24
|
|
data/lib/movable_ink/aws.rb
CHANGED
@@ -51,7 +51,11 @@ module MovableInk
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def availability_zone
|
54
|
-
@availability_zone ||=
|
54
|
+
@availability_zone ||= begin
|
55
|
+
az = `ec2metadata --availability-zone 2>/dev/null`.chomp
|
56
|
+
raise(MovableInk::AWS::Errors::EC2Required) if az.empty?
|
57
|
+
az
|
58
|
+
end
|
55
59
|
end
|
56
60
|
|
57
61
|
def my_region
|
@@ -59,7 +63,11 @@ module MovableInk
|
|
59
63
|
end
|
60
64
|
|
61
65
|
def instance_id
|
62
|
-
@instance_id ||=
|
66
|
+
@instance_id ||= begin
|
67
|
+
az = `ec2metadata --instance-id 2>/dev/null`.chomp
|
68
|
+
raise(MovableInk::AWS::Errors::EC2Required) if az.empty?
|
69
|
+
az
|
70
|
+
end
|
63
71
|
end
|
64
72
|
|
65
73
|
def datacenter(region: my_region)
|
data/lib/movable_ink/version.rb
CHANGED
data/spec/aws_spec.rb
CHANGED
@@ -13,19 +13,19 @@ describe MovableInk::AWS do
|
|
13
13
|
context "inside EC2" do
|
14
14
|
it "should call ec2metadata to get the instance ID" do
|
15
15
|
aws = MovableInk::AWS.new
|
16
|
-
expect(aws).to receive(:`).with('ec2metadata --instance-id').and_return(
|
16
|
+
expect(aws).to receive(:`).with('ec2metadata --instance-id 2>/dev/null').and_return("i-12345\n")
|
17
17
|
expect(aws.instance_id).to eq('i-12345')
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should call ec2metadata to get the availability zone" do
|
21
21
|
aws = MovableInk::AWS.new
|
22
|
-
expect(aws).to receive(:`).with('ec2metadata --availability-zone').and_return("us-east-1a\n")
|
22
|
+
expect(aws).to receive(:`).with('ec2metadata --availability-zone 2>/dev/null').and_return("us-east-1a\n")
|
23
23
|
expect(aws.availability_zone).to eq('us-east-1a')
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should find the datacenter by region" do
|
27
27
|
aws = MovableInk::AWS.new
|
28
|
-
expect(aws).to receive(:`).with('ec2metadata --availability-zone').and_return("us-east-1a\n")
|
28
|
+
expect(aws).to receive(:`).with('ec2metadata --availability-zone 2>/dev/null').and_return("us-east-1a\n")
|
29
29
|
expect(aws.datacenter).to eq('iad')
|
30
30
|
end
|
31
31
|
|
@@ -37,6 +37,7 @@ describe MovableInk::AWS do
|
|
37
37
|
|
38
38
|
expect(aws).to receive(:notify_slack).exactly(9).times
|
39
39
|
expect(aws).to receive(:sleep).exactly(9).times.and_return(true)
|
40
|
+
expect(STDOUT).to receive(:puts).exactly(9).times
|
40
41
|
|
41
42
|
aws.run_with_backoff { ec2.describe_instances } rescue nil
|
42
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MovableInkAWS
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Chesler
|
@@ -74,14 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.7.4
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: AWS Utility methods for MovableInk
|
81
|
-
test_files:
|
82
|
-
- spec/autoscaling_spec.rb
|
83
|
-
- spec/aws_spec.rb
|
84
|
-
- spec/ec2_spec.rb
|
85
|
-
- spec/route53_spec.rb
|
86
|
-
- spec/sns_spec.rb
|
87
|
-
- spec/ssm_spec.rb
|
81
|
+
test_files: []
|