turbot-runner 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2JhNzliMDZmNzcwZjBlMWQzNmE2OWIzNDcyNTAwZmU0MjUzNmUzNg==
4
+ MzVkNzhlM2NjN2VjNmY4ZTY1NWYxMDAzMTIzNzA2ZTNmMWZjYmNlMA==
5
5
  data.tar.gz: !binary |-
6
- ZTkxN2NjZTE0ZjJkMDZhNTVmYjQxMTkyYWIyMzY3NWJlOWU1OTIxMw==
6
+ MDE4OTUxZDgwNWUyZTUzOTA4YTM1ZWVkMzMzY2Y1OTRkZDA5NTkxYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTU2MDk0NjI5MTI4MmQ1Zjk2N2E5ZmM4ZjM4MzAxMTE5N2JkYjc5ZTBiNWYw
10
- MmQ2MzBiMjczNTYwNTVkM2Y3NTRkNTQ1ZGZkMGFjZDQ2NGUzYmM2NzIxYTQ2
11
- M2E5NGE3ZTYxZThlODU1ZWE2ZWE4MjNiZDBjOGI1OGUwYTNhYjY=
9
+ YmMzMmRlZTRkZGE4MDRjMzMwYjE1N2E0ODUxYzgxMGM0Y2QzYjM3YjlhMmRh
10
+ NWU3YmFjMDc2YTc4ZWJjZjFjNDVmMTZiZjMxZWZjMmQ4MDY2NGE5Nzk1YzRk
11
+ MmIwMTM3NTViOTA4MDliN2Q1NGFiYjFhYWFmYzM3MTRlN2ZmMWU=
12
12
  data.tar.gz: !binary |-
13
- MjEyZjM4ZDcyY2VhZjBlYTdjZGRmZGI0ODhiZWVkMTEyMzU5NWEyZGQ0NDM3
14
- YTcxMmNiNGQyNTdkODliOGNiZDU1Y2NkMGU2ZDI2NjhiZDVlYWQ2OTA0NjAx
15
- NDhmYTUyZWY2Njk3ODcxZDMzNGNmMzQ4MGJmYzkyOTlkZmMzMGY=
13
+ ZjRkYWUyMDVhNWY4M2JiZGY4YmM1NDAyNGE2ZmZiZGI2MDUwODc1NGFiNzA5
14
+ MTY4M2ZlNGU4ZWMyOWQ4ZDhlMzAxMTYzZGU2ZjQzYjgyOTI1NGUzMjkyMjk2
15
+ NjczNmYwYzNiZDkxMDk1OWJjYzY0N2IzNWQ3ZmQ3OWQwMTgzY2U=
@@ -15,8 +15,8 @@ module TurbotRunner
15
15
  end
16
16
 
17
17
  def run
18
- FileUtils.rm_rf(@output_directory)
19
- FileUtils.mkdir_p(@output_directory)
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
 
@@ -1,3 +1,3 @@
1
1
  module TurbotRunner
2
- VERSION = '0.1.16'
2
+ VERSION = '0.1.17'
3
3
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbot-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenCorporates