cloud_powers 0.2.7.18 → 0.2.7.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud_powers/delegator.rb +1 -2
- data/lib/cloud_powers/version.rb +1 -1
- data/lib/cloud_powers/workflow_factory.rb +49 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: add8b897e6b88171351687b3569a5dc467db297b
|
4
|
+
data.tar.gz: 63247946561f1847a897027f02c1207cf2ee86b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c863eb713865222925ba6e93d3c3dfd1f63a8150e2092834839f6a2728e84f6352c0a429c4c856797269cd658ba7875ebc2c0cae0a7499f86ee00e227e424273
|
7
|
+
data.tar.gz: 3d57a7d912c85c21b35f8fbb72ef6c65f21b31ca407cbd55ff609f6a8ee83916ace37ee7f258777773169621a53ecddb7b2b3dd30c430ce33518b502d7ee5353
|
@@ -58,8 +58,7 @@ module Smash
|
|
58
58
|
if approved_task? task
|
59
59
|
source_task(task)
|
60
60
|
require_relative task_require_path(task)
|
61
|
-
|
62
|
-
Smash.const_get(to_pascal(task)).create(id, body)
|
61
|
+
Smash.const_get(to_pascal(task)).public_send :create, id, body
|
63
62
|
else
|
64
63
|
Smash::Task.new(id, body) # returns a default Task
|
65
64
|
end
|
data/lib/cloud_powers/version.rb
CHANGED
@@ -39,10 +39,10 @@ module Smash
|
|
39
39
|
# }
|
40
40
|
# }
|
41
41
|
#
|
42
|
-
#
|
42
|
+
# Returns
|
43
43
|
# * +nil+
|
44
44
|
#
|
45
|
-
#
|
45
|
+
# Example
|
46
46
|
# * build the workflow using the description from above
|
47
47
|
# class Job
|
48
48
|
# # code code code...
|
@@ -85,6 +85,7 @@ module Smash
|
|
85
85
|
# # => :building
|
86
86
|
#
|
87
87
|
# Notes
|
88
|
+
# * See <tt>description_to_s()</tt>
|
88
89
|
# * TODO: There has got to be a better way, so if any of you have suggestions...
|
89
90
|
# The fact that the eval gets evaluated and invoked in the workflow gem
|
90
91
|
# is of little comfort, despite how nice the gem is. Long story short,
|
@@ -92,6 +93,51 @@ module Smash
|
|
92
93
|
# * see the workflow gem docs and question me if you want some nice ways
|
93
94
|
# to really use this module. {workflow homepage}[https://github.com/geekq/workflow]
|
94
95
|
def inject_workflow(description)
|
96
|
+
workflow_spec_string = description_to_s(description)
|
97
|
+
begin
|
98
|
+
self.class.class_eval(workflow_spec_string)
|
99
|
+
define_singleton_method(:has_workflow?) { true }
|
100
|
+
rescue Exception => e
|
101
|
+
define_singleton_method(:has_workflow?) { !!(puts e.backtrace) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Takes a description and turns it into a string that would describe the
|
106
|
+
# workflow you want to insert.
|
107
|
+
#
|
108
|
+
# Parameters
|
109
|
+
# * +description+ +Hash+ - of the format
|
110
|
+
# {
|
111
|
+
# workflow: {
|
112
|
+
# states: [
|
113
|
+
# { state_name: { event: :event_name, transitions_to: :transition_to_name } },
|
114
|
+
# { state_name: nil }
|
115
|
+
# ]
|
116
|
+
# }
|
117
|
+
# }
|
118
|
+
#
|
119
|
+
# Returns
|
120
|
+
# +String+
|
121
|
+
#
|
122
|
+
# Example
|
123
|
+
# # given the description seen in <tt>inject_workflow()</tt>
|
124
|
+
# puts description_to_s(description)
|
125
|
+
# # =>
|
126
|
+
# workflow do
|
127
|
+
# state :new do
|
128
|
+
# event :build, :transitions_to => :building
|
129
|
+
# end
|
130
|
+
# state :building do
|
131
|
+
# event :run, :transitions_to => :in_progress
|
132
|
+
# end
|
133
|
+
# state :in_progress do
|
134
|
+
# event :post_results, :transitions_to => :done
|
135
|
+
# end
|
136
|
+
# state :done
|
137
|
+
# end
|
138
|
+
# Notes
|
139
|
+
# * See <tt>inject_workflow()</tt>
|
140
|
+
def description_to_s(description)
|
95
141
|
description_string_builder = ['include Workflow', 'workflow do']
|
96
142
|
description[:workflow][:states].each do |state|
|
97
143
|
state.map do |name, state_description|
|
@@ -107,12 +153,7 @@ module Smash
|
|
107
153
|
end
|
108
154
|
end
|
109
155
|
description_string_builder << "end\n"
|
110
|
-
|
111
|
-
self.class.class_eval(description_string_builder.join("\n"))
|
112
|
-
define_singleton_method(:has_workflow?) { true }
|
113
|
-
rescue Exception => e
|
114
|
-
define_singleton_method(:has_workflow?) { !!(puts e.backtrace) }
|
115
|
-
end
|
156
|
+
description_string_builder.join("\n")
|
116
157
|
end
|
117
158
|
end
|
118
159
|
end
|
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.19
|
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-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport-core-ext
|