hiptest-publisher-fork 3.4.8 → 3.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d398cf203e892df046e28dbb4964be9600ba2281f2d210d4f81d9e6f500b633a
4
- data.tar.gz: 3f14f2702d10f9906112776b6cbef464a96a75a5c41d51a075e2ddf626efd6a4
3
+ metadata.gz: 0ffe573525cca379c57e84567bb9127030f50f9a8085e229b6aa1ba2dbc81a69
4
+ data.tar.gz: 7d9b5c3af765a405cb83937f470229268c17193359450327d9ed2a2cc747007d
5
5
  SHA512:
6
- metadata.gz: 3363c29e6a0b859f387fcb0e233662f1a0183d87baaa9a939af7028731b9206e6ee37fe002736add34e946dd04ed9678701db1da2159668eb574b8436a10b0cf
7
- data.tar.gz: 181af5c313cbe0f826d3043b8f7304e2a2887c860f58c53d8aa95277b0e26a8c6fd6588c9e68210b9935d7b536154f99dee4bea2b6a6490313420c6ff0656498
6
+ metadata.gz: e1ffd859dc1ea260509b5f6c7154bc27ec7eb674d1d14a415b70f059180c1f39bd53c0d88c8b0384129ea4e190d9dc5250bd9fae388c7ba1d579b8bacdf42be1
7
+ data.tar.gz: 6ca8fcbc81d26d18b888a88767820f5a44d6c4ac341296f8a4b4425ac19e9cfc184c341567a8cb8b50829516a883cd7041aba04e05995498993d768583127a76
@@ -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("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.")
21
+ STDERR.puts(I18n.t('ruby_version.required_version', version: '2.7.0'))
22
+ STDERR.puts(I18n.t('ruby_version.current_version', engine: RUBY_ENGINE, version: RUBY_VERSION))
23
+ STDERR.puts(I18n.t('ruby_version.use_more_recent'))
24
24
 
25
25
  if RubyVersion.is? 2.6
26
- STDERR.puts('Support for Ruby 2.6.0 ended on 2022-03-31')
26
+ STDERR.puts(I18n.('ruby_version.support_ended', version: '2.6.0', year: '2022', month: '03', day: '31'))
27
27
  elsif RubyVersion.is? 2.5
28
- STDERR.puts('Support for Ruby 2.5.0 ended on 2021-03-31')
28
+ STDERR.puts(I18n.('ruby_version.support_ended', version: '2.5.0', year: '2021', month: '03', day: '31'))
29
29
  elsif RubyVersion.is? 2.4
30
- STDERR.puts('Support for Ruby 2.4.0 ended on 2020-03-31')
30
+ STDERR.puts(I18n.('ruby_version.support_ended', version: '2.4.0', year: '2020', month: '03', day: '31'))
31
31
  end
32
32
  exit 1
33
33
  end
34
34
 
