turbot-runner 0.2.31 → 0.2.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/bin/bundle +105 -0
  4. data/bin/rspec +29 -0
  5. data/lib/turbot_runner/runner.rb +5 -7
  6. data/lib/turbot_runner/version.rb +1 -1
  7. data/schema/schemas/accounts-statement-schema.json +48 -29
  8. data/schema/schemas/alternate-registration-schema.json +88 -0
  9. data/schema/schemas/alternative-name-schema.json +83 -0
  10. data/schema/schemas/company-schema.json +22 -6
  11. data/schema/schemas/control-statement-schema.json +46 -8
  12. data/schema/schemas/filing-schema.json +3 -4
  13. data/schema/schemas/financial-payment-schema.json +1 -1
  14. data/schema/schemas/gazette-notice-schema.json +337 -312
  15. data/schema/schemas/includes/{accounts_element.json → accounts-element.json} +1 -1
  16. data/schema/schemas/includes/address.json +2 -3
  17. data/schema/schemas/includes/{alternative_name.json → alternative-name.json} +1 -1
  18. data/schema/schemas/includes/base-statement.json +5 -2
  19. data/schema/schemas/includes/company-for-nesting.json +3 -3
  20. data/schema/schemas/includes/company.json +1 -1
  21. data/schema/schemas/includes/date.json +17 -4
  22. data/schema/schemas/includes/entity.json +2 -2
  23. data/schema/schemas/includes/{filing_document.json → filing-document.json} +12 -3
  24. data/schema/schemas/includes/filing.json +1 -1
  25. data/schema/schemas/includes/financial-payment-data-object.json +1 -1
  26. data/schema/schemas/includes/identifier.json +1 -1
  27. data/schema/schemas/includes/{industry_code.json → industry-code.json} +1 -1
  28. data/schema/schemas/includes/legislation.json +1 -1
  29. data/schema/schemas/includes/licence-data-object.json +1 -1
  30. data/schema/schemas/includes/officer.json +1 -1
  31. data/schema/schemas/includes/organisation.json +8 -5
  32. data/schema/schemas/includes/permission.json +1 -1
  33. data/schema/schemas/includes/{person_name.json → person-name.json} +1 -1
  34. data/schema/schemas/includes/person.json +9 -7
  35. data/schema/schemas/includes/{previous_name.json → previous-name.json} +1 -1
  36. data/schema/schemas/includes/range.json +1 -1
  37. data/schema/schemas/includes/sanction.json +5 -2
  38. data/schema/schemas/includes/share-parcel-data.json +1 -1
  39. data/schema/schemas/includes/share-parcel.json +17 -5
  40. data/schema/schemas/includes/subsidiary-relationship-data.json +1 -1
  41. data/schema/schemas/includes/total-shares.json +1 -1
  42. data/schema/schemas/includes/{unknown_entity_type.json → unknown-entity-type.json} +8 -5
  43. data/schema/schemas/licence-schema.json +1 -1
  44. data/schema/schemas/primary-data-schema.json +1 -1
  45. data/schema/schemas/register-entry-schema.json +4 -3
  46. data/schema/schemas/sanctioned-entity-schema.json +4 -5
  47. data/schema/schemas/share-parcel-schema.json +1 -1
  48. data/schema/schemas/simple-financial-payment-schema.json +1 -1
  49. data/schema/schemas/simple-licence-schema.json +1 -1
  50. data/schema/schemas/simple-subsidiary-schema.json +1 -1
  51. data/schema/schemas/subsequent-registration-schema.json +89 -0
  52. data/schema/schemas/subsidiary-relationship-schema.json +1 -1
  53. data/schema/schemas/supplier-relationship-schema.json +82 -0
  54. data/schema/schemas/trademark-registration-schema.json +3 -1
  55. data/spec/lib/runner_spec.rb +71 -39
  56. metadata +19 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46d0832f2aa1a49fe3dd1bfa866acc052675d763
4
- data.tar.gz: 4603ea580c1f2e8bf89bd814ee1898db62947a10
3
+ metadata.gz: df9e22cebf2baaf92d7c95c0d8eca6732cca4647
4
+ data.tar.gz: 1ba141e04d8c491bdf1e013605d4dff7627e6859
5
5
  SHA512:
6
- metadata.gz: 5ead2003d9cf2a65cb20a02d081facde62a72d80696c915dbdf8e5a14092b06d305533c60eda271c403036610e6660f6ca967dd44064ce3bb12e425725aaed6e
7
- data.tar.gz: 015a456f06cd43ea1e677a2daf3f7aff8bf016374b57944ce2410010c528f3169df5c894e4c4e82ee028985f2917d3d36e0e5d23ec178e404c56be6def960727
6
+ metadata.gz: ae86d6d271139df365c4e677295e769ce261e5cab70db4b6ac9498f84256c955d156f83376a6b7e63ca96488687e19be0a49170aa6583e996cd9fd5b6fd127d1
7
+ data.tar.gz: eed08d32b718add5ec5af36ed785876af6f3d05d26f8be735307a0c4567aa6e9ed849ac99d74cb437ec3025493ce5d49eeed30e496b84508aef281a456d7f774
data/.travis.yml CHANGED
@@ -8,7 +8,7 @@ rvm:
8
8
  - 2.2
