turbot-runner-morph 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 81a9f7aec50dd9258cb30f19328c397584099923
4
- data.tar.gz: b830065d79cd912092397b20563161802648dcc4
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDJhMjMzZjdhNjZkNTdmZDE1Y2YwYzA2MzI1NjJiNTNhODk5NGMyZg==
5
+ data.tar.gz: !binary |-
6
+ MDFjYzNkYjgzYjdhM2RhNWFhMTFmZTZiYjE0NmM5ZjRmODFiNmRmOA==
5
7
  SHA512:
6
- metadata.gz: bc9daa3e3b063740c39c740b7874053e9fbc2ed1854994ea985dde14cdda224f5a4a553f0959def6a2b0f7829fdada05b8cc8572a60ab621f5eba179f5a48c46
7
- data.tar.gz: da203564d81edacb080fb187f2aa71053306cda68840e7bf55a091f440b3885a11016dc7d38e746fafb701872f1bf23f303aeb67e62a46e1944c500dac51275a
8
+ metadata.gz: !binary |-
9
+ OTQxMDQwYTBhMmI4MDQxZmNlNWNhNmU4NmVlODNlNzYxNzA1OGMyZDZmZmMy
10
+ MmM3MGFhYjhlZDE1ZWViOTk5ZGViOGEwZmM0MThjZWEwY2M3NDZkZWM2YWFm
11
+ YjA3NzgxODU3M2Y3MTM0NGMyNDgwNGY2YzZmZTc2YjBjMWQwNjA=
12
+ data.tar.gz: !binary |-
13
+ M2E2MmFmZmZkYzBkZWFiMTNjODYwOWFkMjJkYzJlZTI4YjgwMTI1YmY3YjUx
14
+ ZDIzNDc2NTUyMTYzYmFkOTZjMDQyYzIxZjhmMzNlYjMyNjViYjdmZTE4MDkx
15
+ ZDM1YTFkODIwNmRhYjVmMzM5NGEzOGZjNjg0ZjQ1NWJhZDY3YzY=
@@ -3,6 +3,9 @@ module TurbotRunner
3
3
  def handle_valid_record(record, data_type)
4
4
  end
5
5
 
6
+ def handle_snapshot_ended
7
+ end
8
+
6
9
  def handle_run_ended
7
10
  end
8
11
 
@@ -11,8 +11,8 @@ module TurbotRunner
11
11
 
12
12
  def process(line)
13
13
  begin
14
- if line.strip == "RUN ENDED"
15
- @record_handler.handle_run_ended
14
+ if line.strip == "SNAPSHOT ENDED" || line.strip == "RUN ENDED" # latter is legacy
15
+ @record_handler.handle_snapshot_ended
16
16
  @runner.interrupt if @runner
17
17
  else
18
18
  record = Openc::JsonSchema.convert_dates(schema_path, JSON.parse(line))
@@ -1,3 +1,3 @@
1
1
  module TurbotRunner
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -0,0 +1,8 @@
1
+ {
2
+ "bot_id": "bot-that-emits-snapshot-ended",
3
+ "description": "This is a bot that emits SNAPSHOT ENDED",
4
+ "language": "ruby",
5
+ "data_type": "primary data",
6
+ "identifying_fields": ["licence_number"],
7
+ "files": ["scraper.rb"]
8
+ }
@@ -0,0 +1,11 @@
1
+ require 'json'
2
+
3
+ 0.upto(2) do |n|
4
+ record = {
5
+ :licence_number => "XYZ#{n}",
6
+ :source_url => 'http://example.com',
7
+ :sample_date => '2014-06-01'
8
+ }
9
+ puts(record.to_json)
10
+ end
11
+ puts "SNAPSHOT ENDED"
@@ -88,8 +88,9 @@ describe TurbotRunner::Runner do
88
88
  before do
89
89
  @runner = test_runner('bot-that-emits-run-ended', :log_to_file => true)
90
90
  end
91
- it 'calls handle_run_ended on the handler' do
92
- expect_any_instance_of(TurbotRunner::BaseHandler).to receive(:handle_run_ended)
91
+
92
+ it 'calls handle_snapshot_ended on the handler' do
93
+ expect_any_instance_of(TurbotRunner::BaseHandler).to receive(:handle_snapshot_ended)
93
94
  @runner.run
94
95
  end
95
96
 
@@ -99,6 +100,21 @@ describe TurbotRunner::Runner do
99
100
  end
100
101
  end
101
102
 
103
+ context 'with a bot that outputs SNAPSHOT ENDED' do
104
+ before do
105
+ @runner = test_runner('bot-that-emits-snapshot-ended', :log_to_file => true)
106
+ end
107
+
108
+ it 'calls handle_snapshot_ended on the handler' do
109
+ expect_any_instance_of(TurbotRunner::BaseHandler).to receive(:handle_snapshot_ended)
110
+ @runner.run
111
+ end
112
+
113
+ it 'interrupts the run' do
114
+ expect_any_instance_of(TurbotRunner::ScriptRunner).to receive(:interrupt)
115
+ @runner.run
116
+ end
117
+ end
102
118
 
103
119
  context 'with a bot that crashes in scraper' do
104
120
  before do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbot-runner-morph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenCorporates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-21 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openc-json_schema
@@ -87,6 +87,8 @@ files:
87
87
  - spec/bots/bot-that-crashes-in-transformer/transformer2.rb
88
88
  - spec/bots/bot-that-emits-run-ended/manifest.json
89
89
  - spec/bots/bot-that-emits-run-ended/scraper.rb
90
+ - spec/bots/bot-that-emits-snapshot-ended/manifest.json
91
+ - spec/bots/bot-that-emits-snapshot-ended/scraper.rb
90
92
  - spec/bots/bot-that-expects-file/manifest.json
91
93
  - spec/bots/bot-that-expects-file/scraper.rb
92
94
  - spec/bots/bot-that-expects-file/something.txt
@@ -134,18 +136,19 @@ require_paths:
134
136
  - lib
135
137
  required_ruby_version: !ruby/object:Gem::Requirement
136
138
  requirements:
137
- - - ">="
139
+ - - ! '>='
138
140
  - !ruby/object:Gem::Version
139
141
  version: 1.9.2
140
142
  required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  requirements:
142
- - - ">="
144
+ - - ! '>='
143
145
  - !ruby/object:Gem::Version
144
146
  version: '0'
145
147
  requirements: []
146
148
  rubyforge_project:
147
- rubygems_version: 2.4.5
149
+ rubygems_version: 2.2.2
148
150
  signing_key:
149
151
  specification_version: 4
150
152
  summary: Utilities for running bots with Turbot
151
153
  test_files: []
154
+ has_rdoc: