wisco 0.2.1 → 0.2.2
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/wisco/commands/exec.rb +6 -6
- data/lib/wisco/commands/fixtures.rb +38 -0
- data/lib/wisco/path_utils.rb +1 -1
- data/lib/wisco/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b480d047c6f25a2c8ad8e234e034cb1d1cb571efbd9620b405a90a9e7816a807
|
|
4
|
+
data.tar.gz: baac61b7895d1a8fa7046a675910ecacfcae4e03afab83fa42d371f5a8a19b0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f15e57668b56c77e593da83dbc759663d1bf2a7c3bb7f39fe7dc03bfea50365df9356aa7e996d9e060a34b5ba1f1946172d5cdbe91c92c02c49e72eec606a26f
|
|
7
|
+
data.tar.gz: d8339fb1ea9942a124a8cbd260ffd74912504dbe5ed38f24ba817e82bad9f930ebcb75f270f65afe23a09a82bbb2161bfee40c0adc96a76049ec698c90e62e2c
|
data/lib/wisco/commands/exec.rb
CHANGED
|
@@ -49,8 +49,8 @@ module Wisco
|
|
|
49
49
|
input_files = resolve_input_files(input, fixtures_dir)
|
|
50
50
|
|
|
51
51
|
if input_files.empty?
|
|
52
|
-
if section
|
|
53
|
-
#
|
|
52
|
+
if %w[pick_lists methods].include?(section)
|
|
53
|
+
# No-param pick list or method — execute once with no input file
|
|
54
54
|
execute_one(section, key, nil, fixtures_dir, connector_full_path, connection, debug: debug)
|
|
55
55
|
else
|
|
56
56
|
warn "\tWarning: No ready input files found in #{fixture_dir_output}"
|
|
@@ -97,12 +97,12 @@ module Wisco
|
|
|
97
97
|
output_file = File.join(fixtures_dir, "output_#{stem}.json")
|
|
98
98
|
error_file = File.join(fixtures_dir, "error_#{stem}.txt")
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
exec_path =
|
|
100
|
+
use_args = %w[pick_lists methods].include?(section)
|
|
101
|
+
exec_path = use_args ? "#{section}.#{key}" : "#{section}.#{key}.execute"
|
|
102
102
|
|
|
103
103
|
options = { connector: connector_full_path, output: output_file }
|
|
104
104
|
options[:connection] = connection if connection
|
|
105
|
-
if
|
|
105
|
+
if use_args
|
|
106
106
|
options[:args] = input_file if input_file
|
|
107
107
|
else
|
|
108
108
|
options[:input] = input_file
|
|
@@ -112,7 +112,7 @@ module Wisco
|
|
|
112
112
|
warn "[exec] path: #{exec_path}"
|
|
113
113
|
warn "[exec] connector: #{connector_full_path}"
|
|
114
114
|
warn "[exec] connection: #{connection.inspect}"
|
|
115
|
-
warn "[exec] #{
|
|
115
|
+
warn "[exec] #{use_args ? 'args' : 'input'}: #{input_file.inspect}"
|
|
116
116
|
warn "[exec] output: #{output_file}"
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -44,6 +44,8 @@ module Wisco
|
|
|
44
44
|
|
|
45
45
|
if section == 'pick_lists'
|
|
46
46
|
process_pick_list(key, connector, fixtures_dir, overwrite: overwrite)
|
|
47
|
+
elsif section == 'methods'
|
|
48
|
+
process_method(key, connector, fixtures_dir, overwrite: overwrite)
|
|
47
49
|
else
|
|
48
50
|
input_fields_file = File.join(fixtures_dir, 'input_fields.json')
|
|
49
51
|
call_exec(
|
|
@@ -124,6 +126,42 @@ module Wisco
|
|
|
124
126
|
end
|
|
125
127
|
end
|
|
126
128
|
|
|
129
|
+
def process_method(key, connector, fixtures_dir, overwrite: false)
|
|
130
|
+
method_fn = connector[:methods]&.[](key.to_sym)
|
|
131
|
+
|
|
132
|
+
unless method_fn.respond_to?(:parameters)
|
|
133
|
+
warn " Warning: method '#{key}' is not callable — skipping."
|
|
134
|
+
return
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
params = method_fn.parameters # all params are real inputs (no connection to drop)
|
|
138
|
+
|
|
139
|
+
if params.empty?
|
|
140
|
+
puts " No input required: #{fixtures_dir}"
|
|
141
|
+
return
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
output_file = File.join(fixtures_dir, 'execute_input.json')
|
|
145
|
+
|
|
146
|
+
if File.exist?(output_file)
|
|
147
|
+
first_line = begin
|
|
148
|
+
File.open(output_file, &:readline).chomp
|
|
149
|
+
rescue StandardError
|
|
150
|
+
''
|
|
151
|
+
end
|
|
152
|
+
unless first_line == SENTINEL || overwrite
|
|
153
|
+
puts " Skipped (user-edited): #{output_file}"
|
|
154
|
+
return
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Positional array — each element is the param name as a placeholder string
|
|
159
|
+
template = params.map { |(_, name)| name.to_s }
|
|
160
|
+
content = "#{SENTINEL}\n#{JSON.pretty_generate(template)}\n"
|
|
161
|
+
File.write(output_file, content)
|
|
162
|
+
puts " Written: #{output_file}"
|
|
163
|
+
end
|
|
164
|
+
|
|
127
165
|
def process_pick_list(key, connector, fixtures_dir, overwrite: false)
|
|
128
166
|
pick_list_fn = connector[:pick_lists]&.[](key.to_sym)
|
|
129
167
|
|
data/lib/wisco/path_utils.rb
CHANGED
data/lib/wisco/version.rb
CHANGED