cloud_powers 0.2.7.3 → 0.2.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cloud_powers/delegator.rb +36 -2
- data/lib/cloud_powers/version.rb +1 -1
- data/lib/cloud_powers/zenv.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b712a5dc3c312be905609c2a43d9ff32052b4a8
|
4
|
+
data.tar.gz: 70740c2e6ef22d80e42a4498b3e32cd63b0839ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fbf9e1557670cc4b141a95a40d250cb159bead6af7e05304a6e3e93c9b1f278936327b84ff4d46160edf68c58b0a5a62f04c4e15b9cce4e13afa22efbdfde33
|
7
|
+
data.tar.gz: 217462f8c359440603e8ecf925ff13006755a55d9d86db0ecd55628007938b596ebb07b6fba5dcafec20bc97d2ca0b0d608a15a6816d1f49bed0f973023e300e
|
data/Gemfile.lock
CHANGED
@@ -6,12 +6,37 @@ require_relative 'storage'
|
|
6
6
|
|
7
7
|
module Smash
|
8
8
|
module CloudPowers
|
9
|
+
# The Delegator module is a way to dynamically source and use
|
10
|
+
# Ruby source code. You pass a message or something that can
|
11
|
+
# respond to +#body()+ and give back a String. The String should
|
12
|
+
# be the name of the class you're trying to instantiate and use
|
9
13
|
module Delegator
|
10
14
|
extend Smash::CloudPowers::Auth
|
11
|
-
include Smash::
|
15
|
+
include Smash::CloudPowaters::AwsResources
|
12
16
|
include Smash::CloudPowers::Helper
|
13
17
|
include Smash::CloudPowers::Storage
|
14
18
|
|
19
|
+
# responsible for sourcing, loading into the global namespace
|
20
|
+
# and use of Ruby source code, through the +#new()+ method on
|
21
|
+
# that class
|
22
|
+
#
|
23
|
+
# Parameters
|
24
|
+
# * id +String+ - the instance id of the calling node. This gets
|
25
|
+
# used in communication tools etc.
|
26
|
+
# * msg - Anything that responds to +#body()+ and returns a String
|
27
|
+
# that can be used in the search for the file in your local and S3
|
28
|
+
# bucket locations
|
29
|
+
#
|
30
|
+
# Returns
|
31
|
+
# +Object+ - a newly instantiated object of the class that matches
|
32
|
+
# the name retrieved from the +msg+ parameter
|
33
|
+
#
|
34
|
+
# Example
|
35
|
+
# class Job; include Smash::CloudPowers::Delegator; end
|
36
|
+
# job = Job.new
|
37
|
+
# # the message responds to +#body()+ with "ExampleTask"
|
38
|
+
# job.build('abc-1234', Aws::SQS::Message)
|
39
|
+
# # => +ExampleTask:Object+
|
15
40
|
def build(id, msg)
|
16
41
|
body = JSON.parse(msg.body)
|
17
42
|
begin
|
@@ -30,8 +55,17 @@ module Smash
|
|
30
55
|
end
|
31
56
|
end
|
32
57
|
|
58
|
+
# Predicate method to return true for valid job titles and false for invalid ones
|
59
|
+
#
|
60
|
+
# Parameters
|
61
|
+
# * name +String+ (optional) - name of the task in snake_case
|
62
|
+
#
|
63
|
+
# Returns
|
64
|
+
# +Boolean+
|
65
|
+
#
|
66
|
+
# Notes
|
67
|
+
# * TODO: needs improvement
|
33
68
|
def approved_task?(name = nil)
|
34
|
-
# TODO: improve this
|
35
69
|
['demo', 'testinz'].include? to_snake(name)
|
36
70
|
end
|
37
71
|
end
|
data/lib/cloud_powers/version.rb
CHANGED
data/lib/cloud_powers/zenv.rb
CHANGED
@@ -91,9 +91,11 @@ module Smash
|
|
91
91
|
|
92
92
|
# Manually set the +@project_root+ i-var as a +Pathname+ object.
|
93
93
|
#
|
94
|
-
# Parameters
|
94
|
+
# Parameters
|
95
|
+
# * +String+|+Pathname+ - new path to the project root
|
95
96
|
#
|
96
|
-
# Returns
|
97
|
+
# Returns
|
98
|
+
# +Pathname+ - +@project_root+
|
97
99
|
#
|
98
100
|
# Example
|
99
101
|
# project_root
|
@@ -108,7 +110,8 @@ module Smash
|
|
108
110
|
# Search through the system environment variables for a key or if no key
|
109
111
|
# is given, return all the system-env-vars and their values
|
110
112
|
#
|
111
|
-
# Parameters
|
113
|
+
# Parameters
|
114
|
+
# * key +String+ - the key to search for
|
112
115
|
#
|
113
116
|
# Returns
|
114
117
|
# * if a +key+ is given as a parameter, +String+
|
@@ -145,7 +148,7 @@ module Smash
|
|
145
148
|
# * key +String+|+Symbol+ - the key to search for
|
146
149
|
#
|
147
150
|
# Returns
|
148
|
-
# +String+
|
151
|
+
# * +String+
|
149
152
|
#
|
150
153
|
# Notes
|
151
154
|
# * TODO: implement a search for all 3 that can find close matches
|