35
35
  if RubyVersion < '3.0'
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")
36
+ STDERR.puts(I18n.t('ruby_version.current_version', engine: RUBY_ENGINE, version: RUBY_VERSION))
37
+ STDERR.puts(I18n.t('ruby_version.deprecation_warning', version: '2.7'))
38
+ STDERR.puts(I18n.t('ruby_version.support_ended', version: '2.7', year: '2023', month: '03', day: '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, 'errors.cli_options.missing_config_file'
46
+ raise CliOptionError, I18n.t('errors.cli_options.missing_config_file', config_file: cli_options.config)
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, 'errors.cli_options.multiple_filters'
62
+ raise CliOptionError, I18n.t('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, 'errors.cli_options.filter_with_test_run'
66
+ raise CliOptionError, I18n.t('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, 'errors.cli_options.filter_status_without_test_run'
78
+ raise CliOptionError, I18n.t('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, 'errors.cli_options.missing_token'
85
+ raise CliOptionError, I18n.t('errors.cli_options.missing_token')
86
86
  end
87
87
 
88
88
  unless numeric?(cli_options.token)
89
- raise CliOptionError, 'errors.cli_options.invalid_token'
89
+ raise CliOptionError, I18n.t('errors.cli_options.invalid_token', token: cli_options.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, 'errors.cli_options.unreadable_report_file'
100
+ raise CliOptionError, I18n.t('errors.cli_options.unreadable_report_file', path: cli_options.push)
101
101
  elsif globbed_files.length == 1 && globbed_files == [cli_options.push]
102
102
  if !File.readable?(agnostic_path)
103
- raise CliOptionError, 'errors.cli_options.unreadable_report_file'
103
+ raise CliOptionError, I18n.t('errors.cli_options.unreadable_report_file', path: cli_options.push)
104
104
  elsif !File.file?(agnostic_path)
105
- raise CliOptionError, 'errors.cli_options.irregular_report_file'
105
+ raise CliOptionError, I18n.t('errors.cli_options.irregular_report_file', path: cli_options.push)
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, 'errors.cli_options.invalid_execution_environment'
114
+ raise CliOptionError, I18n.t('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, 'errors.cli_options.output_directory_not_writable'
125
+ raise CliOptionError, I18n.t('errors.cli_options.output_directory_not_writable', output_dir: cli_options.output_directory)
126
126
  else
127
- raise CliOptionError, 'errors.cli_options.output_directory_parent_not_writable'
127
+ raise CliOptionError, I18n.t('errors.cli_options.output_directory_parent_not_writable', realpath: parent.realpath, output_dir: cli_options.output_directory)
128
128
  end
129
129
  elsif !parent.directory?
130
- raise CliOptionError, 'errors.cli_options.output_directory_not_directory'
130
+ raise CliOptionError, I18n.t('errors.cli_options.output_directory_not_directory', output_dir: cli_options.output_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, 'errors.cli_options.actionwords_signature_directory'
139
+ raise CliOptionError, I18n.t('errors.cli_options.actionwords_signature_directory', path: actionwords_signature_file.realpath)
140
140
  elsif !actionwords_signature_file.exist?
141
- raise CliOptionError, 'errors.cli_options.missing_actionwords_signature_file'
141
+ raise CliOptionError, I18n.t('errors.cli_options.missing_actionwords_signature_file', directory_path: File.expand_path(cli_options.output_directory))
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, 'errors.cli_options.unreadable_xml_file'
151
+ raise CliOptionError, I18n.t('errors.cli_options.unreadable_xml_file', path: cli_options.xml_file)
152
152
  elsif !File.file?(xml_path)
153
- raise CliOptionError, 'errors.cli_options.irregular_xml_file'
153
+ raise CliOptionError, I18n.t('errors.cli_options.irregular_xml_file', path: cli_options.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, 'errors.cli_options.invalid_test_run_id'
160
+ raise CliOptionError, I18n.t('errors.cli_options.invalid_test_run_id', test_run_id: cli_options.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, 'errors.cli_options.invalid_numeric_value_list'
170
+ raise CliOptionError, I18n.t('errors.cli_options.invalid_numeric_value_list', option: option_name, incorrect_value: val.strip.inspect)
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, 'errors.cli_options.invalid_tag_value_list'
180
+ raise CliOptionError, I18n.t('errors.cli_options.invalid_tag_value_list', option: option_name, incorrect_value: val.strip.inspect)
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, 'errors.cli_options.invalid_meta'
190
+ raise CliOptionError, I18n.t('errors.cli_options.invalid_meta', incorrect_value: val.strip.inspect)
191
191
  end
192
192
  end
193
193
 
@@ -202,7 +202,13 @@ 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, 'errors.cli_options.unknown_categories'
205
+ raise CliOptionError, I18n.t(
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
+ )
206
212
  end
207
213
  end
208
214
  end
@@ -210,7 +216,7 @@ module Hiptest
210
216
 
211
217
  def check_build_options
212
218
  if present?(cli_options.build_id) && present?(cli_options.build_name)
213
- raise CliOptionError, 'errors.cli_options.multiple_build_options'
219
+ raise CliOptionError, I18n.t('errors.cli_options.multiple_build_options')
214
220
  end
215
221
  end
216
222
 
@@ -249,7 +255,7 @@ module Hiptest
249
255
  if formatted_categories.length == 1
250
256
  formatted_categories.first
251
257
  else
252
- 'I18n.t(:readable_list, first_items: formatted_categories[0...-1].join(", "), last_item: formatted_categories.last)'
258
+ I18n.t(:readable_list, first_items: formatted_categories[0...-1].join(", "), last_item: formatted_categories.last)
253
259
  end
254
260
  end
255
261
 
@@ -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 "#{:using_cached_data}" do
98
+ @reporter.with_status_message I18n.t(:using_cached_data) do
99
99
  return cached
100
100
  end
101
101
  end
102
102
 
103
- content = @reporter.with_status_message "#{:fetching_data}" do
103
+ content = @reporter.with_status_message I18n.t(: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, 'errors.project_not_found'
152
+ raise ClientError, I18n.t('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, 'errors.test_run_list_unavailable'
211
+ raise ClientError, I18n.t('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
- 'errors.no_test_runs'
224
+ I18n.t('errors.no_test_runs')
225
225
  else
226
- 'errors.no_matching_test_run'
226
+ I18n.t('errors.no_matching_test_run', test_runs: columnize_test_runs(available_test_runs))
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("#{:request_sent}")
292
+ @reporter.show_verbose_message(I18n.t(:request_sent, uri: request.uri))
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), "caching_data") { content }
23
+ file_writer.write_to_file(File.join(@cache_dir, filename), I18n.t("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("#{:using_cache}")
44
+ @reporter.show_verbose_message(I18n.t(:using_cache, full_path: full_path))
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
- 'actionwords_diff.exporting_diff_title') {
55
+ I18n.t('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 'actionwords_diff.summary.deleted'
111
+ puts I18n.t('actionwords_diff.summary.deleted', count: @diff[:deleted].length, command_line: command_line, list: displayable_list(@diff[:deleted]))
112
112
  puts ""
113
113
  end
114
114
 
115
115
  unless @diff[:created].nil?
116
- puts 'actionwords_diff.summary.created'
116
+ puts I18n.t('actionwords_diff.summary.created', count: @diff[:created].length, command_line: command_line, list: displayable_list(@diff[:created]))
117
117
  puts ""
118
118
  end
119
119
 
120
120
  unless @diff[:renamed].nil?
121
- puts 'actionwords_diff.summary.renamed'
121
+ puts I18n.t('actionwords_diff.summary.renamed', count: @diff[:renamed].length, command_line: command_line, list: displayable_list(@diff[:renamed]))
122
122
  puts ""
123
123
  end
124
124
 
125
125
  unless @diff[:signature_changed].nil?
126
- puts 'actionwords_diff.summary.signature_changed'
126
+ puts I18n.t('actionwords_diff.summary.signature_changed', count: @diff[:signature_changed].length, command_line: command_line, list: displayable_list(@diff[:signature_changed]))
127
127
  puts ""
128
128
  end
129
129
 
130
130
  unless @diff[:definition_changed].nil?
131
- puts 'actionwords_diff.summary.definition_changed'
131
+ puts I18n.t('actionwords_diff.summary.definition_changed', count: @diff[:definition_changed].length, command_line: command_line, list: displayable_list(@diff[:definition_changed]))
132
132
  puts ""
133
133
  end
134
134
 
135
135
  if @diff.empty?
136
- puts 'actionwords_diff.summary.empty'
136
+ puts I18n.t('actionwords_diff.summary.empty')
137
137
  puts ""
138
138
  end
139
139
  end
@@ -3,3 +3,4 @@ require 'i18n'
3
3
  require 'hiptest-publisher/utils'
4
4
 
5
5
  I18n.load_path << Dir["#{hiptest_publisher_path}/config/locales/*.yml"]
6
+ I18n.default_locale = :en
@@ -69,7 +69,7 @@ class Option
69
69
  if default == nil || default == ""
70
70
  @help
71
71
  else
72
- "#{@help}"
72
+ "#{@help} (#{I18n.t(:default)}: #{@default})"
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, "help.options.nomalized_options")
183
+ reporter.show_options(delta, I18n.t("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, '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)
225
+ Option.new('t', 'token=TOKEN', nil, String, I18n.t('options.token'), :token),
226
+ Option.new('l', 'language=LANG', 'ruby', String, I18n.t('options.language'), :language),
227
+ Option.new('f', 'framework=FRAMEWORK', '', String, I18n.t('options.framework'), :framework),
228
+ Option.new('o', 'output-directory=PATH', '.', String, I18n.t('options.output_directory'), :output_directory),
229
+ Option.new(nil, 'filename-pattern=PATTERN', nil, String, I18n.t('options.filename_pattern'), :filename_pattern),
230
+ Option.new('c', 'config-file=PATH', nil, String, I18n.t('options.config'), :config),
231
+ Option.new(nil, 'overriden-templates=PATH', '', String, I18n.t('options.overriden_templates'), :overriden_templates),
232
+ Option.new(nil, 'overriden-language-configs=PATH', '', String, I18n.t('options.overriden_language_configs'), :overriden_language_configs),
233
+ Option.new(nil, 'test-run-id=ID', '', String, I18n.t('options.test_run_id'), :test_run_id),
234
+ Option.new(nil, 'test-run-name=NAME', '', String, I18n.t('options.test_run_name'), :test_run_name),
235
+ Option.new(nil, 'only=CATEGORIES', nil, String, I18n.t('options.only'), :only),
236
+ Option.new(nil, 'without=CATEGORIES', nil, String, I18n.t('options.without'), :without),
237
+ Option.new('x', 'xml-file=PROJECT_XML', nil, String, I18n.t('options.xml_file'), :xml_file),
238
+ Option.new(nil, 'cache-dir=PATH', self.default_cache_directory, String, I18n.t('options.cache_dir'), :cache_dir),
239
+ Option.new(nil, 'cache-duration=DURATION', 60, Integer, I18n.t('options.cache_duration'), :cache_duration),
240
+ Option.new(nil, 'tests-only', false, nil, I18n.t('options.tests_only'), :tests_only),
241
+ Option.new(nil, 'actionwords-only', false, nil, I18n.t('options.actionwords_only'), :actionwords_only),
242
+ Option.new(nil, 'actionwords-signature', false, nil, I18n.t('options.actionwords_signature'), :actionwords_signature),
243
+ Option.new(nil, 'show-actionwords-diff', false, nil, I18n.t('options.actionwords_diff'), :actionwords_diff),
244
+ Option.new(nil, 'show-actionwords-diff-as-json', false, nil, I18n.t('options.actionwords_diff_json'), :actionwords_diff_json),
245
+ Option.new(nil, 'show-actionwords-deleted', false, nil, I18n.t('options.aw_deleted'), :aw_deleted),
246
+ Option.new(nil, 'show-actionwords-created', false, nil, I18n.t('options.aw_created'), :aw_created),
247
+ Option.new(nil, 'show-actionwords-renamed', false, nil, I18n.t('options.aw_renamed'), :aw_renamed),
248
+ Option.new(nil, 'show-actionwords-signature-changed', false, nil, I18n.t('options.aw_signature_changed'), :aw_signature_changed),
249
+ Option.new(nil, 'show-actionwords-definition-changed', false, nil, I18n.t('options.aw_definition_changed'), :aw_definition_changed),
250
+ Option.new(nil, 'library-name=LIBRARY_NAME', nil, String, I18n.t('options.library_name'), :library_name),
251
+ Option.new(nil, 'with-folders', false, nil, I18n.t('options.with_folders'), :with_folders),
252
+ Option.new(nil, 'empty-folders', false, nil, I18n.t('options.empty_folders'), :empty_folders),
253
+ Option.new(nil, 'split-scenarios', false, nil, I18n.t('options.split_scenarios'), :split_scenarios),
254
+ Option.new(nil, 'leafless-export', false, nil, I18n.t('options.leafless_export'), :leafless_export),
255
+ Option.new('s', 'site=SITE', 'https://studio.cucumber.io', String, I18n.t('options.site'), :site),
256
+ Option.new(nil, 'http-proxy=PROXY_URL', nil, String, I18n.t('options.http_proxy'), :http_proxy),
257
+ Option.new('p', 'push=FILE.TAP', '', String, I18n.t('options.push'), :push),
258
+ Option.new(nil, 'global-failure-on-missing-reports', false, nil, I18n.t('options.global_failure_on_missing_reports'), :global_failure_on_missing_reports),
259
+ Option.new(nil, 'push-format=tap', 'tap', String, I18n.t('options.push_format'), :push_format),
260
+ Option.new(nil, 'execution-environment=NAME', '', String, I18n.t('options.execution_environment'), :execution_environment),
261
+ Option.new(nil, 'build-id=ID', '', String, I18n.t('options.build_id'), :build_id),
262
+ Option.new(nil, 'build-name=NAME', '', String, I18n.t('options.build_name'), :build_name),
263
+ Option.new(nil, 'sort=[id,order,alpha]', 'order', String, I18n.t('options.sort'), :sort),
264
+ Option.new(nil, '[no-]uids', false, nil, I18n.t('options.uids'), :uids),
265
+ Option.new(nil, '[no-]parent-folder-tags', true, nil, I18n.t('options.parent_folder_tags'), :parent_folder_tags),
266
+ Option.new(nil, 'parameter-delimiter=DELIMITER', '"', EmptiableString, I18n.t('options.parameter_delimiter'), :parameter_delimiter),
267
+ Option.new(nil, 'with-dataset-names', false, nil, I18n.t('options.with_dataset_names'), :with_dataset_names),
268
+ Option.new(nil, 'keep-filenames', false, nil, I18n.t('options.keep_filenames'), :keep_filenames),
269
+ Option.new(nil, 'keep-foldernames', false, nil, I18n.t('options.keep_foldernames'), :keep_foldernames),
270
+ Option.new(nil, 'filter-on-scenario-ids=IDS', '', String, I18n.t('options.filter_on_scenario_ids'), :filter_on_scenario_ids),
271
+ Option.new(nil, 'filter-on-folder-ids=IDS', '', String, I18n.t('options.filter_on_folder_ids'), :filter_on_folder_ids),
272
+ Option.new(nil, 'filter-on-scenario-name=NAME', '', String, I18n.t('options.filter_on_scenario_name'), :filter_on_scenario_name),
273
+ Option.new(nil, 'filter-on-folder-name=NAME', '', String, I18n.t('options.filter_on_folder_name'), :filter_on_folder_name),
274
+ Option.new(nil, 'filter-on-tags=TAGS', '', String, I18n.t('options.filter_on_tags'), :filter_on_tags),
275
+ Option.new(nil, 'filter-on-status=STATUS', '', String, I18n.t('options.filter_on_status'), :filter_on_status),
276
+ Option.new(nil, 'not-recursive', false, nil, I18n.t('options.not_recursive'), :not_recursive),
277
+ Option.new(nil, 'meta=META', '', String, I18n.t('options.meta'), :meta),
278
+ Option.new(nil, 'check-version', false, nil, I18n.t('options.check_version'), :check_version),
279
+ Option.new(nil, 'force', false, nil, I18n.t('options.force_overwrite'), :force_overwrite),
280
+ Option.new(nil, '[no-]color', nil, nil, I18n.t('options.color'), :color),
281
+ Option.new('v', 'verbose', false, nil, I18n.t('options.verbose'), :verbose),
282
+ Option.new(nil, 'indentation=INDENTATION', nil, EmptiableString, I18n.t('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 = 'help.header'
301
- opts.separator "help.description"
300
+ opts.banner = I18n.t('help.header')
301
+ opts.separator I18n.t("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", 'options.languages_help') do
306
+ opts.on("-H", "--languages-help", I18n.t('options.languages_help')) do
307
307
  self.show_languages
308
308
  exit
309
309
  end
310
310
 
311
- opts.on_tail("-h", "--help", 'options.help') do
311
+ opts.on_tail("-h", "--help", I18n.t('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 'help.languages.supported_languages'
335
+ puts I18n.t('help.languages.supported_languages')
336
336
  languages.each do |language, frameworks|
337
337
  puts "#{language}:"
338
338
  if frameworks.empty?
339
- puts 'help.languages.no_framework_available'
339
+ puts I18n.t('help.languages.no_framework_available', language: make_language_option(language, ''))
340
340
  else
341
341
  frameworks.each_with_index do |fw, index|
342
342
  if index == 0
343
- puts " - #{fw} #{make_language_option(language, '')}"
343
+ puts " - #{fw} [#{I18n.t(:default)}] #{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('errors.template_not_found')
450
+ @template_path_by_name[template_name] or raise ArgumentError.new(I18n.t('errors.template_not_found', template_name: template_name, dirs: dirs))
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 'errors.invalid_node'
663
+ raise I18n.t('errors.invalid_node', name: self[:node_name], group_name: self[:group_name])
664
664
  end
665
665
  end
666
666
 
@@ -719,10 +719,9 @@ class LanguageConfigParser
719
719
 
720
720
  if !File.file?(config_path)
721
721
  if cli_options.framework.to_s.empty?
722
- message = 'errors.invalid_config_file_no_framework'
722
+ message = I18n.t('errors.invalid_config_file_no_framework', hiptest_publisher_path: hiptest_publisher_path, language: cli_options.language.inspect)
723
723
  else
724
- puts "config_path: #{config_path}"
725
- message = 'errors.invalid_config_file'
724
+ message = I18n.t('errors.invalid_config_file', hiptest_publisher_path: hiptest_publisher_path, language: cli_options.language.inspect, framework: cli_options.framework.inspect)
726
725
  end
727
726
  raise ArgumentError.new(message)
728
727
  end
@@ -14,7 +14,7 @@ end
14
14
  def hiptest_publisher_version
15
15
  Gem.loaded_specs['hiptest-publisher'].version.to_s
16
16
  rescue
17
- File.read("#{hiptest_publisher_path}/VERSION").strip if File.exist?("#{hiptest_publisher_path}/VERSION")
17
+ File.read("#{hiptest_publisher_path}/VERSION").strip if File.exists?("#{hiptest_publisher_path}/VERSION")
18
18
  end
19
19
 
20
20
  def pluralize_word(count, singular, plural=nil)
@@ -22,20 +22,20 @@ module Hiptest
22
22
  current = hiptest_publisher_version
23
23
 
24
24
  if latest == current
25
- puts 'check_version.up_to_date'
25
+ puts I18n.t('check_version.up_to_date', current: current)
26
26
  else
27
- puts 'check_version.outdated'
27
+ puts I18n.t('check_version.outdated', current: current, latest: latest)
28
28
  end
29
29
  end
30
30
 
31
31
  def get_latest_version
32
- reporter.with_status_message 'check_version.title' do
32
+ reporter.with_status_message I18n.t('check_version.title') do
33
33
  latest_gem = Gem.latest_version_for('hiptest-publisher')
34
34
 
35
- raise RuntimeError, 'check_version.error' if latest_gem.nil?
35
+ raise RuntimeError, I18n.t('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
@@ -381,7 +381,7 @@ module Hiptest
381
381
  end
382
382
  self.send("build_#{node.name}", node)
383
383
  rescue => error
384
- @reporter.dump_error(error, 'build_data.error')
384
+ @reporter.dump_error(error, I18n.t('build_data.error', node: node.to_s))
385
385
  nil
386
386
  end
387
387
 
@@ -18,9 +18,6 @@ require 'hiptest-publisher/string'
18
18
  require 'hiptest-publisher/utils'
19
19
  require 'hiptest-publisher/version_checker'
20
20
  require 'hiptest-publisher/xml_parser'
21
- require 'i18n'
22
-
23
-
24
21
 
25
22
  module Hiptest
26
23
  class Publisher
@@ -94,12 +91,12 @@ module Hiptest
94
91
  raise
95
92
  end
96
93
  rescue => err
97
- reporter.show_failure("errors.default")
94
+ reporter.show_failure(I18n.t("errors.default"))
98
95
  reporter.dump_error(err)
99
96
  end
100
97
 
101
98
  def get_project(xml)
102
- reporter.with_status_message 'build_data.title' do
99
+ reporter.with_status_message I18n.t('build_data.title') do
103
100
  parser = Hiptest::XMLParser.new(xml, reporter)
104
101
  return parser.build_project
105
102
  end
@@ -117,10 +114,10 @@ module Hiptest
117
114
  return true if @cli_options.force_overwrite
118
115
 
119
116
  if $stdout.tty?
120
- answer = reporter.ask("Do you want to overwrite the file at #{path}? (y/yes)")
117
+ answer = reporter.ask(I18n.t('overwrite.ask_confirmation', path: path))
121
118
  return ['y', 'yes'].include?(answer)
122
119
  else
123
- reporter.warning_message("File at #{path} already exists!")
120
+ reporter.warning_message(I18n.t('overwrite.warning_message', path: path))
124
121
  return false
125
122
  end
126
123
  end
@@ -145,7 +142,7 @@ module Hiptest
145
142
  node_rendering_context.path,
146
143
  node_rendering_context.node,
147
144
  node_rendering_context,
148
- "node_rendering_context.description",
145
+ I18n.t(:exporting_file, name: node_rendering_context.description),
149
146
  ask_overwrite: ask_overwrite
150
147
  )
151
148
  end
@@ -157,14 +154,14 @@ module Hiptest
157
154
 
158
155
  write_to_file(
159
156
  "#{@cli_options.output_directory}/actionwords_signature.yaml",
160
- 'actionwords_diff.exporting_title',
157
+ I18n.t('actionwords_diff.exporting_title'),
161
158
  ask_overwrite: true
162
159
  ) { Hiptest::SignatureExporter.export_actionwords(@project).to_yaml }
163
160
  end
164
161
 
165
162
  def compute_actionwords_diff
166
163
  old = nil
167
- reporter.with_status_message('Loading previous definition...') do
164
+ reporter.with_status_message I18n.t('actionwords_diff.loading_previous_definition') do
168
165
  old = YAML.load_file("#{@cli_options.output_directory}/actionwords_signature.yaml")
169
166
  end
170
167
 
@@ -182,7 +179,7 @@ module Hiptest
182
179
 
183
180
  def analyze_project_data
184
181
  return if @project_data_analyzed
185
- reporter.with_status_message("#{:analyzing_data}") do
182
+ reporter.with_status_message I18n.t(:analyzing_data) do
186
183
  @language_config = LanguageConfigParser.new(@cli_options)
187
184
  Hiptest::NodeModifiers.add_all(@project, @cli_options.sort)
188
185
  end
@@ -200,16 +197,16 @@ module Hiptest
200
197
  def print_categories
201
198
  language_config = LanguageConfigParser.new(@cli_options)
202
199
  group_names = language_config.group_names
203
- puts 'help.categories.title'
200
+ puts I18n.t('help.categories.title', language: @cli_options.language)
204
201
  group_names.each do |group_name|
205
202
  puts " - #{group_name}"
206
203
  end
207
- puts 'help.categories.usage_example'
204
+ puts I18n.t('help.categories.usage_example', language: @cli_options.language, first: group_names.first, second: group_names[1])
208
205
  end
209
206
 
210
207
  def post_results
211
208
  response = nil
212
- reporter.with_status_message('push.posting_results') do
209
+ reporter.with_status_message I18n.t('push.posting_results', file: @cli_options.push, site: @cli_options.site) do
213
210
  response = @client.push_results
214
211
  end
215
212
  if valid_hiptest_api_response?(response)
@@ -231,23 +228,23 @@ module Hiptest
231
228
  reported_tests = json.has_key?('test_import') ? json['test_import'] : []
232
229
  passed_count = reported_tests.size
233
230
 
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']}"
231
+ reporter.with_status_message I18n.t('push.tests_imported_summary', count: passed_count) do
232
+ if @cli_options.verbose
233
+ reported_tests.each do |imported_test|
234
+ puts I18n.t('push.test_imported', name: imported_test['name'])
235
+ end
238
236
  end
239
237
  end
240
- end
241
238
 
242
239
  display_empty_push_help if passed_count == 0
243
240
  end
244
241
 
245
242
  def report_hiptest_api_error(response)
246
- reporter.failure_message("'errors.api_error' with code: #{response.code}")
243
+ reporter.failure_message(I18n.t('errors.api_error', code: response.code))
247
244
  if response.code == "422" && response.body.start_with?("Unknown format")
248
245
  STDERR.print response.body.chomp + "\n"
249
246
  elsif response.code == "404"
250
- STDERR.print 'errors.project_not_found'
247
+ STDERR.print I18n.t('errors.project_not_found')
251
248
  end
252
249
  end
253
250
 
@@ -255,10 +252,10 @@ module Hiptest
255
252
  command = @cli_options.command_line_used(exclude: [:push, :push_format, :execution_environment])
256
253
  enhanced_command = "#{command} --without=actionwords"
257
254
  if @cli_options.test_run_id.nil? || @cli_options.test_run_id.empty?
258
- enhanced_command += " --test-run-id=<#{'push.test_run_id'}>"
255
+ enhanced_command += " --test-run-id=<#{I18n.t('push.test_run_id')}>"
259
256
  end
260
257
 
261
- puts 'push.empty_results'
258
+ puts I18n.t('push.empty_results', enhanced_command: enhanced_command)
262
259
  end
263
260
  end
264
261
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher-fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.8
4
+ version: 3.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - CucumberStudio R&D