turbot-runner 0.1.16 → 0.1.17
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 +8 -8
- data/lib/turbot_runner/runner.rb +14 -2
- data/lib/turbot_runner/version.rb +1 -1
- data/spec/lib/runner_spec.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzVkNzhlM2NjN2VjNmY4ZTY1NWYxMDAzMTIzNzA2ZTNmMWZjYmNlMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDE4OTUxZDgwNWUyZTUzOTA4YTM1ZWVkMzMzY2Y1OTRkZDA5NTkxYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmMzMmRlZTRkZGE4MDRjMzMwYjE1N2E0ODUxYzgxMGM0Y2QzYjM3YjlhMmRh
|
10
|
+
NWU3YmFjMDc2YTc4ZWJjZjFjNDVmMTZiZjMxZWZjMmQ4MDY2NGE5Nzk1YzRk
|
11
|
+
MmIwMTM3NTViOTA4MDliN2Q1NGFiYjFhYWFmYzM3MTRlN2ZmMWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjRkYWUyMDVhNWY4M2JiZGY4YmM1NDAyNGE2ZmZiZGI2MDUwODc1NGFiNzA5
|
14
|
+
MTY4M2ZlNGU4ZWMyOWQ4ZDhlMzAxMTYzZGU2ZjQzYjgyOTI1NGUzMjkyMjk2
|
15
|
+
NjczNmYwYzNiZDkxMDk1OWJjYzY0N2IzNWQ3ZmQ3OWQwMTgzY2U=
|
data/lib/turbot_runner/runner.rb
CHANGED
@@ -15,8 +15,8 @@ module TurbotRunner
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
|
19
|
-
|
18
|
+
set_up_output_directory
|
19
|
+
|
20
20
|
succeeded = run_script(scraper_config)
|
21
21
|
# Run the transformers even if the scraper fails
|
22
22
|
transformers.each do |transformer_config|
|
@@ -25,6 +25,18 @@ module TurbotRunner
|
|
25
25
|
succeeded
|
26
26
|
end
|
27
27
|
|
28
|
+
def set_up_output_directory
|
29
|
+
FileUtils.mkdir_p(@output_directory)
|
30
|
+
|
31
|
+
FileUtils.rm_f(File.join(@output_directory, 'scraper.out'))
|
32
|
+
FileUtils.rm_f(File.join(@output_directory, 'scraper.err'))
|
33
|
+
|
34
|
+
transformers.each do |transformer_config|
|
35
|
+
FileUtils.rm_f(File.join(@output_directory, "#{transformer_config[:file]}.out"))
|
36
|
+
FileUtils.rm_f(File.join(@output_directory, "#{transformer_config[:file]}.err"))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
28
40
|
def process_output
|
29
41
|
process_script_output(scraper_config)
|
30
42
|
|
data/spec/lib/runner_spec.rb
CHANGED
@@ -259,6 +259,26 @@ describe TurbotRunner::Runner do
|
|
259
259
|
runner.process_output
|
260
260
|
end
|
261
261
|
end
|
262
|
+
|
263
|
+
describe '#set_up_output_directory' do
|
264
|
+
before do
|
265
|
+
@runner = TurbotRunner::Runner.new('spec/bots/bot-with-transformer')
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'clears existing output' do
|
269
|
+
path = File.join(@runner.directory, 'output', 'scraper.out')
|
270
|
+
FileUtils.touch(path)
|
271
|
+
@runner.set_up_output_directory
|
272
|
+
expect(File.exist?(path)).to be(false)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'does not clear existing files that are not output files' do
|
276
|
+
path = File.join(@runner.directory, 'output', 'stdout')
|
277
|
+
FileUtils.touch(path)
|
278
|
+
@runner.set_up_output_directory
|
279
|
+
expect(File.exist?(path)).to be(true)
|
280
|
+
end
|
281
|
+
end
|
262
282
|
end
|
263
283
|
|
264
284
|
|