cloud_powers 0.2.7.7 → 0.2.7.8
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 +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +1 -1
- data/lib/cloud_powers/self_awareness.rb +5 -0
- data/lib/cloud_powers/version.rb +1 -1
- data/lib/stubs/aws_stubs.rb +28 -6
- metadata +2 -3
- data/Gemfile.lock_b +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8bd572a3a1ae322c326bc2778e4d58464adc153
|
4
|
+
data.tar.gz: a37df9f75de74c6a90e5064a60463f9d4ac0f789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df44d2f42e5c84e9bd348ebb58f978df11bd366d7a1411000218ab2707222f02ccf739f2b6f1d25ca04755d9c8b99c9e45149477271a65125b75622ff095d018
|
7
|
+
data.tar.gz: ea1ce1fa67d5683938c35c136ffbc5f48862a196e2597787cc42889000e65b768ec105bfe6d3f722a1bc0dfddb8799dd6eebd2454ca7cdd876a79a1a22c87c0c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cloud_powers (0.2.7.
|
4
|
+
cloud_powers (0.2.7.8)
|
5
5
|
activesupport-core-ext (~> 4)
|
6
6
|
aws-sdk (~> 2)
|
7
7
|
dotenv (~> 2.1)
|
@@ -15,12 +15,12 @@ GEM
|
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
17
|
activesupport-core-ext (4.0.0.3)
|
18
|
-
aws-sdk (2.6.
|
19
|
-
aws-sdk-resources (= 2.6.
|
20
|
-
aws-sdk-core (2.6.
|
18
|
+
aws-sdk (2.6.9)
|
19
|
+
aws-sdk-resources (= 2.6.9)
|
20
|
+
aws-sdk-core (2.6.9)
|
21
21
|
jmespath (~> 1.0)
|
22
|
-
aws-sdk-resources (2.6.
|
23
|
-
aws-sdk-core (= 2.6.
|
22
|
+
aws-sdk-resources (2.6.9)
|
23
|
+
aws-sdk-core (= 2.6.9)
|
24
24
|
byebug (9.0.6)
|
25
25
|
diff-lcs (1.2.5)
|
26
26
|
dotenv (2.1.1)
|
data/README.md
CHANGED
@@ -24,6 +24,11 @@ module Smash
|
|
24
24
|
# * TODO: use time codes
|
25
25
|
def boot_time
|
26
26
|
begin
|
27
|
+
ec2(Smash::CloudPowers::AwsStubs.node_stub)
|
28
|
+
sqs(Smash::CloudPowers::AwsStubs.queue_stub)
|
29
|
+
sns(Smash::CloudPowers::AwsStubs.broadcast_stub)
|
30
|
+
kinesis(Smash::CloudPowers::AwsStubs.pipe_stub)
|
31
|
+
|
27
32
|
@boot_time ||=
|
28
33
|
ec2.describe_instances(dry_run: zfind(:testing), instance_ids:[instance_id]).
|
29
34
|
reservations[0].instances[0].launch_time.to_i
|
data/lib/cloud_powers/version.rb
CHANGED
data/lib/stubs/aws_stubs.rb
CHANGED
@@ -1,9 +1,30 @@
|
|
1
1
|
module Smash
|
2
2
|
module CloudPowers
|
3
|
-
# Provides stubbing for development work in CloudPowers or in a project that uses is
|
3
|
+
# Provides stubbing for development work in CloudPowers or in a project that uses is. Here's a little bit
|
4
|
+
# of a deeper picture, so this all makes sense...
|
5
|
+
# The AWS SDK makes HTTP requests to get things done but if you want to do some development on your project,
|
6
|
+
# it might get pretty expensive. In steps "stubbing". In order to get the SDK to not make any real HTTP
|
7
|
+
# requests and at the same time allow the SDK to respond to your code as if it were really making the requests
|
8
|
+
# you have to give the client that makes the request in question some fake data that it can use when it builds
|
9
|
+
# a response to return to your code. So to stub your client, follow these simple steps:
|
10
|
+
#
|
11
|
+
# 1. pick the appropriate client e.g. +sqs+ for Amazon's queue service, +ec2+ for their EC2 instances, etc
|
12
|
+
# 2. use the +Smash::CloudPowers::AwsResources.<your chosen client>+ method to create the client and
|
13
|
+
# automatically set an appropriate instance variable to that value. This method caches the client so
|
14
|
+
# once you've stubbed it, you can make any call against it that you stubbed. That method should be called
|
15
|
+
# before you need to make any HTTP requests using the client.
|
16
|
+
#
|
17
|
+
# and that's it. You have a stubbed client that you can use for development in your own projects that use
|
18
|
+
# the CloudPowers gem or you can screw around with CloudPowers itself, in the console or something like that
|
19
|
+
# by stubbing the client and making Smash::CloudPowers method calls that use the client you stubbed.
|
4
20
|
module AwsStubs
|
5
21
|
|
6
22
|
# Stub metadata for EC2 instance
|
23
|
+
#
|
24
|
+
# Notes
|
25
|
+
# * defaults can't be overriden or don't have good support for
|
26
|
+
# for it yet but you can use this hash as a guide
|
27
|
+
# for your own custom configuration
|
7
28
|
def self.instance_metadata_stub(opts = {})
|
8
29
|
{
|
9
30
|
'ami-id' => 'ami-1234',
|
@@ -52,16 +73,17 @@ module Smash
|
|
52
73
|
# for it yet but you can use this hash as a guide
|
53
74
|
# for your own custom configuration
|
54
75
|
def self.node_stub(opts = {})
|
76
|
+
time = opts[:launch_time] || Time.new((Time.now.utc.to_i / 86400 * 86400)) # midnight
|
55
77
|
{
|
56
78
|
stub_responses: {
|
57
79
|
create_tags: {},
|
58
80
|
run_instances: {
|
59
81
|
instances: [
|
60
|
-
{ instance_id: 'asd-1234', launch_time:
|
61
|
-
{ instance_id: 'qwe-4323', launch_time:
|
62
|
-
{ instance_id: 'tee-4322', launch_time:
|
63
|
-
{ instance_id: 'bbf-6969', launch_time:
|
64
|
-
{ instance_id: 'lkj-0987', launch_time:
|
82
|
+
{ instance_id: 'asd-1234', launch_time: time, state: { name: 'running' } },
|
83
|
+
{ instance_id: 'qwe-4323', launch_time: time , state: { name: 'running' } },
|
84
|
+
{ instance_id: 'tee-4322', launch_time: time, state: { name: 'running' } },
|
85
|
+
{ instance_id: 'bbf-6969', launch_time: time, state: { name: 'running' } },
|
86
|
+
{ instance_id: 'lkj-0987', launch_time: time, state: { name: 'running' } },
|
65
87
|
]},
|
66
88
|
describe_instances: {
|
67
89
|
reservations: [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_powers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.7.
|
4
|
+
version: 0.2.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Phillipps
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport-core-ext
|
@@ -209,7 +209,6 @@ files:
|
|
209
209
|
- ".travis.yml"
|
210
210
|
- Gemfile
|
211
211
|
- Gemfile.lock
|
212
|
-
- Gemfile.lock_b
|
213
212
|
- LICENSE.txt
|
214
213
|
- README.md
|
215
214
|
- README.rdoc.mdown
|
data/Gemfile.lock_b
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cloud_powers (0.2.4)
|
5
|
-
activesupport-core-ext (~> 4)
|
6
|
-
aws-sdk (~> 2)
|
7
|
-
dotenv (~> 2.1)
|
8
|
-
httparty (~> 0.14)
|
9
|
-
rubyzip (~> 1.2)
|
10
|
-
zip-zip (~> 0.3)
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
activesupport-core-ext (4.0.0.3)
|
16
|
-
aws-sdk (2.6.3)
|
17
|
-
aws-sdk-resources (= 2.6.3)
|
18
|
-
aws-sdk-core (2.6.3)
|
19
|
-
jmespath (~> 1.0)
|
20
|
-
aws-sdk-resources (2.6.3)
|
21
|
-
aws-sdk-core (= 2.6.3)
|
22
|
-
byebug (9.0.5)
|
23
|
-
diff-lcs (1.2.5)
|
24
|
-
dotenv (2.1.1)
|
25
|
-
httparty (0.14.0)
|
26
|
-
multi_xml (>= 0.5.2)
|
27
|
-
jmespath (1.3.1)
|
28
|
-
multi_xml (0.5.5)
|
29
|
-
rake (10.5.0)
|
30
|
-
rspec (3.5.0)
|
31
|
-
rspec-core (~> 3.5.0)
|
32
|
-
rspec-expectations (~> 3.5.0)
|
33
|
-
rspec-mocks (~> 3.5.0)
|
34
|
-
rspec-core (3.5.3)
|
35
|
-
rspec-support (~> 3.5.0)
|
36
|
-
rspec-expectations (3.5.0)
|
37
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.5.0)
|
39
|
-
rspec-mocks (3.5.0)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.5.0)
|
42
|
-
rspec-support (3.5.0)
|
43
|
-
rubyzip (1.2.0)
|
44
|
-
zip-zip (0.3)
|
45
|
-
rubyzip (>= 1.0.0)
|
46
|
-
websocket (>= 1.2.3)
|
47
|
-
|
48
|
-
PLATFORMS
|
49
|
-
ruby
|
50
|
-
|
51
|
-
DEPENDENCIES
|
52
|
-
bundler (~> 1.12)
|
53
|
-
byebug (~> 9)
|
54
|
-
cloud_powers!
|
55
|
-
rake (~> 10.0)
|
56
|
-
rspec (~> 3.0)
|
57
|
-
|
58
|
-
BUNDLED WITH
|
59
|
-
1.12.5
|