9
9
  - 2.3
10
10
  before_install:
11
- - gem update --system
12
- - gem update bundler
11
+ - gem update --system 2.7.8
12
+ - gem install bundler -v 1.17.3
13
13
  script:
14
- bundle exec rspec
14
+ bin/rspec
data/bin/bundle ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -124,15 +124,13 @@ module TurbotRunner
124
124
  # record handling.
125
125
  processor = Processor.new(nil, script_config, @record_handler)
126
126
  file = output_file(script_config[:file])
127
- File.open(file) do |f|
128
- f.each_line do |line|
129
- processor.process(line, opts)
127
+ if File.exist?(file)
128
+ File.open(file) do |f|
129
+ f.each_line do |line|
130
+ processor.process(line, opts)
131
+ end
130
132
  end
131
133
  end
132
- rescue Errno::ENOENT => e
133
- # We only want to catch ENOENT if the output file doesn't exist, and not
134
- # if, for instance, a schema file is missing.
135
- raise unless e.message == "No such file or directory - #{output_file(script_config[:file])}"
136
134
  end
137
135
 
138
136
  def build_command(script, input_file=nil)
@@ -1,3 +1,3 @@
1
1
  module TurbotRunner
2
- VERSION = '0.2.31'
2
+ VERSION = '0.2.35'
3
3
  end
@@ -20,60 +20,88 @@
20
20
  },
21
21
  "accounts_type": {
22
22
  "description": "The type of accounts – either annual, or quarterly, or null if not known",
23
- "enum": ["annual", "quarterly", null]
23
+ "enum": [
24
+ "annual",
25
+ "quarterly",
26
+ null
27
+ ]
24
28
  },
25
29
  "profit": {
26
30
  "type": "array",
27
31
  "items": {
28
- "$ref": "includes/accounts_element.json"
32
+ "$ref": "includes/accounts-element.json"
29
33
  }
30
34
  },
31
35
  "revenue": {
32
- "type": ["array","null"],
36
+ "type": [
37
+ "array",
38
+ "null"
39
+ ],
33
40
  "items": {
34
- "$ref": "includes/accounts_element.json"
41
+ "$ref": "includes/accounts-element.json"
35
42
  }
36
43
  },
37
44
  "current_assets": {
38
- "type": ["array","null"],
45
+ "type": [
46
+ "array",
47
+ "null"
48
+ ],
39
49
  "items": {
40
- "$ref": "includes/accounts_element.json"
50
+ "$ref": "includes/accounts-element.json"
41
51
  }
42
52
  },
43
53
  "total_assets": {
44
- "type": ["array","null"],
54
+ "type": [
55
+ "array",
56
+ "null"
57
+ ],
45
58
  "items": {
46
- "$ref": "includes/accounts_element.json"
59
+ "$ref": "includes/accounts-element.json"
47
60
  }
48
61
  },
49
62
  "fixed_assets": {
50
- "type": ["array","null"],
63
+ "type": [
64
+ "array",
65
+ "null"
66
+ ],
51
67
  "items": {
52
- "$ref": "includes/accounts_element.json"
68
+ "$ref": "includes/accounts-element.json"
53
69
  }
54
70
  },
55
71
  "current_liabilities": {
56
- "type": ["array","null"],
72
+ "type": [
73
+ "array",
74
+ "null"
75
+ ],
57
76
  "items": {
58
- "$ref": "includes/accounts_element.json"
77
+ "$ref": "includes/accounts-element.json"
59
78
  }
60
79
  },
61
80
  "total_liabilities": {
62
- "type": ["array","null"],
81
+ "type": [
82
+ "array",
83
+ "null"
84
+ ],
63
85
  "items": {
64
- "$ref": "includes/accounts_element.json"
86
+ "$ref": "includes/accounts-element.json"
65
87
  }
66
88
  },
67
89
  "cash_at_bank": {
68
- "type": ["array","null"],
90
+ "type": [
91
+ "array",
92
+ "null"
93
+ ],
69
94
  "items": {
70
- "$ref": "includes/accounts_element.json"
95
+ "$ref": "includes/accounts-element.json"
71
96
  }
72
97
  },
73
98
  "documents": {
74
- "type": ["array","null"],
99
+ "type": [
100
+ "array",
101
+ "null"
102
+ ],
75
103
  "items": {
76
- "$ref": "includes/filing_document.json"
104
+ "$ref": "includes/filing-document.json"
77
105
  }
78
106
  },
79
107
  "filing_type_name": {
@@ -133,15 +161,6 @@
133
161
  "type": "string",
134
162
  "description": "If the accounts filing has been put on sources.opencorporates.com the path to the filing"
135
163
  },
