catalyst_automation 0.0.0.9 → 0.0.0.10
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/lib/catalyst_automation.rb +95 -68
- 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: 56a7f8cdc69b47a13a55135cb852f04f09354fda
|
4
|
+
data.tar.gz: b1c58cf20e1688dce528418f77a944262e09e374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b17ae633e21248804573884f01ce1cd33a0c6bd01a526f22b8190f65eef5fffcb7b1d7ee3465fa8bf94cf35f6b66fac0771a8d67679756af5c5896e78a34a7
|
7
|
+
data.tar.gz: 64fb609c13995226da7af3672d414d1c05b0108db4b2c3ec1d3d076a066c64579b1fbddfb133e528d938850db9158000c2bfe541daf2ab99b5b0b608520a8f36
|
data/lib/catalyst_automation.rb
CHANGED
@@ -5,20 +5,34 @@ require 'site_prism'
|
|
5
5
|
|
6
6
|
module CatalystAutomation
|
7
7
|
|
8
|
+
class WithRest
|
9
|
+
|
10
|
+
def self.initialize(rest_api)
|
11
|
+
sections_json = []
|
12
|
+
pages_json = Base.get_rest_api_info(rest_api, 'pages') #JSON.parse(RestClient.get(rest_api))
|
13
|
+
|
14
|
+
|
15
|
+
Base.create_pages(pages_json, sections_json)
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
|
8
22
|
class WithJson
|
9
23
|
|
10
24
|
def self.initialize(test_data, pages, actions, sections)
|
11
25
|
test_data_json = JSON.parse(test_data)
|
12
26
|
pages_json = JSON.parse(pages)
|
13
|
-
actions_json = JSON.parse(actions)
|
27
|
+
#actions_json = JSON.parse(actions)
|
14
28
|
sections_json = JSON.parse(sections)
|
15
29
|
|
16
30
|
Base.create_test_data(test_data_json)
|
17
31
|
Base.create_sections(sections_json)
|
18
32
|
Base.create_iframes(pages_json, sections_json)
|
19
33
|
Base.create_pages(pages_json, sections_json)
|
20
|
-
Base.create_iframe_actions(actions_json)
|
21
|
-
Base.create_actions(actions_json)
|
34
|
+
#Base.create_iframe_actions(actions_json)
|
35
|
+
#Base.create_actions(actions_json)
|
22
36
|
end
|
23
37
|
|
24
38
|
end
|
@@ -29,15 +43,16 @@ module CatalystAutomation
|
|
29
43
|
Base.connect_db(conn_str) do |db|
|
30
44
|
db_test_data = Base.get_db_info(db, :test_data)
|
31
45
|
db_pages = Base.get_db_info(db, :pages)
|
32
|
-
db_actions = Base.get_db_info(db, :actions)
|
46
|
+
#db_actions = Base.get_db_info(db, :actions)
|
33
47
|
db_sections = Base.get_db_info(db, :sections)
|
34
48
|
|
35
49
|
Base.create_test_data(db_test_data)
|
36
50
|
Base.create_sections(db_sections)
|
37
51
|
Base.create_iframes(db_pages, db_sections)
|
38
52
|
Base.create_pages(db_pages, db_sections)
|
39
|
-
Base.create_iframe_actions(db_actions)
|
40
|
-
Base.create_actions(db_actions)
|
53
|
+
#Base.create_iframe_actions(db_actions)
|
54
|
+
#Base.create_actions(db_actions)
|
55
|
+
db.close
|
41
56
|
end
|
42
57
|
end
|
43
58
|
|
@@ -50,8 +65,10 @@ module CatalystAutomation
|
|
50
65
|
end
|
51
66
|
|
52
67
|
def self.set_elements(const_name, key)
|
68
|
+
puts "inside set_elements!!!!!!!!!!!"
|
53
69
|
Object.const_get(const_name[(const_name.kind_of?(Symbol) ? key : key.to_s)]).class_eval do
|
54
70
|
const_name[(const_name.kind_of?(Symbol) ? :elements : "elements" )].each do |element|
|
71
|
+
puts "here agains@@@@@@@@@@@@@@@@@@@@ #{element}"
|
55
72
|
send(:element, element[(const_name.kind_of?(Symbol) ? :name : "name")], element[(const_name.kind_of?(Symbol) ? :path : "path")])
|
56
73
|
end
|
57
74
|
end
|
@@ -104,6 +121,15 @@ module CatalystAutomation
|
|
104
121
|
return m_info
|
105
122
|
end
|
106
123
|
|
124
|
+
def self.get_rest_api_info(rest_api, object)
|
125
|
+
m_info = []
|
126
|
+
rest_info = JSON.parse(RestClient.get(rest_api + object))
|
127
|
+
rest_info.each do |entry|
|
128
|
+
m_info << entry
|
129
|
+
end
|
130
|
+
return m_info
|
131
|
+
end
|
132
|
+
|
107
133
|
def self.create_sections(db_pages)
|
108
134
|
db_pages.each do |section|
|
109
135
|
create_const(section, :name, Class.new(SitePrism::Section))
|
@@ -123,10 +149,11 @@ module CatalystAutomation
|
|
123
149
|
def self.create_pages(db_pages, db_sections)
|
124
150
|
db_pages.each do |page|
|
125
151
|
if page[(page.class.eql?(Symbol) ? :type : "type")].eql? "page"
|
152
|
+
# puts "page: #{page}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
126
153
|
create_const(page, :name, Class.new(SitePrism::Page))
|
127
154
|
set_elements(page, :name)
|
128
|
-
set_sections(page, :name, db_sections)
|
129
|
-
set_iframes(page, :name, db_pages)
|
155
|
+
#set_sections(page, :name, db_sections)
|
156
|
+
#set_iframes(page, :name, db_pages)
|
130
157
|
Object.const_get(page[(page.class.eql?(Symbol) ? :name : "name")]).class_eval do
|
131
158
|
set_url page[(page.class.eql?(Symbol) ? :url : "url")]
|
132
159
|
end
|
@@ -134,67 +161,67 @@ module CatalystAutomation
|
|
134
161
|
end
|
135
162
|
end
|
136
163
|
|
137
|
-
def self.create_iframe_actions(db_actions)
|
138
|
-
db_actions.each do |page|
|
139
|
-
if page[page.class.eql?(Symbol) ? :type : "type"].eql? "iframe_action"
|
140
|
-
Object.const_get(page[(page.class.eql?(Symbol) ? :name : "name")]).class_eval do
|
141
|
-
page[(page.class.eql?(Symbol) ? :actions : "actions")].each do |iaction|
|
142
|
-
define_method iaction[page.kind_of?(Symbol) ? :name : "name"].to_sym do
|
143
|
-
iaction[page.kind_of?(Symbol) ? :action_methods : "action_methods"].each do |action_method|
|
144
|
-
m_iframe = iaction[page.kind_of?(Symbol) ? :iframe_name : "iframe_name"]
|
145
|
-
m_func = action_method[page.kind_of?(Symbol) ? :name : "name"].split('_').last
|
146
|
-
elem_array = action_method[page.kind_of?(Symbol) ? :name : "name"].split('_')
|
147
|
-
elem_array.pop
|
148
|
-
func_name = ""
|
149
|
-
elem_array.each do |e|
|
150
|
-
func_name = func_name + "#{e}_"
|
151
|
-
end
|
152
|
-
func_name = func_name[0...-1]
|
153
|
-
func_name = "#{func_name}.#{m_func}"
|
154
|
-
param = action_method[page.kind_of?(Symbol) ? :param : "param"]
|
155
|
-
if !param.eql?("no_param")
|
156
|
-
eval("#{m_iframe} { |frame| frame.#{func_name}(#{param})}")
|
157
|
-
else
|
158
|
-
eval("#{m_iframe} { |frame| frame.#{func_name}}")
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
#end
|
167
|
-
end
|
164
|
+
# def self.create_iframe_actions(db_actions)
|
165
|
+
# db_actions.each do |page|
|
166
|
+
# if page[page.class.eql?(Symbol) ? :type : "type"].eql? "iframe_action"
|
167
|
+
# Object.const_get(page[(page.class.eql?(Symbol) ? :name : "name")]).class_eval do
|
168
|
+
# page[(page.class.eql?(Symbol) ? :actions : "actions")].each do |iaction|
|
169
|
+
# define_method iaction[page.kind_of?(Symbol) ? :name : "name"].to_sym do
|
170
|
+
# iaction[page.kind_of?(Symbol) ? :action_methods : "action_methods"].each do |action_method|
|
171
|
+
# m_iframe = iaction[page.kind_of?(Symbol) ? :iframe_name : "iframe_name"]
|
172
|
+
# m_func = action_method[page.kind_of?(Symbol) ? :name : "name"].split('_').last
|
173
|
+
# elem_array = action_method[page.kind_of?(Symbol) ? :name : "name"].split('_')
|
174
|
+
# elem_array.pop
|
175
|
+
# func_name = ""
|
176
|
+
# elem_array.each do |e|
|
177
|
+
# func_name = func_name + "#{e}_"
|
178
|
+
# end
|
179
|
+
# func_name = func_name[0...-1]
|
180
|
+
# func_name = "#{func_name}.#{m_func}"
|
181
|
+
# param = action_method[page.kind_of?(Symbol) ? :param : "param"]
|
182
|
+
# if !param.eql?("no_param")
|
183
|
+
# eval("#{m_iframe} { |frame| frame.#{func_name}(#{param})}")
|
184
|
+
# else
|
185
|
+
# eval("#{m_iframe} { |frame| frame.#{func_name}}")
|
186
|
+
# end
|
187
|
+
# end
|
188
|
+
# end
|
189
|
+
# end
|
190
|
+
# end
|
191
|
+
# end
|
192
|
+
# end
|
193
|
+
# #end
|
194
|
+
# end
|
168
195
|
|
169
|
-
def self.create_actions(db_actions)
|
170
|
-
db_actions.each do |page|
|
171
|
-
if page[page.class.eql?(Symbol) ? :type : "type"].eql? "page_action"
|
172
|
-
Object.const_get(page[(page.class.eql?(Symbol) ? :name : "name")]).class_eval do
|
173
|
-
page[page.class.eql?(Symbol) ? :actions : "actions"].each do |action|
|
174
|
-
define_method action[page.kind_of?(Symbol) ? :name : "name"].to_sym do
|
175
|
-
action[page.kind_of?(Symbol) ? :action_methods : "action_methods"].each do |method|
|
176
|
-
m_func = method[page.kind_of?(Symbol) ? :name : "name"].split('_').last
|
177
|
-
elem_array = method[page.kind_of?(Symbol) ? :name : "name"].split('_')
|
178
|
-
elem_array.pop
|
179
|
-
func_name = ""
|
180
|
-
elem_array.each do |e|
|
181
|
-
func_name = func_name + "#{e}_"
|
182
|
-
end
|
183
|
-
|
184
|
-
func_name = "#{func_name}.#{m_func}"
|
185
|
-
param = method[page.kind_of?(Symbol) ? :param : "param"]
|
186
|
-
if !param.eql?("no_param")
|
187
|
-
eval("#{func_name}(#{param})")
|
188
|
-
else
|
189
|
-
eval("#{func_name}")
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
196
|
+
# def self.create_actions(db_actions)
|
197
|
+
# db_actions.each do |page|
|
198
|
+
# if page[page.class.eql?(Symbol) ? :type : "type"].eql? "page_action"
|
199
|
+
# Object.const_get(page[(page.class.eql?(Symbol) ? :name : "name")]).class_eval do
|
200
|
+
# page[page.class.eql?(Symbol) ? :actions : "actions"].each do |action|
|
201
|
+
# define_method action[page.kind_of?(Symbol) ? :name : "name"].to_sym do
|
202
|
+
# action[page.kind_of?(Symbol) ? :action_methods : "action_methods"].each do |method|
|
203
|
+
# m_func = method[page.kind_of?(Symbol) ? :name : "name"].split('_').last
|
204
|
+
# elem_array = method[page.kind_of?(Symbol) ? :name : "name"].split('_')
|
205
|
+
# elem_array.pop
|
206
|
+
# func_name = ""
|
207
|
+
# elem_array.each do |e|
|
208
|
+
# func_name = func_name + "#{e}_"
|
209
|
+
# end
|
210
|
+
# func_name = func_name[0...-1]
|
211
|
+
# func_name = "#{func_name}.#{m_func}"
|
212
|
+
# param = method[page.kind_of?(Symbol) ? :param : "param"]
|
213
|
+
# if !param.eql?("no_param")
|
214
|
+
# eval("#{func_name}(#{param})")
|
215
|
+
# else
|
216
|
+
# eval("#{func_name}")
|
217
|
+
# end
|
218
|
+
# end
|
219
|
+
# end
|
220
|
+
# end
|
221
|
+
# end
|
222
|
+
# end
|
223
|
+
# end
|
224
|
+
# end
|
198
225
|
|
199
226
|
def self.create_test_data(db_test_data)
|
200
227
|
db_test_data.each do |data|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catalyst_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Broersma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple gem
|
14
14
|
email: catalystautomation@mailinator.com
|