hiptest-publisher-fork 3.4.5 → 3.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hiptest-publisher +9 -9
- data/lib/hiptest-publisher/cli_options_checker.rb +24 -30
- data/lib/hiptest-publisher/client.rb +7 -7
- data/lib/hiptest-publisher/export_cache.rb +2 -2
- data/lib/hiptest-publisher/formatters/console_formatter.rb +1 -1
- data/lib/hiptest-publisher/formatters/diff_displayer.rb +7 -7
- data/lib/hiptest-publisher/options_parser.rb +71 -71
- data/lib/hiptest-publisher/version_checker.rb +5 -5
- data/lib/hiptest-publisher/xml_parser.rb +1 -1
- data/lib/hiptest-publisher.rb +21 -22
- 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: 2c76f35ff3888338d8303e84e6e61d34aaaf7df7bc13a67253bbe8be3bbb8877
|
4
|
+
data.tar.gz: 3800bf6510c7358ba69a7c44b9103df90642bd15459a60bda35c968ca6d91535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ac8a92a081081dbe8c7b51c835c1f1ff19d517d63a9e4ed5f61f1e7248e09b87e2762c13cb03d3ce9aa8b46c2a26dd138a5b02e5a334bf69f853e22e414300
|
7
|
+
data.tar.gz: 518306838995f25af7ea09defd862acb44e3611252b7a8fe911144af8c0b7c41a58e24cb965674e1dc21a05f196a9202bbc5023b82307c6d74ac5a6c0b9c35d1
|
data/bin/hiptest-publisher
CHANGED
@@ -18,24 +18,24 @@ require 'hiptest-publisher/utils'
|
|
18
18
|
|
19
19
|
# Ensure ruby version >= 2.7
|
20
20
|
if RubyVersion < '2.7.0'
|
21
|
-
STDERR.puts(
|
22
|
-
STDERR.puts(
|
23
|
-
STDERR.puts(
|
21
|
+
STDERR.puts("Ruby 2.7.0 or higher is required.")
|
22
|
+
STDERR.puts("Using #{RUBY_ENGINE} #{RUBY_VERSION}.")
|
23
|
+
STDERR.puts("Please use a more recent version of Ruby.")
|
24
24
|
|
25
25
|
if RubyVersion.is? 2.6
|
26
|
-
STDERR.puts(
|
26
|
+
STDERR.puts('Support for Ruby 2.6.0 ended on 2022-03-31')
|
27
27
|
elsif RubyVersion.is? 2.5
|
28
|
-
STDERR.puts(
|
28
|
+
STDERR.puts('Support for Ruby 2.5.0 ended on 2021-03-31')
|
29
29
|
elsif RubyVersion.is? 2.4
|
30
|
-
STDERR.puts(
|
30
|
+
STDERR.puts('Support for Ruby 2.4.0 ended on 2020-03-31')
|
31
31
|
end
|
32
32
|
exit 1
|
33
33
|
end
|
34
34
|
|
35
35
|
if RubyVersion < '3.0'
|
36
|
-
STDERR.puts(
|
37
|
-
STDERR.puts(
|
38
|
-
STDERR.puts(
|
36
|
+
STDERR.puts("Using #{RUBY_ENGINE} #{RUBY_VERSION}.")
|
37
|
+
STDERR.puts("Warning: Ruby 2.7 is deprecated and will not be supported in future versions.")
|
38
|
+
STDERR.puts("Support for Ruby 2.7 ended on 2023-03-31")
|
39
39
|
end
|
40
40
|
|
41
41
|
require 'hiptest-publisher'
|
@@ -43,7 +43,7 @@ module Hiptest
|
|
43
43
|
begin
|
44
44
|
ParseConfig.new(cli_options.config) if present?(cli_options.config)
|
45
45
|
rescue Errno::EACCES => err
|
46
|
-
raise CliOptionError,
|
46
|
+
raise CliOptionError, 'errors.cli_options.missing_config_file'
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -59,11 +59,11 @@ module Hiptest
|
|
59
59
|
return if filters.empty?
|
60
60
|
|
61
61
|
if filters.size > 1
|
62
|
-
raise CliOptionError,
|
62
|
+
raise CliOptionError, 'errors.cli_options.multiple_filters'
|
63
63
|
end
|
64
64
|
|
65
65
|
if present?(cli_options.test_run_id) || present?(cli_options.test_run_name)
|
66
|
-
raise CliOptionError,
|
66
|
+
raise CliOptionError, 'errors.cli_options.filter_with_test_run'
|
67
67
|
end
|
68
68
|
|
69
69
|
check_numeric_list(:filter_on_scenario_ids)
|
@@ -75,18 +75,18 @@ module Hiptest
|
|
75
75
|
return if absent?(cli_options.filter_on_status)
|
76
76
|
|
77
77
|
if absent?(cli_options.test_run_id) && absent?(cli_options.test_run_name)
|
78
|
-
raise CliOptionError,
|
78
|
+
raise CliOptionError, 'errors.cli_options.filter_status_without_test_run'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
def check_secret_token
|
83
83
|
if absent?(cli_options.xml_file)
|
84
84
|
if absent?(cli_options.token)
|
85
|
-
raise CliOptionError,
|
85
|
+
raise CliOptionError, 'errors.cli_options.missing_token'
|
86
86
|
end
|
87
87
|
|
88
88
|
unless numeric?(cli_options.token)
|
89
|
-
raise CliOptionError,
|
89
|
+
raise CliOptionError, 'errors.cli_options.invalid_token'
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -97,12 +97,12 @@ module Hiptest
|
|
97
97
|
globbed_files = Dir.glob(agnostic_path)
|
98
98
|
|
99
99
|
if globbed_files.length == 0
|
100
|
-
raise CliOptionError,
|
100
|
+
raise CliOptionError, 'errors.cli_options.unreadable_report_file'
|
101
101
|
elsif globbed_files.length == 1 && globbed_files == [cli_options.push]
|
102
102
|
if !File.readable?(agnostic_path)
|
103
|
-
raise CliOptionError,
|
103
|
+
raise CliOptionError, 'errors.cli_options.unreadable_report_file'
|
104
104
|
elsif !File.file?(agnostic_path)
|
105
|
-
raise CliOptionError,
|
105
|
+
raise CliOptionError, 'errors.cli_options.irregular_report_file'
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -111,7 +111,7 @@ module Hiptest
|
|
111
111
|
def check_execution_environment
|
112
112
|
if cli_options.execution_environment
|
113
113
|
if cli_options.execution_environment.length > 255
|
114
|
-
raise CliOptionError,
|
114
|
+
raise CliOptionError, 'errors.cli_options.invalid_execution_environment'
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -122,12 +122,12 @@ module Hiptest
|
|
122
122
|
parent = first_existing_parent(output_directory)
|
123
123
|
if !parent.writable?
|
124
124
|
if parent.realpath === Pathname.new(cli_options.output_directory).cleanpath
|
125
|
-
raise CliOptionError,
|
125
|
+
raise CliOptionError, 'errors.cli_options.output_directory_not_writable'
|
126
126
|
else
|
127
|
-
raise CliOptionError,
|
127
|
+
raise CliOptionError, 'errors.cli_options.output_directory_parent_not_writable'
|
128
128
|
end
|
129
129
|
elsif !parent.directory?
|
130
|
-
raise CliOptionError,
|
130
|
+
raise CliOptionError, 'errors.cli_options.output_directory_not_directory'
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -136,9 +136,9 @@ module Hiptest
|
|
136
136
|
if cli_options.actionwords_diff?
|
137
137
|
actionwords_signature_file = Pathname.new(cli_options.output_directory).join("actionwords_signature.yaml")
|
138
138
|
if actionwords_signature_file.directory?
|
139
|
-
raise CliOptionError,
|
139
|
+
raise CliOptionError, 'errors.cli_options.actionwords_signature_directory'
|
140
140
|
elsif !actionwords_signature_file.exist?
|
141
|
-
raise CliOptionError,
|
141
|
+
raise CliOptionError, 'errors.cli_options.missing_actionwords_signature_file'
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
@@ -148,16 +148,16 @@ module Hiptest
|
|
148
148
|
xml_path = clean_path(cli_options.xml_file)
|
149
149
|
|
150
150
|
if !File.readable?(xml_path)
|
151
|
-
raise CliOptionError,
|
151
|
+
raise CliOptionError, 'errors.cli_options.unreadable_xml_file'
|
152
152
|
elsif !File.file?(xml_path)
|
153
|
-
raise CliOptionError,
|
153
|
+
raise CliOptionError, 'errors.cli_options.irregular_xml_file'
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
158
|
def check_test_run_id
|
159
159
|
if present?(cli_options.test_run_id) && !numeric?(cli_options.test_run_id)
|
160
|
-
raise CliOptionError,
|
160
|
+
raise CliOptionError, 'errors.cli_options.invalid_test_run_id'
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -167,7 +167,7 @@ module Hiptest
|
|
167
167
|
|
168
168
|
value.split(',').each do |val|
|
169
169
|
next if numeric?(val.strip)
|
170
|
-
raise CliOptionError,
|
170
|
+
raise CliOptionError, 'errors.cli_options.invalid_numeric_value_list'
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
@@ -177,7 +177,7 @@ module Hiptest
|
|
177
177
|
|
178
178
|
value.split(',').each do |val|
|
179
179
|
next if tag_compatible?(val.strip)
|
180
|
-
raise CliOptionError,
|
180
|
+
raise CliOptionError, 'errors.cli_options.invalid_tag_value_list'
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -187,7 +187,7 @@ module Hiptest
|
|
187
187
|
|
188
188
|
value.split(',').each do |val|
|
189
189
|
next if meta_compatible?(val.strip)
|
190
|
-
raise CliOptionError,
|
190
|
+
raise CliOptionError, 'errors.cli_options.invalid_meta'
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -202,13 +202,7 @@ module Hiptest
|
|
202
202
|
if present?(cli_options.only)
|
203
203
|
if language_config_parser.filtered_group_names != cli_options.groups_to_keep
|
204
204
|
unknown_categories = cli_options.groups_to_keep - language_config_parser.group_names
|
205
|
-
raise CliOptionError,
|
206
|
-
'errors.cli_options.invalid_category',
|
207
|
-
count: unknown_categories.length,
|
208
|
-
invalid_categories: formatted_categories(unknown_categories),
|
209
|
-
available_categories: formatted_categories(language_config_parser.group_names),
|
210
|
-
language: cli_options.language_framework
|
211
|
-
)
|
205
|
+
raise CliOptionError, 'errors.cli_options.unknown_categories'
|
212
206
|
end
|
213
207
|
end
|
214
208
|
end
|
@@ -216,7 +210,7 @@ module Hiptest
|
|
216
210
|
|
217
211
|
def check_build_options
|
218
212
|
if present?(cli_options.build_id) && present?(cli_options.build_name)
|
219
|
-
raise CliOptionError,
|
213
|
+
raise CliOptionError, 'errors.cli_options.multiple_build_options'
|
220
214
|
end
|
221
215
|
end
|
222
216
|
|
@@ -255,7 +249,7 @@ module Hiptest
|
|
255
249
|
if formatted_categories.length == 1
|
256
250
|
formatted_categories.first
|
257
251
|
else
|
258
|
-
I18n.t(:readable_list, first_items: formatted_categories[0...-1].join(", "), last_item: formatted_categories.last)
|
252
|
+
'I18n.t(:readable_list, first_items: formatted_categories[0...-1].join(", "), last_item: formatted_categories.last)'
|
259
253
|
end
|
260
254
|
end
|
261
255
|
|
@@ -95,12 +95,12 @@ module Hiptest
|
|
95
95
|
cached = export_cache.cache_for(url)
|
96
96
|
|
97
97
|
unless cached.nil?
|
98
|
-
@reporter.with_status_message
|
98
|
+
@reporter.with_status_message "#{:using_cached_data}" do
|
99
99
|
return cached
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
content = @reporter.with_status_message
|
103
|
+
content = @reporter.with_status_message "#{:fetching_data}" do
|
104
104
|
break fetch_project_export if use_synchronous_fetch?
|
105
105
|
|
106
106
|
begin
|
@@ -149,7 +149,7 @@ module Hiptest
|
|
149
149
|
def fetch_project_export
|
150
150
|
response = send_get_request(url)
|
151
151
|
if response.code_type == Net::HTTPNotFound
|
152
|
-
raise ClientError,
|
152
|
+
raise ClientError, 'errors.project_not_found'
|
153
153
|
end
|
154
154
|
|
155
155
|
response.body
|
@@ -208,7 +208,7 @@ module Hiptest
|
|
208
208
|
if cli_options.test_run_id?
|
209
209
|
cli_options.test_run_id
|
210
210
|
else
|
211
|
-
raise ClientError,
|
211
|
+
raise ClientError, 'errors.test_run_list_unavailable'
|
212
212
|
end
|
213
213
|
else
|
214
214
|
matching_test_run = available_test_runs.find { |test_run| test_run[key] == searched_value }
|
@@ -221,9 +221,9 @@ module Hiptest
|
|
221
221
|
|
222
222
|
def no_matching_test_runs_error_message
|
223
223
|
if available_test_runs.empty?
|
224
|
-
|
224
|
+
'errors.no_test_runs'
|
225
225
|
else
|
226
|
-
|
226
|
+
'errors.no_matching_test_run'
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
@@ -289,7 +289,7 @@ module Hiptest
|
|
289
289
|
proxy_address, proxy_port, proxy_user, proxy_pass,
|
290
290
|
use_ssl: use_ssl,
|
291
291
|
verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
|
292
|
-
@reporter.show_verbose_message(
|
292
|
+
@reporter.show_verbose_message("#{:request_sent}")
|
293
293
|
response = http.request(request)
|
294
294
|
|
295
295
|
raise RedirectionError.new("Got redirected", response['location']) if response.is_a?(Net::HTTPRedirection)
|
@@ -20,7 +20,7 @@ module Hiptest
|
|
20
20
|
date ||= Time.now
|
21
21
|
filename = "#{Digest::MD5.hexdigest(url)}-#{date.to_i}"
|
22
22
|
|
23
|
-
file_writer.write_to_file(File.join(@cache_dir, filename),
|
23
|
+
file_writer.write_to_file(File.join(@cache_dir, filename), "caching_data") { content }
|
24
24
|
end
|
25
25
|
|
26
26
|
def cache_for(url)
|
@@ -41,7 +41,7 @@ module Hiptest
|
|
41
41
|
return nil if cached_filename.nil?
|
42
42
|
|
43
43
|
full_path = File.join(@cache_dir, cached_filename)
|
44
|
-
@reporter.show_verbose_message(
|
44
|
+
@reporter.show_verbose_message("#{:using_cache}")
|
45
45
|
File.read(full_path)
|
46
46
|
end
|
47
47
|
|
@@ -32,7 +32,7 @@ class ConsoleFormatter
|
|
32
32
|
|
33
33
|
def show_options(options, message = nil)
|
34
34
|
return unless verbose
|
35
|
-
message ||= I18n.t(:verbose_header, version: hiptest_publisher_version)
|
35
|
+
message ||= "I18n.t(:verbose_header, version: hiptest_publisher_version)"
|
36
36
|
puts colorize(message, :yellow)
|
37
37
|
options.each { |k, v| puts " - #{k}: #{v.inspect}" }
|
38
38
|
end
|
@@ -52,7 +52,7 @@ module Hiptest
|
|
52
52
|
def export_as_json
|
53
53
|
@file_writer.write_to_file(
|
54
54
|
"#{@cli_options.output_directory}/actionwords-diff.json",
|
55
|
-
|
55
|
+
'actionwords_diff.exporting_diff_title') {
|
56
56
|
JSON.pretty_generate(as_api)
|
57
57
|
}
|
58
58
|
end
|
@@ -108,32 +108,32 @@ module Hiptest
|
|
108
108
|
command_line = @cli_options.command_line_used(exclude: [:actionwords_diff])
|
109
109
|
|
110
110
|
unless @diff[:deleted].nil?
|
111
|
-
puts
|
111
|
+
puts 'actionwords_diff.summary.deleted'
|
112
112
|
puts ""
|
113
113
|
end
|
114
114
|
|
115
115
|
unless @diff[:created].nil?
|
116
|
-
puts
|
116
|
+
puts 'actionwords_diff.summary.created'
|
117
117
|
puts ""
|
118
118
|
end
|
119
119
|
|
120
120
|
unless @diff[:renamed].nil?
|
121
|
-
puts
|
121
|
+
puts 'actionwords_diff.summary.renamed'
|
122
122
|
puts ""
|
123
123
|
end
|
124
124
|
|
125
125
|
unless @diff[:signature_changed].nil?
|
126
|
-
puts
|
126
|
+
puts 'actionwords_diff.summary.signature_changed'
|
127
127
|
puts ""
|
128
128
|
end
|
129
129
|
|
130
130
|
unless @diff[:definition_changed].nil?
|
131
|
-
puts
|
131
|
+
puts 'actionwords_diff.summary.definition_changed'
|
132
132
|
puts ""
|
133
133
|
end
|
134
134
|
|
135
135
|
if @diff.empty?
|
136
|
-
puts
|
136
|
+
puts 'actionwords_diff.summary.empty'
|
137
137
|
puts ""
|
138
138
|
end
|
139
139
|
end
|
@@ -69,7 +69,7 @@ class Option
|
|
69
69
|
if default == nil || default == ""
|
70
70
|
@help
|
71
71
|
else
|
72
|
-
"#{@help}
|
72
|
+
"#{@help}"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -180,7 +180,7 @@ class CliOptions < OpenStruct
|
|
180
180
|
end
|
181
181
|
marshal_load(modified_options.marshal_dump)
|
182
182
|
if reporter
|
183
|
-
reporter.show_options(delta,
|
183
|
+
reporter.show_options(delta, "help.options.nomalized_options")
|
184
184
|
end
|
185
185
|
return delta
|
186
186
|
end
|
@@ -222,64 +222,64 @@ class OptionsParser
|
|
222
222
|
|
223
223
|
def self.all_options
|
224
224
|
[
|
225
|
-
Option.new('t', 'token=TOKEN', nil, String,
|
226
|
-
Option.new('l', 'language=LANG', 'ruby', String,
|
227
|
-
Option.new('f', 'framework=FRAMEWORK', '', String,
|
228
|
-
Option.new('o', 'output-directory=PATH', '.', String,
|
229
|
-
Option.new(nil, 'filename-pattern=PATTERN', nil, String,
|
230
|
-
Option.new('c', 'config-file=PATH', nil, String,
|
231
|
-
Option.new(nil, 'overriden-templates=PATH', '', String,
|
232
|
-
Option.new(nil, 'overriden-language-configs=PATH', '', String,
|
233
|
-
Option.new(nil, 'test-run-id=ID', '', String,
|
234
|
-
Option.new(nil, 'test-run-name=NAME', '', String,
|
235
|
-
Option.new(nil, 'only=CATEGORIES', nil, String,
|
236
|
-
Option.new(nil, 'without=CATEGORIES', nil, String,
|
237
|
-
Option.new('x', 'xml-file=PROJECT_XML', nil, String,
|
238
|
-
Option.new(nil, 'cache-dir=PATH', self.default_cache_directory, String,
|
239
|
-
Option.new(nil, 'cache-duration=DURATION', 60, Integer,
|
240
|
-
Option.new(nil, 'tests-only', false, nil,
|
241
|
-
Option.new(nil, 'actionwords-only', false, nil,
|
242
|
-
Option.new(nil, 'actionwords-signature', false, nil,
|
243
|
-
Option.new(nil, 'show-actionwords-diff', false, nil,
|
244
|
-
Option.new(nil, 'show-actionwords-diff-as-json', false, nil,
|
245
|
-
Option.new(nil, 'show-actionwords-deleted', false, nil,
|
246
|
-
Option.new(nil, 'show-actionwords-created', false, nil,
|
247
|
-
Option.new(nil, 'show-actionwords-renamed', false, nil,
|
248
|
-
Option.new(nil, 'show-actionwords-signature-changed', false, nil,
|
249
|
-
Option.new(nil, 'show-actionwords-definition-changed', false, nil,
|
250
|
-
Option.new(nil, 'library-name=LIBRARY_NAME', nil, String,
|
251
|
-
Option.new(nil, 'with-folders', false, nil,
|
252
|
-
Option.new(nil, 'empty-folders', false, nil,
|
253
|
-
Option.new(nil, 'split-scenarios', false, nil,
|
254
|
-
Option.new(nil, 'leafless-export', false, nil,
|
255
|
-
Option.new('s', 'site=SITE', 'https://studio.cucumber.io', String,
|
256
|
-
Option.new(nil, 'http-proxy=PROXY_URL', nil, String,
|
257
|
-
Option.new('p', 'push=FILE.TAP', '', String,
|
258
|
-
Option.new(nil, 'global-failure-on-missing-reports', false, nil,
|
259
|
-
Option.new(nil, 'push-format=tap', 'tap', String,
|
260
|
-
Option.new(nil, 'execution-environment=NAME', '', String,
|
261
|
-
Option.new(nil, 'build-id=ID', '', String,
|
262
|
-
Option.new(nil, 'build-name=NAME', '', String,
|
263
|
-
Option.new(nil, 'sort=[id,order,alpha]', 'order', String,
|
264
|
-
Option.new(nil, '[no-]uids', false, nil,
|
265
|
-
Option.new(nil, '[no-]parent-folder-tags', true, nil,
|
266
|
-
Option.new(nil, 'parameter-delimiter=DELIMITER', '"', EmptiableString,
|
267
|
-
Option.new(nil, 'with-dataset-names', false, nil,
|
268
|
-
Option.new(nil, 'keep-filenames', false, nil,
|
269
|
-
Option.new(nil, 'keep-foldernames', false, nil,
|
270
|
-
Option.new(nil, 'filter-on-scenario-ids=IDS', '', String,
|
271
|
-
Option.new(nil, 'filter-on-folder-ids=IDS', '', String,
|
272
|
-
Option.new(nil, 'filter-on-scenario-name=NAME', '', String,
|
273
|
-
Option.new(nil, 'filter-on-folder-name=NAME', '', String,
|
274
|
-
Option.new(nil, 'filter-on-tags=TAGS', '', String,
|
275
|
-
Option.new(nil, 'filter-on-status=STATUS', '', String,
|
276
|
-
Option.new(nil, 'not-recursive', false, nil,
|
277
|
-
Option.new(nil, 'meta=META', '', String,
|
278
|
-
Option.new(nil, 'check-version', false, nil,
|
279
|
-
Option.new(nil, 'force', false, nil,
|
280
|
-
Option.new(nil, '[no-]color', nil, nil,
|
281
|
-
Option.new('v', 'verbose', false, nil,
|
282
|
-
Option.new(nil, 'indentation=INDENTATION', nil, EmptiableString,
|
225
|
+
Option.new('t', 'token=TOKEN', nil, String, 'options.token', :token),
|
226
|
+
Option.new('l', 'language=LANG', 'ruby', String, 'options.language', :language),
|
227
|
+
Option.new('f', 'framework=FRAMEWORK', '', String, 'options.framework', :framework),
|
228
|
+
Option.new('o', 'output-directory=PATH', '.', String, 'options.output_directory', :output_directory),
|
229
|
+
Option.new(nil, 'filename-pattern=PATTERN', nil, String, 'options.filename_pattern', :filename_pattern),
|
230
|
+
Option.new('c', 'config-file=PATH', nil, String, 'options.config', :config),
|
231
|
+
Option.new(nil, 'overriden-templates=PATH', '', String, 'options.overriden_templates', :overriden_templates),
|
232
|
+
Option.new(nil, 'overriden-language-configs=PATH', '', String, 'options.overriden_language_configs', :overriden_language_configs),
|
233
|
+
Option.new(nil, 'test-run-id=ID', '', String, 'options.test_run_id', :test_run_id),
|
234
|
+
Option.new(nil, 'test-run-name=NAME', '', String, 'options.test_run_name', :test_run_name),
|
235
|
+
Option.new(nil, 'only=CATEGORIES', nil, String, 'options.only', :only),
|
236
|
+
Option.new(nil, 'without=CATEGORIES', nil, String, 'options.without', :without),
|
237
|
+
Option.new('x', 'xml-file=PROJECT_XML', nil, String, 'options.xml_file', :xml_file),
|
238
|
+
Option.new(nil, 'cache-dir=PATH', self.default_cache_directory, String, 'options.cache_dir', :cache_dir),
|
239
|
+
Option.new(nil, 'cache-duration=DURATION', 60, Integer, 'options.cache_duration', :cache_duration),
|
240
|
+
Option.new(nil, 'tests-only', false, nil, 'options.tests_only', :tests_only),
|
241
|
+
Option.new(nil, 'actionwords-only', false, nil, 'options.actionwords_only', :actionwords_only),
|
242
|
+
Option.new(nil, 'actionwords-signature', false, nil, 'options.actionwords_signature', :actionwords_signature),
|
243
|
+
Option.new(nil, 'show-actionwords-diff', false, nil, 'options.actionwords_diff', :actionwords_diff),
|
244
|
+
Option.new(nil, 'show-actionwords-diff-as-json', false, nil, 'options.actionwords_diff_json', :actionwords_diff_json),
|
245
|
+
Option.new(nil, 'show-actionwords-deleted', false, nil, 'options.aw_deleted', :aw_deleted),
|
246
|
+
Option.new(nil, 'show-actionwords-created', false, nil, 'options.aw_created', :aw_created),
|
247
|
+
Option.new(nil, 'show-actionwords-renamed', false, nil, 'options.aw_renamed', :aw_renamed),
|
248
|
+
Option.new(nil, 'show-actionwords-signature-changed', false, nil, 'options.aw_signature_changed', :aw_signature_changed),
|
249
|
+
Option.new(nil, 'show-actionwords-definition-changed', false, nil, 'options.aw_definition_changed', :aw_definition_changed),
|
250
|
+
Option.new(nil, 'library-name=LIBRARY_NAME', nil, String, 'options.library_name', :library_name),
|
251
|
+
Option.new(nil, 'with-folders', false, nil, 'options.with_folders', :with_folders),
|
252
|
+
Option.new(nil, 'empty-folders', false, nil, 'options.empty_folders', :empty_folders),
|
253
|
+
Option.new(nil, 'split-scenarios', false, nil, 'options.split_scenarios', :split_scenarios),
|
254
|
+
Option.new(nil, 'leafless-export', false, nil, 'options.leafless_export', :leafless_export),
|
255
|
+
Option.new('s', 'site=SITE', 'https://studio.cucumber.io', String, 'options.site', :site),
|
256
|
+
Option.new(nil, 'http-proxy=PROXY_URL', nil, String, 'options.http_proxy', :http_proxy),
|
257
|
+
Option.new('p', 'push=FILE.TAP', '', String, 'options.push', :push),
|
258
|
+
Option.new(nil, 'global-failure-on-missing-reports', false, nil, 'options.global_failure_on_missing_reports', :global_failure_on_missing_reports),
|
259
|
+
Option.new(nil, 'push-format=tap', 'tap', String, 'options.push_format', :push_format),
|
260
|
+
Option.new(nil, 'execution-environment=NAME', '', String, 'options.execution_environment', :execution_environment),
|
261
|
+
Option.new(nil, 'build-id=ID', '', String, 'options.build_id', :build_id),
|
262
|
+
Option.new(nil, 'build-name=NAME', '', String, 'options.build_name', :build_name),
|
263
|
+
Option.new(nil, 'sort=[id,order,alpha]', 'order', String, 'options.sort', :sort),
|
264
|
+
Option.new(nil, '[no-]uids', false, nil, 'options.uids', :uids),
|
265
|
+
Option.new(nil, '[no-]parent-folder-tags', true, nil, 'options.parent_folder_tags', :parent_folder_tags),
|
266
|
+
Option.new(nil, 'parameter-delimiter=DELIMITER', '"', EmptiableString, 'options.parameter_delimiter', :parameter_delimiter),
|
267
|
+
Option.new(nil, 'with-dataset-names', false, nil, 'options.with_dataset_names', :with_dataset_names),
|
268
|
+
Option.new(nil, 'keep-filenames', false, nil, 'options.keep_filenames', :keep_filenames),
|
269
|
+
Option.new(nil, 'keep-foldernames', false, nil, 'options.keep_foldernames', :keep_foldernames),
|
270
|
+
Option.new(nil, 'filter-on-scenario-ids=IDS', '', String, 'options.filter_on_scenario_ids', :filter_on_scenario_ids),
|
271
|
+
Option.new(nil, 'filter-on-folder-ids=IDS', '', String, 'options.filter_on_folder_ids', :filter_on_folder_ids),
|
272
|
+
Option.new(nil, 'filter-on-scenario-name=NAME', '', String, 'options.filter_on_scenario_name', :filter_on_scenario_name),
|
273
|
+
Option.new(nil, 'filter-on-folder-name=NAME', '', String, 'options.filter_on_folder_name', :filter_on_folder_name),
|
274
|
+
Option.new(nil, 'filter-on-tags=TAGS', '', String, 'options.filter_on_tags', :filter_on_tags),
|
275
|
+
Option.new(nil, 'filter-on-status=STATUS', '', String, 'options.filter_on_status', :filter_on_status),
|
276
|
+
Option.new(nil, 'not-recursive', false, nil, 'options.not_recursive', :not_recursive),
|
277
|
+
Option.new(nil, 'meta=META', '', String, 'options.meta', :meta),
|
278
|
+
Option.new(nil, 'check-version', false, nil, 'options.check_version', :check_version),
|
279
|
+
Option.new(nil, 'force', false, nil, 'options.force_overwrite', :force_overwrite),
|
280
|
+
Option.new(nil, '[no-]color', nil, nil, 'options.color', :color),
|
281
|
+
Option.new('v', 'verbose', false, nil, 'options.verbose', :verbose),
|
282
|
+
Option.new(nil, 'indentation=INDENTATION', nil, EmptiableString, 'options.indentation', :indent)
|
283
283
|
]
|
284
284
|
end
|
285
285
|
|
@@ -297,18 +297,18 @@ class OptionsParser
|
|
297
297
|
options = CliOptions.new
|
298
298
|
opt_parser = OptionParser.new do |opts|
|
299
299
|
opts.version = hiptest_publisher_version if hiptest_publisher_version
|
300
|
-
opts.banner =
|
301
|
-
opts.separator
|
300
|
+
opts.banner = 'help.header'
|
301
|
+
opts.separator "help.description"
|
302
302
|
opts.accept(EmptiableString, /.*/m) { |s,*| s }
|
303
303
|
|
304
304
|
all_options.each {|o| o.register(opts, options)}
|
305
305
|
|
306
|
-
opts.on("-H", "--languages-help",
|
306
|
+
opts.on("-H", "--languages-help", 'options.languages_help') do
|
307
307
|
self.show_languages
|
308
308
|
exit
|
309
309
|
end
|
310
310
|
|
311
|
-
opts.on_tail("-h", "--help",
|
311
|
+
opts.on_tail("-h", "--help", 'options.help') do
|
312
312
|
puts opts
|
313
313
|
exit
|
314
314
|
end
|
@@ -332,15 +332,15 @@ class OptionsParser
|
|
332
332
|
end
|
333
333
|
|
334
334
|
def self.show_languages
|
335
|
-
puts
|
335
|
+
puts 'help.languages.supported_languages'
|
336
336
|
languages.each do |language, frameworks|
|
337
337
|
puts "#{language}:"
|
338
338
|
if frameworks.empty?
|
339
|
-
puts
|
339
|
+
puts 'help.languages.no_framework_available'
|
340
340
|
else
|
341
341
|
frameworks.each_with_index do |fw, index|
|
342
342
|
if index == 0
|
343
|
-
puts " - #{fw}
|
343
|
+
puts " - #{fw} #{make_language_option(language, '')}"
|
344
344
|
else
|
345
345
|
puts " - #{fw} #{make_language_option(language, fw)}"
|
346
346
|
end
|
@@ -447,7 +447,7 @@ class TemplateFinder
|
|
447
447
|
unless @template_path_by_name.has_key?(template_name)
|
448
448
|
@template_path_by_name[template_name] = get_template_by_name(template_name) || get_template_by_name(@fallback_template)
|
449
449
|
end
|
450
|
-
@template_path_by_name[template_name] or raise ArgumentError.new(
|
450
|
+
@template_path_by_name[template_name] or raise ArgumentError.new('errors.template_not_found')
|
451
451
|
end
|
452
452
|
|
453
453
|
def register_partials
|
@@ -660,7 +660,7 @@ class LanguageGroupConfig
|
|
660
660
|
elsif self[:node_name] == "folders"
|
661
661
|
:folders
|
662
662
|
else
|
663
|
-
raise
|
663
|
+
raise 'errors.invalid_node'
|
664
664
|
end
|
665
665
|
end
|
666
666
|
|
@@ -719,9 +719,9 @@ class LanguageConfigParser
|
|
719
719
|
|
720
720
|
if !File.file?(config_path)
|
721
721
|
if cli_options.framework.to_s.empty?
|
722
|
-
message =
|
722
|
+
message = 'errors.invalid_config_file_no_framework'
|
723
723
|
else
|
724
|
-
message =
|
724
|
+
message = 'errors.invalid_config_file'
|
725
725
|
end
|
726
726
|
raise ArgumentError.new(message)
|
727
727
|
end
|
@@ -22,20 +22,20 @@ module Hiptest
|
|
22
22
|
current = hiptest_publisher_version
|
23
23
|
|
24
24
|
if latest == current
|
25
|
-
puts
|
25
|
+
puts 'check_version.up_to_date'
|
26
26
|
else
|
27
|
-
puts
|
27
|
+
puts 'check_version.outdated'
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def get_latest_version
|
32
|
-
reporter.with_status_message
|
32
|
+
reporter.with_status_message 'check_version.title' do
|
33
33
|
latest_gem = Gem.latest_version_for('hiptest-publisher')
|
34
34
|
|
35
|
-
raise RuntimeError,
|
35
|
+
raise RuntimeError, 'check_version.error' if latest_gem.nil?
|
36
36
|
|
37
37
|
latest = latest_gem.version
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
data/lib/hiptest-publisher.rb
CHANGED
@@ -20,8 +20,7 @@ require 'hiptest-publisher/version_checker'
|
|
20
20
|
require 'hiptest-publisher/xml_parser'
|
21
21
|
require 'i18n'
|
22
22
|
|
23
|
-
|
24
|
-
puts "Default locale set to #{I18n.default_locale}"
|
23
|
+
|
25
24
|
|
26
25
|
module Hiptest
|
27
26
|
class Publisher
|
@@ -95,12 +94,12 @@ module Hiptest
|
|
95
94
|
raise
|
96
95
|
end
|
97
96
|
rescue => err
|
98
|
-
reporter.show_failure(
|
97
|
+
reporter.show_failure("errors.default")
|
99
98
|
reporter.dump_error(err)
|
100
99
|
end
|
101
100
|
|
102
101
|
def get_project(xml)
|
103
|
-
reporter.with_status_message
|
102
|
+
reporter.with_status_message 'build_data.title' do
|
104
103
|
parser = Hiptest::XMLParser.new(xml, reporter)
|
105
104
|
return parser.build_project
|
106
105
|
end
|
@@ -118,10 +117,10 @@ module Hiptest
|
|
118
117
|
return true if @cli_options.force_overwrite
|
119
118
|
|
120
119
|
if $stdout.tty?
|
121
|
-
answer = reporter.ask(
|
120
|
+
answer = reporter.ask("Do you want to overwrite the file at #{path}? (y/yes)")
|
122
121
|
return ['y', 'yes'].include?(answer)
|
123
122
|
else
|
124
|
-
reporter.warning_message(
|
123
|
+
reporter.warning_message("File at #{path} already exists!")
|
125
124
|
return false
|
126
125
|
end
|
127
126
|
end
|
@@ -146,7 +145,7 @@ module Hiptest
|
|
146
145
|
node_rendering_context.path,
|
147
146
|
node_rendering_context.node,
|
148
147
|
node_rendering_context,
|
149
|
-
|
148
|
+
"node_rendering_context.description",
|
150
149
|
ask_overwrite: ask_overwrite
|
151
150
|
)
|
152
151
|
end
|
@@ -158,14 +157,14 @@ module Hiptest
|
|
158
157
|
|
159
158
|
write_to_file(
|
160
159
|
"#{@cli_options.output_directory}/actionwords_signature.yaml",
|
161
|
-
|
160
|
+
'actionwords_diff.exporting_title',
|
162
161
|
ask_overwrite: true
|
163
162
|
) { Hiptest::SignatureExporter.export_actionwords(@project).to_yaml }
|
164
163
|
end
|
165
164
|
|
166
165
|
def compute_actionwords_diff
|
167
166
|
old = nil
|
168
|
-
reporter.with_status_message
|
167
|
+
reporter.with_status_message('Loading previous definition...') do
|
169
168
|
old = YAML.load_file("#{@cli_options.output_directory}/actionwords_signature.yaml")
|
170
169
|
end
|
171
170
|
|
@@ -183,7 +182,7 @@ module Hiptest
|
|
183
182
|
|
184
183
|
def analyze_project_data
|
185
184
|
return if @project_data_analyzed
|
186
|
-
reporter.with_status_message
|
185
|
+
reporter.with_status_message("#{:analyzing_data}") do
|
187
186
|
@language_config = LanguageConfigParser.new(@cli_options)
|
188
187
|
Hiptest::NodeModifiers.add_all(@project, @cli_options.sort)
|
189
188
|
end
|
@@ -201,16 +200,16 @@ module Hiptest
|
|
201
200
|
def print_categories
|
202
201
|
language_config = LanguageConfigParser.new(@cli_options)
|
203
202
|
group_names = language_config.group_names
|
204
|
-
puts
|
203
|
+
puts 'help.categories.title'
|
205
204
|
group_names.each do |group_name|
|
206
205
|
puts " - #{group_name}"
|
207
206
|
end
|
208
|
-
puts
|
207
|
+
puts 'help.categories.usage_example'
|
209
208
|
end
|
210
209
|
|
211
210
|
def post_results
|
212
211
|
response = nil
|
213
|
-
reporter.with_status_message
|
212
|
+
reporter.with_status_message('push.posting_results') do
|
214
213
|
response = @client.push_results
|
215
214
|
end
|
216
215
|
if valid_hiptest_api_response?(response)
|
@@ -232,23 +231,23 @@ module Hiptest
|
|
232
231
|
reported_tests = json.has_key?('test_import') ? json['test_import'] : []
|
233
232
|
passed_count = reported_tests.size
|
234
233
|
|
235
|
-
reporter.with_status_message
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
end
|
234
|
+
reporter.with_status_message("Tests imported summary: #{passed_count} tests imported.") do
|
235
|
+
if @cli_options.verbose
|
236
|
+
reported_tests.each do |imported_test|
|
237
|
+
puts "Test imported: #{imported_test['name']}"
|
240
238
|
end
|
241
239
|
end
|
240
|
+
end
|
242
241
|
|
243
242
|
display_empty_push_help if passed_count == 0
|
244
243
|
end
|
245
244
|
|
246
245
|
def report_hiptest_api_error(response)
|
247
|
-
reporter.failure_message(
|
246
|
+
reporter.failure_message("'errors.api_error' with code: #{response.code}")
|
248
247
|
if response.code == "422" && response.body.start_with?("Unknown format")
|
249
248
|
STDERR.print response.body.chomp + "\n"
|
250
249
|
elsif response.code == "404"
|
251
|
-
STDERR.print
|
250
|
+
STDERR.print 'errors.project_not_found'
|
252
251
|
end
|
253
252
|
end
|
254
253
|
|
@@ -256,10 +255,10 @@ module Hiptest
|
|
256
255
|
command = @cli_options.command_line_used(exclude: [:push, :push_format, :execution_environment])
|
257
256
|
enhanced_command = "#{command} --without=actionwords"
|
258
257
|
if @cli_options.test_run_id.nil? || @cli_options.test_run_id.empty?
|
259
|
-
enhanced_command += " --test-run-id=<#{
|
258
|
+
enhanced_command += " --test-run-id=<#{'push.test_run_id'}>"
|
260
259
|
end
|
261
260
|
|
262
|
-
puts
|
261
|
+
puts 'push.empty_results'
|
263
262
|
end
|
264
263
|
end
|
265
264
|
end
|