hiptest-publisher 1.7.1 → 1.8.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7060a45b500229208b1aab41f027f613a16cfaeb
|
4
|
+
data.tar.gz: 5e2e1810d7b3d7ced4b7f60fb4396b9fd9e636aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5070ded6342524ea605b5cb9a44344fecbfb09efb34a943929775638dd782e76764b2eec229779c1d48bef7e0a9fa9aa2cffa35bd8ca4bd6bcd0f152820532c
|
7
|
+
data.tar.gz: 47c9e6af92a1d2838477959a629a3742abe86a6e50cc3a08ee74749d5f54daa6afcc99e33cb1dd866608621e76e3d9c0d610565fd1790f3af12e37451bc19d1b
|
data/lib/hiptest-publisher.rb
CHANGED
@@ -18,7 +18,6 @@ require 'hiptest-publisher/signature_exporter'
|
|
18
18
|
require 'hiptest-publisher/signature_differ'
|
19
19
|
require 'hiptest-publisher/items_orderer'
|
20
20
|
|
21
|
-
|
22
21
|
module Hiptest
|
23
22
|
class Publisher
|
24
23
|
attr_reader :reporter
|
@@ -106,7 +105,9 @@ module Hiptest
|
|
106
105
|
reporter.dump_error(err)
|
107
106
|
end
|
108
107
|
|
109
|
-
def write_to_file(path, message)
|
108
|
+
def write_to_file(path, message, ask_overwrite: false)
|
109
|
+
return if ask_overwrite && !overwrite_file?(path)
|
110
|
+
|
110
111
|
reporter.with_status_message "#{message}: #{path}" do
|
111
112
|
mkdirs_for(path)
|
112
113
|
File.open(path, 'w') do |file|
|
@@ -117,6 +118,21 @@ module Hiptest
|
|
117
118
|
reporter.dump_error(err)
|
118
119
|
end
|
119
120
|
|
121
|
+
def overwrite_file?(path)
|
122
|
+
return true unless File.file?(path)
|
123
|
+
return true if @cli_options.force_overwrite
|
124
|
+
|
125
|
+
if $stdout.isatty
|
126
|
+
puts ""
|
127
|
+
STDOUT.print "[#{"?".yellow}] File #{path} exists, do you want to overwrite it? [y/N] "
|
128
|
+
answer = $stdin.gets.chomp.downcase.strip
|
129
|
+
return ['y', 'yes'].include?(answer)
|
130
|
+
else
|
131
|
+
reporter.notify(:show_status_message, "File #{path} already exists, skipping. Use --force to overwrite it.", :warning)
|
132
|
+
return false
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
120
136
|
def mkdirs_for(path)
|
121
137
|
unless Dir.exists?(File.dirname(path))
|
122
138
|
FileUtils.mkpath(File.dirname(path))
|
@@ -127,20 +143,23 @@ module Hiptest
|
|
127
143
|
reporter.add_listener(listener)
|
128
144
|
end
|
129
145
|
|
130
|
-
def write_node_to_file(path, node, context, message)
|
131
|
-
write_to_file(path, message) do
|
146
|
+
def write_node_to_file(path, node, context, message, ask_overwrite: false)
|
147
|
+
write_to_file(path, message, ask_overwrite: ask_overwrite) do
|
132
148
|
Hiptest::Renderer.render(node, context)
|
133
149
|
end
|
134
150
|
end
|
135
151
|
|
136
152
|
def export_files
|
137
153
|
@language_config.language_group_configs.each do |language_group_config|
|
154
|
+
ask_overwrite = language_group_config[:group_name] == 'actionwords'
|
155
|
+
|
138
156
|
language_group_config.each_node_rendering_context(@project) do |node_rendering_context|
|
139
157
|
write_node_to_file(
|
140
158
|
node_rendering_context.path,
|
141
159
|
node_rendering_context.node,
|
142
160
|
node_rendering_context,
|
143
161
|
"Exporting #{node_rendering_context.description}",
|
162
|
+
ask_overwrite: ask_overwrite
|
144
163
|
)
|
145
164
|
end
|
146
165
|
end
|
@@ -151,7 +170,8 @@ module Hiptest
|
|
151
170
|
|
152
171
|
write_to_file(
|
153
172
|
"#{@cli_options.output_directory}/actionwords_signature.yaml",
|
154
|
-
"Exporting actionword signature"
|
173
|
+
"Exporting actionword signature",
|
174
|
+
ask_overwrite: true
|
155
175
|
) { Hiptest::SignatureExporter.export_actionwords(@project).to_yaml }
|
156
176
|
end
|
157
177
|
|
@@ -242,6 +242,7 @@ class OptionsParser
|
|
242
242
|
Option.new(nil, 'filter-on-status=STATUS', '', String, "Filter on test status in last build (use in conjunction with a test run)", :filter_on_status),
|
243
243
|
Option.new(nil, 'not-recursive', false, nil, "Used in conjunction with filter-on-folder-ids or filter-on-folder-name: only exports those folders, not their children", :not_recursive),
|
244
244
|
Option.new(nil, 'check-version', false, nil, "Check if a new release of hiptest-publisher is available", :check_version),
|
245
|
+
Option.new(nil, 'force', false, nil, "Force overwrite of existing files (do not apply to test files)", :force_overwrite),
|
245
246
|
Option.new('v', 'verbose', false, nil, "Run verbosely", :verbose)
|
246
247
|
]
|
247
248
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiptest-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiptest R&D
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|