136
- "confidence": {
137
- "description": "Confidence in accuracy of data",
138
- "type": "string",
139
- "enum": [
140
- "HIGH",
141
- "MEDIUM",
142
- "LOW"
143
- ]
144
- },
145
164
  "other_attributes": {
146
165
  "description": "Use for other attributes for which we don't yet have curated schema attributes",
147
166
  "type": "object"
@@ -155,5 +174,5 @@
155
174
  "confidence",
156
175
  "filing_date",
157
176
  "accounts_type"
158
- ]
159
- }
177
+ ]
178
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "description": "A representation of multiple registrations for the same entity",
4
+ "type": "object",
5
+ "properties": {
6
+ "data_type": {
7
+ "enum": [
8
+ "alternate-registration"
9
+ ]
10
+ },
11
+ "alternate_entities": {
12
+ "description": "array of entities that are linked via alternate registrations",
13
+ "type": "array",
14
+ "items": {
15
+ "$ref": "includes/entity.json",
16
+ "minLength": 2
17
+ }
18
+ },
19
+ "alternate_registration_start_date": {
20
+ "description": "date when alternate registration started",
21
+ "type": "string",
22
+ "format": "date"
23
+ },
24
+ "alternate_registration_end_date": {
25
+ "description": "date when alternate registration ended",
26
+ "type": "string",
27
+ "format": "date"
28
+ },
29
+ "publication_date": {
30
+ "description": "the publication date of the filing/notice that gives details of the alternate registration",
31
+ "type": "string",
32
+ "format": "date"
33
+ },
34
+ "start_date": {
35
+ "description": "date when alternate registration was valid from",
36
+ "type": "string",
37
+ "format": "date"
38
+ },
39
+ "start_date_type": {
40
+ "enum": [
41
+ "at",
42
+ "before",
43
+ "after"
44
+ ]
45
+ },
46
+ "sample_date": {
47
+ "description": "date when alternate registration was sampled",
48
+ "type": "string",
49
+ "format": "date"
50
+ },
51
+ "retrieved_at": {
52
+ "description": "date when alternate registration was retrieved",
53
+ "type": "string",
54
+ "format": "date"
55
+ },
56
+ "source_url": {
57
+ "description": "URL of the source of the data (e.g. download URL), or if there is not persistent URL the page from which it can be found (e.g. search page)",
58
+ "type": "string"
59
+ },
60
+ "confidence": {
61
+ "description": "Confidence in accuracy of data",
62
+ "enum": [
63
+ "HIGH",
64
+ "MEDIUM",
65
+ "LOW"
66
+ ]
67
+ }
68
+ },
69
+ "additionalProperties": false,
70
+ "required": [
71
+ "data_type",
72
+ "alternate_entities",
73
+ "retrieved_at",
74
+ "confidence"
75
+ ],
76
+ "anyOf": [
77
+ {
78
+ "required": [
79
+ "start_date"
80
+ ]
81
+ },
82
+ {
83
+ "required": [
84
+ "sample_date"
85
+ ]
86
+ }
87
+ ]
88
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "description": "Doing Business As, also known as fictitious name or trade name",
4
+ "type": "object",
5
+ "properties": {
6
+ "name": {
7
+ "description": "The name registered",
8
+ "type": "string"
9
+ },
10
+ "type": {
11
+ "description": "Type of alternative name",
12
+ "type": "string",
13
+ "enum": [
14
+ "Assumed Name",
15
+ "Trade Name",
16
+ "DBA / doing business as",
17
+ "Fictitious Name",
18
+ "Other"
19
+ ]
20
+ },
21
+ "registered_address": {
22
+ "description": "The address filing was registered to",
23
+ "type": "object"
24
+ },
25
+ "start_date": {
26
+ "type": "string",
27
+ "format": "date"
28
+ },
29
+ "end_date": {
30
+ "type": "string",
31
+ "format": "date"
32
+ },
33
+ "filing_number": {
34
+ "description": "The registers unique id for this record",
35
+ "type": "string"
36
+ },
37
+ "source_jurisdiction": {
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "source_url": {
42
+ "description": "Place where this fact can be verified",
43
+ "type": "string",
44
+ "minLength": 1
45
+ },
46
+ "confidence": {
47
+ "description": "Confidence in accuracy of data",
48
+ "type": "string",
49
+ "enum": [
50
+ "HIGH",
51
+ "MEDIUM",
52
+ "LOW"
53
+ ]
54
+ },
55
+ "sample_date": {
56
+ "description": "Date on which we know this to be true (usually date this information was retrieved from the source)",
57
+ "type": "string",
58
+ "format": "date"
59
+ },
60
+ "retrieved_at": {
61
+ "description": "The time or date at which the source URL was requested",
62
+ "type": "string",
63
+ "format": "date-time"
64
+ },
65
+ "owner_entities": {
66
+ "description": "Lists of owner companies, and persons should this data be available",
67
+ "type": "object"
68
+ },
69
+ "other_attributes": {
70
+ "description": "Dump of all other relevant data for which we don't yet have curated schema attributes",
71
+ "type": "object"
72
+ }
73
+ },
74
+ "required": [
75
+ "name",
76
+ "type",
77
+ "owner_entities",
78
+ "retrieved_at",
79
+ "sample_date",
80
+ "source_url",
81
+ "source_jurisdiction"
82
+ ]
83
+ }