workato-connector-builder 0.0.2.pre → 0.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/workato-connector-builder.gemspec +1 -1
- metadata +1 -2
- data/lib/test.rb +0 -262
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad98e3fee089b4a600c5e43aae83113a445637615c6261566c5b3392f2fa725a
|
4
|
+
data.tar.gz: 565c3b987ff926937764163a84c845758ac9dfa3b5a0d0e5aa808785dd13dc67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 926fe2b7b524e3deff9e2571fb6e2254701e14d0f32304320180de9cee74333325527a443529b1224e007e496e2385fd58f148ac0f188b5d783517ca3e5f39ca
|
7
|
+
data.tar.gz: 42b295808593cb5ba5ec2bd8dffc3760c2e284773f832643765dfe32f58767ccfb4643d301a79607eede5ccb8876a045baa8f3a4cda013ae264890f347362aaf
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.description = 'A tool for building Workato Connectors from multiple hash files'
|
8
8
|
spec.summary = spec.description
|
9
9
|
spec.authors = [ 'Steven Laroche', ]
|
10
|
-
spec.version = '0.0.
|
10
|
+
spec.version = '0.0.3.pre'
|
11
11
|
spec.license = 'MIT'
|
12
12
|
|
13
13
|
spec.files = Dir['bin/*', 'lib/**/*.rb', 'workato-connector-builder.gemspec', 'LICENSE']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workato-connector-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Laroche
|
@@ -75,7 +75,6 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- LICENSE
|
77
77
|
- bin/workato-connector-builder
|
78
|
-
- lib/test.rb
|
79
78
|
- lib/workato_connector_builder/ast_generator.rb
|
80
79
|
- lib/workato_connector_builder/cli/build_command.rb
|
81
80
|
- lib/workato_connector_builder/cli/cli.rb
|
data/lib/test.rb
DELETED
@@ -1,262 +0,0 @@
|
|
1
|
-
require 'parser/current'
|
2
|
-
|
3
|
-
# Emitter
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# # level 2 will get us the hash keys we care about in the files like :action, etc
|
8
|
-
# def look_for_type(ast, type, value_to_match, levels_to_traverse = 2)
|
9
|
-
# return unless Parser::AST::Node === ast
|
10
|
-
#
|
11
|
-
# if ast.type == type # when we found block
|
12
|
-
# ast.children[0] == value_to_match
|
13
|
-
# else
|
14
|
-
# if levels_to_traverse >= 0
|
15
|
-
# match =
|
16
|
-
# ast.children.select do |child|
|
17
|
-
# # otherwise let's look for blocks
|
18
|
-
# # fail early, we don't want to traverse the whole tree
|
19
|
-
# match = look_for_type(child, type, value_to_match, levels_to_traverse - 1)
|
20
|
-
# if match
|
21
|
-
# break
|
22
|
-
# end
|
23
|
-
# end
|
24
|
-
# return match
|
25
|
-
# else
|
26
|
-
# return false
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# def get_children_for_match(ast, type, value_to_match, levels_to_traverse = 2)
|
32
|
-
#
|
33
|
-
# #
|
34
|
-
# # if ast.children.any? {|child| child.type == type && child.children[0] == value_to_match}# when we found block
|
35
|
-
# # ast.children
|
36
|
-
# # else
|
37
|
-
# # if levels_to_traverse > 0
|
38
|
-
# # match = ast.children.select do |child|
|
39
|
-
# # # otherwise let's look for blocks
|
40
|
-
# # # fail early, we don't want to traverse the whole tree
|
41
|
-
# # match = get_children_for_match(child, type, value_to_match, levels_to_traverse - 1)
|
42
|
-
# # if match
|
43
|
-
# # break
|
44
|
-
# # end
|
45
|
-
# # end
|
46
|
-
# # return match
|
47
|
-
# # else
|
48
|
-
# # return []
|
49
|
-
# # end
|
50
|
-
# # end
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# # combine the asts that are the same
|
54
|
-
# $workato_hash_roots = {
|
55
|
-
# :title => [],
|
56
|
-
# :connection => [],
|
57
|
-
# :actions => [],
|
58
|
-
# :methods => [],
|
59
|
-
# :object_definitions => [],
|
60
|
-
# :pick_lists => [],
|
61
|
-
# :test => [],
|
62
|
-
# :triggers => [],
|
63
|
-
# }
|
64
|
-
|
65
|
-
require_relative 'workato_connector_builder/ast_generator'
|
66
|
-
require_relative 'workato_connector_builder/hash_combiner'
|
67
|
-
require 'rubocop-ast'
|
68
|
-
include WorkatoConnectorBuilder
|
69
|
-
|
70
|
-
# combine the source files
|
71
|
-
builder = RuboCop::AST::Builder.new
|
72
|
-
parser = Parser::CurrentRuby.new builder
|
73
|
-
|
74
|
-
buffer1 = Parser::Source::Buffer.new('test1')
|
75
|
-
buffer1.raw_source = %{{
|
76
|
-
:test => 1,
|
77
|
-
:collision => 1,
|
78
|
-
'dup' => {
|
79
|
-
a: 1,
|
80
|
-
b: 2
|
81
|
-
}
|
82
|
-
}}
|
83
|
-
buffer2 = Parser::Source::Buffer.new('test2')
|
84
|
-
# buffer2.raw_source = '{ :otherfield => 2, :collision => 2, dup: { # some comment \n c: 3}}'
|
85
|
-
buffer2.raw_source = %{{
|
86
|
-
:otherfield => 2,
|
87
|
-
:collision => 2,
|
88
|
-
dup: {
|
89
|
-
# some comment
|
90
|
-
a: 2,
|
91
|
-
c: 3 # another_comment
|
92
|
-
}
|
93
|
-
}}
|
94
|
-
|
95
|
-
require 'thor'
|
96
|
-
combine_hashes = WorkatoConnectorBuilder::Utils::HashCombiner.new Thor::Shell::Color.new
|
97
|
-
|
98
|
-
treeRewriter = Parser::Source::TreeRewriter.new buffer1
|
99
|
-
|
100
|
-
node1 = parser.parse(buffer1)
|
101
|
-
parser = Parser::CurrentRuby.new builder
|
102
|
-
parser.reset
|
103
|
-
node2 = parser.parse(buffer2)
|
104
|
-
|
105
|
-
# class MyRule < Parser::AST::Processor
|
106
|
-
# include RuboCop::AST::Traversal
|
107
|
-
#
|
108
|
-
# def on_sym(node)
|
109
|
-
# puts "I found a symbol! #{node.value}"
|
110
|
-
# end
|
111
|
-
# end
|
112
|
-
#
|
113
|
-
#
|
114
|
-
|
115
|
-
combine_hashes.combine node1, node2, treeRewriter
|
116
|
-
#
|
117
|
-
# source = RuboCop::ProcessedSource.new(Unparser.unparse(node3), 2.7)
|
118
|
-
# rule = MyRule.new
|
119
|
-
# source.ast.each_node { |n| rule.process(n) }
|
120
|
-
|
121
|
-
File.write('./output.rb', treeRewriter.process, mode: 'w+')
|
122
|
-
|
123
|
-
# puts "Correcting output file"
|
124
|
-
# Loutput = %x(rubocop --auto-correct -x ./output.rb)
|
125
|
-
# asts = walk("../", %w[bin output test])
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
# split_asts =
|
130
|
-
# asts.map { |ast|
|
131
|
-
# ast.children.map { |child|
|
132
|
-
# children = child.children
|
133
|
-
# # first element is going to be the symbol for the hash, contained in this nested structure
|
134
|
-
# symbol = children[0].children[0]
|
135
|
-
# WORKATO_HASH_ROOTS[symbol].append children[1]
|
136
|
-
# }
|
137
|
-
# }
|
138
|
-
#
|
139
|
-
# def unparse(node, comment_array = [])
|
140
|
-
# return '' if node.nil?
|
141
|
-
#
|
142
|
-
# Unparser::Buffer.new.tap do |buffer|
|
143
|
-
# Emitter.new(
|
144
|
-
# buffer,
|
145
|
-
# node,
|
146
|
-
# Unparser::Comments.new(comment_array)
|
147
|
-
# ).write_to_buffer
|
148
|
-
# end.content
|
149
|
-
# end
|
150
|
-
#
|
151
|
-
# combined_asts =
|
152
|
-
# WORKATO_HASH_ROOTS.map { |symbol, matching_sets|
|
153
|
-
# combined_hashes = matching_sets[0]
|
154
|
-
# matching_sets.drop(1).each { |set|
|
155
|
-
# combined_hashes = combined_hashes.concat set
|
156
|
-
# }
|
157
|
-
#
|
158
|
-
# s = Unparser.unparse(combined_hashes)
|
159
|
-
#
|
160
|
-
# hash = "{#{symbol}: #{s}}"
|
161
|
-
# Unparser.parse(hash)
|
162
|
-
# }
|
163
|
-
#
|
164
|
-
# final_ast = Unparser.parse('{}')
|
165
|
-
# combined_asts.each { |node|
|
166
|
-
# final_ast = final_ast.concat node
|
167
|
-
# }
|
168
|
-
# OUTPUT_PATH = 'output/core_connector.rb'
|
169
|
-
# FULL_OUTPUT_FILE_PATH = File.join(File.dirname(__FILE__), '../', OUTPUT_PATH)
|
170
|
-
#
|
171
|
-
# output = Unparser.unparse(final_ast)
|
172
|
-
# File.write(FULL_OUTPUT_FILE_PATH, output, nil, mode: 'w+')
|
173
|
-
#
|
174
|
-
# Dir.chdir('../') {
|
175
|
-
# puts %x(ls -ahl)
|
176
|
-
# value = %x(rubocop ./#{OUTPUT_PATH} --auto-correct -x - v)
|
177
|
-
# puts value
|
178
|
-
# }
|
179
|
-
# # command = Thread.new do
|
180
|
-
# # end
|
181
|
-
# # command.join
|
182
|
-
#
|
183
|
-
# # result = Array (79 elements)
|
184
|
-
# # [0] = :location
|
185
|
-
# # [1] = :assign_properties
|
186
|
-
# # [2] = :loc
|
187
|
-
# # [3] = :dup
|
188
|
-
# # [4] = :clone
|
189
|
-
# # [5] = :to_sexp
|
190
|
-
# # [6] = :updated
|
191
|
-
# # [7] = :fancy_type
|
192
|
-
# # [8] = :to_sexp_array
|
193
|
-
# # [9] = :<<
|
194
|
-
# # [10] = :to_a
|
195
|
-
# # [11] = :==
|
196
|
-
# # [12] = :to_s
|
197
|
-
# # [13] = :children
|
198
|
-
# # [14] = :eql?
|
199
|
-
# # [15] = :deconstruct
|
200
|
-
# # [16] = :+
|
201
|
-
# # [17] = :inspect
|
202
|
-
# # [18] = :append
|
203
|
-
# # [19] = :hash
|
204
|
-
# # [20] = :concat
|
205
|
-
# # [21] = :type
|
206
|
-
# # [22] = :to_ast
|
207
|
-
# # [23] = :pretty_print_inspect
|
208
|
-
# # [24] = :pretty_print_instance_variables
|
209
|
-
# # [25] = :pretty_print
|
210
|
-
# # [26] = :pretty_print_cycle
|
211
|
-
# # [27] = :itself
|
212
|
-
# # [28] = :yield_self
|
213
|
-
# # [29] = :then
|
214
|
-
# # [30] = :taint
|
215
|
-
# # [31] = :tainted?
|
216
|
-
# # [32] = :untaint
|
217
|
-
# # [33] = :untrust
|
218
|
-
# # [34] = :untrusted?
|
219
|
-
# # [35] = :trust
|
220
|
-
# # [36] = :frozen?
|
221
|
-
# # [37] = :methods
|
222
|
-
# # [38] = :singleton_methods
|
223
|
-
# # [39] = :protected_methods
|
224
|
-
# # [40] = :private_methods
|
225
|
-
# # [41] = :public_methods
|
226
|
-
# # [42] = :instance_variables
|
227
|
-
# # [43] = :instance_variable_get
|
228
|
-
# # [44] = :instance_variable_set
|
229
|
-
# # [45] = :instance_variable_defined?
|
230
|
-
# # [46] = :remove_instance_variable
|
231
|
-
# # [47] = :instance_of?
|
232
|
-
# # [48] = :kind_of?
|
233
|
-
# # [49] = :is_a?
|
234
|
-
# # [50] = :tap
|
235
|
-
# # [51] = :class
|
236
|
-
# # [52] = :display
|
237
|
-
# # [53] = :singleton_class
|
238
|
-
# # [54] = :public_send
|
239
|
-
# # [55] = :method
|
240
|
-
# # [56] = :public_method
|
241
|
-
# # [57] = :singleton_method
|
242
|
-
# # [58] = :define_singleton_method
|
243
|
-
# # [59] = :extend
|
244
|
-
# # [60] = :to_enum
|
245
|
-
# # [61] = :enum_for
|
246
|
-
# # [62] = :<=>
|
247
|
-
# # [63] = :===
|
248
|
-
# # [64] = :=~
|
249
|
-
# # [65] = :!~
|
250
|
-
# # [66] = :nil?
|
251
|
-
# # [67] = :respond_to?
|
252
|
-
# # [68] = :freeze
|
253
|
-
# # [69] = :object_id
|
254
|
-
# # [70] = :send
|
255
|
-
# # [71] = :pretty_inspect
|
256
|
-
# # [72] = :__send__
|
257
|
-
# # [73] = :!
|
258
|
-
# # [74] = :!=
|
259
|
-
# # [75] = :__id__
|
260
|
-
# # [76] = :equal?
|
261
|
-
# # [77] = :instance_eval
|
262
|
-
# # [78] = :instance_exec
|