aipp 0.2.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -0
- data/CHANGELOG.md +38 -0
- data/README.md +222 -88
- data/exe/aip2aixm +2 -2
- data/exe/aip2ofmx +2 -2
- data/lib/aipp/aip.rb +113 -31
- data/lib/aipp/border.rb +77 -46
- data/lib/aipp/debugger.rb +101 -0
- data/lib/aipp/downloader.rb +39 -26
- data/lib/aipp/executable.rb +41 -22
- data/lib/aipp/parser.rb +94 -21
- data/lib/aipp/patcher.rb +5 -2
- data/lib/aipp/pdf.rb +1 -1
- data/lib/aipp/regions/LF/README.md +49 -0
- data/lib/aipp/regions/LF/aerodromes.rb +223 -0
- data/lib/aipp/regions/LF/d_p_r_airspaces.rb +56 -0
- data/lib/aipp/regions/LF/dangerous_activities.rb +49 -0
- data/lib/aipp/regions/LF/designated_points.rb +47 -0
- data/lib/aipp/regions/LF/fixtures/aerodromes.yml +608 -0
- data/lib/aipp/regions/LF/helipads.rb +122 -0
- data/lib/aipp/regions/LF/helpers/base.rb +218 -0
- data/lib/aipp/regions/LF/helpers/surface.rb +49 -0
- data/lib/aipp/regions/LF/helpers/usage_limitation.rb +20 -0
- data/lib/aipp/regions/LF/navigational_aids.rb +85 -0
- data/lib/aipp/regions/LF/obstacles.rb +153 -0
- data/lib/aipp/regions/LF/serviced_airspaces.rb +70 -0
- data/lib/aipp/regions/LF/services.rb +172 -0
- data/lib/aipp/t_hash.rb +4 -5
- data/lib/aipp/version.rb +1 -1
- data/lib/aipp.rb +11 -5
- data/lib/core_ext/enumerable.rb +9 -9
- data/lib/core_ext/hash.rb +21 -5
- data/lib/core_ext/nokogiri.rb +54 -0
- data/lib/core_ext/string.rb +38 -66
- data.tar.gz.sig +2 -0
- metadata +180 -188
- metadata.gz.sig +0 -0
- data/.gitignore +0 -8
- data/.ruby-version +0 -1
- data/.travis.yml +0 -8
- data/.yardopts +0 -3
- data/Guardfile +0 -7
- data/TODO.md +0 -6
- data/aipp.gemspec +0 -44
- data/gems.rb +0 -3
- data/lib/aipp/airac.rb +0 -55
- data/lib/aipp/regions/LF/AD-1.3.rb +0 -162
- data/lib/aipp/regions/LF/AD-1.6.rb +0 -31
- data/lib/aipp/regions/LF/AD-2.rb +0 -313
- data/lib/aipp/regions/LF/AD-3.1.rb +0 -185
- data/lib/aipp/regions/LF/ENR-2.1.rb +0 -92
- data/lib/aipp/regions/LF/ENR-4.1.rb +0 -97
- data/lib/aipp/regions/LF/ENR-4.3.rb +0 -28
- data/lib/aipp/regions/LF/ENR-5.1.rb +0 -75
- data/lib/aipp/regions/LF/ENR-5.5.rb +0 -53
- data/lib/aipp/regions/LF/fixtures/AD-1.3.yml +0 -511
- data/lib/aipp/regions/LF/fixtures/AD-2.yml +0 -185
- data/lib/aipp/regions/LF/fixtures/AD-3.1.yml +0 -10
- data/lib/aipp/regions/LF/helpers/AD_radio.rb +0 -90
- data/lib/aipp/regions/LF/helpers/URL.rb +0 -26
- data/lib/aipp/regions/LF/helpers/common.rb +0 -217
- data/lib/core_ext/object.rb +0 -43
- data/rakefile.rb +0 -12
- data/spec/fixtures/archive.zip +0 -0
- data/spec/fixtures/border.geojson +0 -201
- data/spec/fixtures/document.pdf +0 -0
- data/spec/fixtures/document.pdf.json +0 -1
- data/spec/fixtures/new.html +0 -6
- data/spec/fixtures/new.pdf +0 -0
- data/spec/fixtures/new.txt +0 -1
- data/spec/lib/aipp/airac_spec.rb +0 -98
- data/spec/lib/aipp/border_spec.rb +0 -135
- data/spec/lib/aipp/downloader_spec.rb +0 -81
- data/spec/lib/aipp/patcher_spec.rb +0 -46
- data/spec/lib/aipp/pdf_spec.rb +0 -124
- data/spec/lib/aipp/t_hash_spec.rb +0 -44
- data/spec/lib/aipp/version_spec.rb +0 -7
- data/spec/lib/core_ext/enumberable_spec.rb +0 -76
- data/spec/lib/core_ext/hash_spec.rb +0 -27
- data/spec/lib/core_ext/integer_spec.rb +0 -15
- data/spec/lib/core_ext/nil_class_spec.rb +0 -11
- data/spec/lib/core_ext/string_spec.rb +0 -112
- data/spec/sounds/failure.mp3 +0 -0
- data/spec/sounds/success.mp3 +0 -0
- data/spec/spec_helper.rb +0 -28
@@ -1,90 +0,0 @@
|
|
1
|
-
module AIPP
|
2
|
-
module LF
|
3
|
-
module Helpers
|
4
|
-
module ADRadio
|
5
|
-
|
6
|
-
# Service types to be ignored
|
7
|
-
IGNORED_TYPES = %w(D-ATIS).freeze
|
8
|
-
|
9
|
-
# Service types to be encoded as addresses
|
10
|
-
ADDRESS_TYPES = %w(A/A A/G).freeze
|
11
|
-
|
12
|
-
# Unknown service types to be encoded as units
|
13
|
-
SERVICE_TYPES = {
|
14
|
-
'CEV' => { type: :other, remarks: "CEV (centre d'essais en vol / flight test center)" },
|
15
|
-
'SRE' => { type: :other, remarks: "SRE (elément radar de surveillance du PAR / surveillance radar element of PAR)" }
|
16
|
-
}.freeze
|
17
|
-
|
18
|
-
def parts_from(tds)
|
19
|
-
{
|
20
|
-
f: AIXM.f(tds[2].css('span').first.text.to_f, tds[2].css('span').last.text),
|
21
|
-
callsign: tds[1].text.strip,
|
22
|
-
timetable: tds[3].text.strip,
|
23
|
-
remarks: tds[4].text.strip.sub(/Canal (8.33|25)/i, '') # TEMP: ignore canal spacing warnings
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
def addresses_from(trs)
|
28
|
-
trs.map do |tr|
|
29
|
-
tds = tr.css('td')
|
30
|
-
type = tds[0].text.strip
|
31
|
-
next if IGNORED_TYPES.include? type
|
32
|
-
f, callsign, _, remarks = parts_from(tds).values
|
33
|
-
if ADDRESS_TYPES.include?(type)
|
34
|
-
AIXM.address(
|
35
|
-
source: source(position: tr.line),
|
36
|
-
type: :radio_frequency,
|
37
|
-
address: f.to_s
|
38
|
-
).tap do |address|
|
39
|
-
address.remarks = ["#{type} - indicatif/callsign #{callsign}", remarks.blank_to_nil].compact.join("\n")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end.compact
|
43
|
-
end
|
44
|
-
|
45
|
-
def units_from(trs)
|
46
|
-
trs.each_with_object({}) do |tr, services|
|
47
|
-
tds = tr.css('td')
|
48
|
-
type = tds[0].text.strip
|
49
|
-
next if IGNORED_TYPES.include?(type) || ADDRESS_TYPES.include?(type)
|
50
|
-
f, callsign, timetable, remarks = parts_from(tds).values
|
51
|
-
if SERVICE_TYPES.include? type
|
52
|
-
type = SERVICE_TYPES.dig(type, :type)
|
53
|
-
remarks = [SERVICE_TYPES.dig(type, :remarks), remarks.blank_to_nil].compact.join("\n")
|
54
|
-
end
|
55
|
-
unless services.include? type
|
56
|
-
services[type] = AIXM.service(
|
57
|
-
source: source(position: tr.line),
|
58
|
-
type: type
|
59
|
-
)
|
60
|
-
end
|
61
|
-
code = $1 if timetable.sub!(/(#{AIXM::H_RE})\b/, '')
|
62
|
-
services[type].add_frequency(
|
63
|
-
AIXM.frequency(
|
64
|
-
transmission_f: f,
|
65
|
-
callsigns: { fr: callsign }
|
66
|
-
).tap do |frequency|
|
67
|
-
frequency.type = :standard
|
68
|
-
frequency.type = :alternative if remarks.sub!(%r{fréquence supplétive/auxiliary frequency\S*}i, '')
|
69
|
-
frequency.timetable = AIXM.timetable(code: code) if code
|
70
|
-
frequency.remarks = [remarks, timetable.blank_to_nil].compact.join("\n").cleanup.blank_to_nil
|
71
|
-
end
|
72
|
-
)
|
73
|
-
end.values.map do |service|
|
74
|
-
AIXM.unit(
|
75
|
-
source: service.source,
|
76
|
-
organisation: organisation_lf, # TODO: not yet implemented
|
77
|
-
type: (type = service.guessed_unit_type),
|
78
|
-
name: "#{@id} #{AIXM::Feature::Unit::TYPES.key(type)}",
|
79
|
-
class: :icao # TODO: verify whether all units are ICAO
|
80
|
-
).tap do |unit|
|
81
|
-
unit.airport = @airport
|
82
|
-
unit.add_service(service)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module AIPP
|
2
|
-
module LF
|
3
|
-
module Helpers
|
4
|
-
module URL
|
5
|
-
|
6
|
-
# @param aip_file [String] e.g. ENR-5.1, AD-2.LFMV or VAC-LFMV
|
7
|
-
def url_for(aip_file)
|
8
|
-
case aip_file
|
9
|
-
when /^VAC\-(\w+)/
|
10
|
-
"https://www.sia.aviation-civile.gouv.fr/dvd/eAIP_%s/Atlas-VAC/PDF_AIPparSSection/VAC/AD/AD-2.%s.pdf" % [
|
11
|
-
options[:airac].date.strftime('%d_%^b_%Y'), # 04_JAN_2018
|
12
|
-
$1
|
13
|
-
]
|
14
|
-
else
|
15
|
-
"https://www.sia.aviation-civile.gouv.fr/dvd/eAIP_%s/FRANCE/AIRAC-%s/html/eAIP/FR-%s-fr-FR.html" % [
|
16
|
-
options[:airac].date.strftime('%d_%^b_%Y'), # 04_JAN_2018
|
17
|
-
options[:airac].date.xmlschema, # 2018-01-04
|
18
|
-
aip_file
|
19
|
-
]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,217 +0,0 @@
|
|
1
|
-
module AIPP
|
2
|
-
module LF
|
3
|
-
module Helpers
|
4
|
-
module Common
|
5
|
-
|
6
|
-
using AIXM::Refinements
|
7
|
-
|
8
|
-
# Map border names to OFMX
|
9
|
-
BORDERS = {
|
10
|
-
'franco-allemande' => 'FRANCE_GERMANY',
|
11
|
-
'franco-espagnole' => 'FRANCE_SPAIN',
|
12
|
-
'franco-italienne' => 'FRANCE_ITALY',
|
13
|
-
'franco-suisse' => 'FRANCE_SWITZERLAND',
|
14
|
-
'franco-luxembourgeoise' => 'FRANCE_LUXEMBOURG',
|
15
|
-
'franco-belge' => 'BELGIUM_FRANCE',
|
16
|
-
'germano-suisse' => 'GERMANY_SWITZERLAND',
|
17
|
-
'hispano-andorrane' => 'ANDORRA_SPAIN',
|
18
|
-
'la côte atlantique française' => 'FRANCE_ATLANTIC_COAST',
|
19
|
-
'côte méditérrannéenne' => 'FRANCE_MEDITERRANEAN_COAST',
|
20
|
-
'limite des eaux territoriales atlantique françaises' => 'FRANCE_ATLANTIC_TERRITORIAL_SEA',
|
21
|
-
'parc national des écrins' => 'FRANCE_ECRINS_NATIONAL_PARK'
|
22
|
-
}.freeze
|
23
|
-
|
24
|
-
# Intersection points between three countries
|
25
|
-
INTERSECTIONS = {
|
26
|
-
'FRANCE_SPAIN|ANDORRA_SPAIN' => AIXM.xy(lat: 42.502720, long: 1.725965),
|
27
|
-
'ANDORRA_SPAIN|FRANCE_SPAIN' => AIXM.xy(lat: 42.603571, long: 1.442681),
|
28
|
-
'FRANCE_SWITZERLAND|FRANCE_ITALY' => AIXM.xy(lat: 45.922701, long: 7.044125),
|
29
|
-
'BELGIUM_FRANCE|FRANCE_LUXEMBOURG' => AIXM.xy(lat: 49.546428, long: 5.818415),
|
30
|
-
'FRANCE_LUXEMBOURG|FRANCE_GERMANY' => AIXM.xy(lat: 49.469438, long: 6.367516),
|
31
|
-
'FRANCE_GERMANY|FRANCE_SWITZERLAND' => AIXM.xy(lat: 47.589831, long: 7.589049),
|
32
|
-
'GERMANY_SWITZERLAND|FRANCE_GERMANY' => AIXM.xy(lat: 47.589831, long: 7.589049)
|
33
|
-
}.freeze
|
34
|
-
|
35
|
-
# Map surface to OFMX composition, preparation and remarks
|
36
|
-
SURFACES = {
|
37
|
-
/^revêtue?$/ => { preparation: :paved },
|
38
|
-
/^non revêtue?$/ => { preparation: :natural },
|
39
|
-
'macadam' => { composition: :macadam },
|
40
|
-
/^bitume ?(traité|psp)?$/ => { composition: :bitumen },
|
41
|
-
'ciment' => { composition: :concrete, preparation: :paved },
|
42
|
-
/^b[eé]ton ?(armé|bitume|bitumineux)?$/ => { composition: :concrete, preparation: :paved },
|
43
|
-
/^béton( de)? ciment$/ => { composition: :concrete, preparation: :paved },
|
44
|
-
'béton herbe' => { composition: :concrete_and_grass },
|
45
|
-
'béton avec résine' => { composition: :concrete, preparation: :paved, remarks: 'Avec résine / with resin' },
|
46
|
-
"béton + asphalte d'étanchéité sablé" => { composition: :concrete_and_asphalt, preparation: :paved, remarks: 'Étanchéité sablé / sandblasted waterproofing' },
|
47
|
-
'béton armé + support bitumastic' => { composition: :concrete, preparation: :paved, remarks: 'Support bitumastic / bitumen support' },
|
48
|
-
/résine (époxy )?su[er] béton/ => { composition: :concrete, preparation: :paved, remarks: 'Avec couche résine / with resin seal coat' },
|
49
|
-
/^(asphalte|tarmac)$/ => { composition: :asphalt, preparation: :paved },
|
50
|
-
'enrobé' => { preparation: :other, remarks: 'Enrobé / coated' },
|
51
|
-
'enrobé anti-kérozène' => { preparation: :other, remarks: 'Enrobé anti-kérozène / anti-kerosene coating' },
|
52
|
-
/^enrobé bitum(e|iné|ineux)$/ => { composition: :bitumen, preparation: :paved, remarks: 'Enrobé / coated' },
|
53
|
-
'enrobé béton' => { composition: :concrete, preparation: :paved, remarks: 'Enrobé / coated' },
|
54
|
-
/^résine( époxy)?$/ => { composition: :other, remarks: 'Résine / resin' },
|
55
|
-
'tole acier larmé' => { composition: :metal, preparation: :grooved },
|
56
|
-
/^(structure métallique|aluminium)$/ => { composition: :metal },
|
57
|
-
'matériaux composites ignifugés' => { composition: :other, remarks: 'Matériaux composites ignifugés / fire resistant mixed materials' },
|
58
|
-
/^(gazon|herbe)$/ => { composition: :grass },
|
59
|
-
'neige' => { composition: :snow },
|
60
|
-
'neige damée' => { composition: :snow, preparation: :rolled }
|
61
|
-
}.freeze
|
62
|
-
|
63
|
-
# Transform French text fragments to English
|
64
|
-
ANGLICISE_MAP = {
|
65
|
-
/[^A-Z0-9 .\-]/ => '',
|
66
|
-
/0(\d)/ => '\1',
|
67
|
-
/(\d)-(\d)/ => '\1.\2',
|
68
|
-
/PARTIE/ => '',
|
69
|
-
/DELEG\./ => 'DELEG ',
|
70
|
-
/FRANCAISE?/ => 'FR',
|
71
|
-
/ANGLAISE?/ => 'UK',
|
72
|
-
/BELGE/ => 'BE',
|
73
|
-
/LUXEMBOURGEOISE?/ => 'LU',
|
74
|
-
/ALLEMANDE?/ => 'DE',
|
75
|
-
/SUISSE/ => 'CH',
|
76
|
-
/ITALIEN(?:NE)?/ => 'IT',
|
77
|
-
/ESPAGNOLE?/ => 'ES',
|
78
|
-
/ANDORRANE?/ => 'AD',
|
79
|
-
/NORD/ => 'N',
|
80
|
-
/EST/ => 'E',
|
81
|
-
/SUD/ => 'S',
|
82
|
-
/OEST/ => 'W',
|
83
|
-
/ANGLO NORMANDES/ => 'ANGLO-NORMANDES',
|
84
|
-
/ +/ => ' '
|
85
|
-
}.freeze
|
86
|
-
|
87
|
-
# Templates
|
88
|
-
|
89
|
-
def organisation_lf
|
90
|
-
@organisation_lf ||= AIXM.organisation(
|
91
|
-
name: 'FRANCE',
|
92
|
-
type: 'S'
|
93
|
-
).tap do |organisation|
|
94
|
-
organisation.id = 'LF'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# Transformations
|
99
|
-
|
100
|
-
def prepare(html:)
|
101
|
-
html.tap do |node|
|
102
|
-
node.css('del, tr[class*="AmdtDeletedAIRAC"]').each(&:remove) # remove deleted entries
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def anglicise(name:)
|
107
|
-
name&.uptrans&.tap do |string|
|
108
|
-
ANGLICISE_MAP.each do |regexp, replacement|
|
109
|
-
string.gsub!(regexp, replacement)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# Parsers
|
115
|
-
|
116
|
-
def source(position:, aip_file: nil)
|
117
|
-
aip_file ||= @aip
|
118
|
-
[
|
119
|
-
options[:region],
|
120
|
-
aip_file.split('-').first,
|
121
|
-
aip_file,
|
122
|
-
options[:airac].date.xmlschema,
|
123
|
-
position
|
124
|
-
].join('|')
|
125
|
-
end
|
126
|
-
|
127
|
-
def xy_from(text)
|
128
|
-
parts = text.strip.split(/\s+/)
|
129
|
-
AIXM.xy(lat: parts[0], long: parts[1])
|
130
|
-
end
|
131
|
-
|
132
|
-
def z_from(limit)
|
133
|
-
case limit
|
134
|
-
when nil then nil
|
135
|
-
when 'SFC' then AIXM::GROUND
|
136
|
-
when 'UNL' then AIXM::UNLIMITED
|
137
|
-
when /(\d+)ftASFC/ then AIXM.z($1.to_i, :qfe)
|
138
|
-
when /(\d+)ftAMSL/ then AIXM.z($1.to_i, :qnh)
|
139
|
-
when /FL(\d+)/ then AIXM.z($1.to_i, :qne)
|
140
|
-
else fail "z `#{limit}' not recognized"
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def elevation_from(text)
|
145
|
-
value, unit = text.strip.split
|
146
|
-
AIXM.z(AIXM.d(value.to_i, unit).to_ft.dist, :qnh)
|
147
|
-
end
|
148
|
-
|
149
|
-
def layer_from(text_for_limits, text_for_class=nil)
|
150
|
-
above, below = text_for_limits.gsub(/ /, '').split(/\n+/).select(&:blank_to_nil).split { |e| e.match? '---+' }
|
151
|
-
AIXM.layer(
|
152
|
-
class: text_for_class,
|
153
|
-
vertical_limits: AIXM.vertical_limits(
|
154
|
-
upper_z: z_from(above[0]),
|
155
|
-
max_z: z_from(above[1]),
|
156
|
-
lower_z: z_from(below[0]),
|
157
|
-
min_z: z_from(below[1])
|
158
|
-
)
|
159
|
-
)
|
160
|
-
end
|
161
|
-
|
162
|
-
def geometry_from(text)
|
163
|
-
AIXM.geometry.tap do |geometry|
|
164
|
-
buffer = {}
|
165
|
-
text.gsub(/\s+/, ' ').strip.split(/ - /).append('end').each do |element|
|
166
|
-
case element
|
167
|
-
when /arc (anti-)?horaire .+ sur (\S+) , (\S+)/i
|
168
|
-
geometry << AIXM.arc(
|
169
|
-
xy: buffer.delete(:xy),
|
170
|
-
center_xy: AIXM.xy(lat: $2, long: $3),
|
171
|
-
clockwise: $1.nil?
|
172
|
-
)
|
173
|
-
when /cercle de ([\d\.]+) (NM|km|m) .+ sur (\S+) , (\S+)/i
|
174
|
-
geometry << AIXM.circle(
|
175
|
-
center_xy: AIXM.xy(lat: $3, long: $4),
|
176
|
-
radius: AIXM.d($1.to_f, $2)
|
177
|
-
)
|
178
|
-
when /end|(\S+) , (\S+)/
|
179
|
-
geometry << AIXM.point(xy: buffer[:xy]) if buffer.has_key?(:xy)
|
180
|
-
buffer[:xy] = AIXM.xy(lat: $1, long: $2) if $1
|
181
|
-
if border = buffer.delete(:border)
|
182
|
-
from = border.nearest(xy: geometry.segments.last.xy)
|
183
|
-
to = border.nearest(xy: buffer[:xy], geometry_index: from.geometry_index)
|
184
|
-
geometry.concat border.segment(from_position: from, to_position: to).map(&:to_point)
|
185
|
-
end
|
186
|
-
when /^frontière ([\w-]+)/i, /^(\D[^(]+)/i
|
187
|
-
border_name = BORDERS.fetch($1.downcase.strip)
|
188
|
-
if borders.has_key? border_name # border from GeoJSON
|
189
|
-
buffer[:border] = borders[border_name]
|
190
|
-
else # named border
|
191
|
-
buffer[:xy] ||= INTERSECTIONS.fetch("#{buffer[:border_name]}|#{border_name}")
|
192
|
-
buffer[:border_name] = border_name
|
193
|
-
if border_name == 'FRANCE_SPAIN' # specify which part of this split border
|
194
|
-
border_name += buffer[:xy].lat < 42.55 ? '_EAST' : '_WEST'
|
195
|
-
end
|
196
|
-
geometry << AIXM.border(
|
197
|
-
xy: buffer.delete(:xy),
|
198
|
-
name: border_name
|
199
|
-
)
|
200
|
-
end
|
201
|
-
else
|
202
|
-
fail "geometry `#{element}' not recognized"
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
def timetable_from!(text)
|
209
|
-
if text.gsub!(/^\s*#{AIXM::H_RE}\s*$/, '')
|
210
|
-
AIXM.timetable(code: Regexp.last_match&.to_s&.strip)
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
data/lib/core_ext/object.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
|
3
|
-
# Issue a warning and maybe open a Pry session attached to the error or
|
4
|
-
# binding passed.
|
5
|
-
#
|
6
|
-
# @example with error context
|
7
|
-
# begin
|
8
|
-
# (...)
|
9
|
-
# rescue => error
|
10
|
-
# warn("oops", pry: error)
|
11
|
-
# end
|
12
|
-
# @example with binding context
|
13
|
-
# warn("oops", pry: binding)
|
14
|
-
#
|
15
|
-
# @param message [String] warning message
|
16
|
-
# @param pry [Exception, Binding, nil] attach the Pry session to this error
|
17
|
-
# or binding
|
18
|
-
def warn(message, pry:)
|
19
|
-
$WARN_COUNTER = $WARN_COUNTER.to_i + 1
|
20
|
-
Kernel.warn "WARNING #{$WARN_COUNTER}: #{message}".red
|
21
|
-
if $PRY_ON_WARN == true || $PRY_ON_WARN == $WARN_COUNTER
|
22
|
-
case pry
|
23
|
-
when Exception then Pry::rescued(pry)
|
24
|
-
when Binding then pry.pry
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Issue an informational message.
|
30
|
-
#
|
31
|
-
# @param message [String] informational message
|
32
|
-
def info(message, color: :black)
|
33
|
-
puts message.send(color)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Issue a verbose informational message.
|
37
|
-
#
|
38
|
-
# @param message [String] verbose informational message
|
39
|
-
def verbose_info(message, color: :blue)
|
40
|
-
info(message, color: color) if $VERBOSE_INFO
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
data/rakefile.rb
DELETED
data/spec/fixtures/archive.zip
DELETED
Binary file
|
@@ -1,201 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "GeometryCollection",
|
3
|
-
"geometries": [
|
4
|
-
{
|
5
|
-
"type": "LineString",
|
6
|
-
"coordinates": [
|
7
|
-
[
|
8
|
-
4.757294654846191,
|
9
|
-
43.989202079482276
|
10
|
-
],
|
11
|
-
[
|
12
|
-
4.764375686645508,
|
13
|
-
43.99701327763528
|
14
|
-
],
|
15
|
-
[
|
16
|
-
4.7519731521606445,
|
17
|
-
44.00269350325321
|
18
|
-
],
|
19
|
-
[
|
20
|
-
4.745192527770996,
|
21
|
-
43.99506829280446
|
22
|
-
],
|
23
|
-
[
|
24
|
-
4.751286506652832,
|
25
|
-
43.99235138187902
|
26
|
-
],
|
27
|
-
[
|
28
|
-
4.750943183898926,
|
29
|
-
43.99198088438825
|
30
|
-
],
|
31
|
-
[
|
32
|
-
4.757294654846191,
|
33
|
-
43.989202079482276
|
34
|
-
]
|
35
|
-
]
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"type": "LineString",
|
39
|
-
"coordinates": [
|
40
|
-
[
|
41
|
-
4.777421951293944,
|
42
|
-
44.00115001749186
|
43
|
-
],
|
44
|
-
[
|
45
|
-
4.78205680847168,
|
46
|
-
43.994111213373934
|
47
|
-
],
|
48
|
-
[
|
49
|
-
4.784030914306641,
|
50
|
-
43.99818641226534
|
51
|
-
],
|
52
|
-
[
|
53
|
-
4.787635803222656,
|
54
|
-
44.00077957493397
|
55
|
-
],
|
56
|
-
[
|
57
|
-
4.785747528076171,
|
58
|
-
44.00448389642906
|
59
|
-
],
|
60
|
-
[
|
61
|
-
4.790983200073242,
|
62
|
-
44.004669106432225
|
63
|
-
],
|
64
|
-
[
|
65
|
-
4.798364639282227,
|
66
|
-
44.008373185063874
|
67
|
-
],
|
68
|
-
[
|
69
|
-
4.793901443481445,
|
70
|
-
44.01528684632061
|
71
|
-
],
|
72
|
-
[
|
73
|
-
4.787378311157227,
|
74
|
-
44.01584237340163
|
75
|
-
],
|
76
|
-
[
|
77
|
-
4.785575866699219,
|
78
|
-
44.01960747533136
|
79
|
-
],
|
80
|
-
[
|
81
|
-
4.768667221069335,
|
82
|
-
44.01831131968508
|
83
|
-
],
|
84
|
-
[
|
85
|
-
4.763689041137695,
|
86
|
-
44.01460786170962
|
87
|
-
],
|
88
|
-
[
|
89
|
-
4.760427474975586,
|
90
|
-
44.01065725159039
|
91
|
-
],
|
92
|
-
[
|
93
|
-
4.770212173461914,
|
94
|
-
44.002940457248556
|
95
|
-
],
|
96
|
-
[
|
97
|
-
4.777421951293944,
|
98
|
-
44.00115001749186
|
99
|
-
]
|
100
|
-
]
|
101
|
-
},
|
102
|
-
{
|
103
|
-
"type": "LineString",
|
104
|
-
"coordinates": [
|
105
|
-
[
|
106
|
-
4.752960205078125,
|
107
|
-
43.93721446391471
|
108
|
-
],
|
109
|
-
[
|
110
|
-
4.744377136230469,
|
111
|
-
43.950068873803815
|
112
|
-
],
|
113
|
-
[
|
114
|
-
4.737510681152343,
|
115
|
-
43.97033364196856
|
116
|
-
],
|
117
|
-
[
|
118
|
-
4.7344207763671875,
|
119
|
-
43.98713332912919
|
120
|
-
],
|
121
|
-
[
|
122
|
-
4.7371673583984375,
|
123
|
-
44.00516299694704
|
124
|
-
],
|
125
|
-
[
|
126
|
-
4.743347167968749,
|
127
|
-
44.02195282780904
|
128
|
-
],
|
129
|
-
[
|
130
|
-
4.749870300292969,
|
131
|
-
44.037503870182896
|
132
|
-
],
|
133
|
-
[
|
134
|
-
4.755706787109375,
|
135
|
-
44.05379106204314
|
136
|
-
],
|
137
|
-
[
|
138
|
-
4.7646331787109375,
|
139
|
-
44.070073775703484
|
140
|
-
]
|
141
|
-
]
|
142
|
-
},
|
143
|
-
{
|
144
|
-
"type": "LineString",
|
145
|
-
"coordinates": [
|
146
|
-
[
|
147
|
-
4.7948455810546875,
|
148
|
-
43.95328204198018
|
149
|
-
],
|
150
|
-
[
|
151
|
-
4.801368713378906,
|
152
|
-
43.956989327857265
|
153
|
-
],
|
154
|
-
[
|
155
|
-
4.815788269042969,
|
156
|
-
43.9646503190861
|
157
|
-
],
|
158
|
-
[
|
159
|
-
4.82025146484375,
|
160
|
-
43.98614524381678
|
161
|
-
],
|
162
|
-
[
|
163
|
-
4.840850830078125,
|
164
|
-
43.98491011404692
|
165
|
-
],
|
166
|
-
[
|
167
|
-
4.845314025878906,
|
168
|
-
43.99479043262446
|
169
|
-
],
|
170
|
-
[
|
171
|
-
4.8538970947265625,
|
172
|
-
43.98367495857784
|
173
|
-
],
|
174
|
-
[
|
175
|
-
4.851493835449218,
|
176
|
-
43.967121395851485
|
177
|
-
],
|
178
|
-
[
|
179
|
-
4.8442840576171875,
|
180
|
-
43.96069638244953
|
181
|
-
],
|
182
|
-
[
|
183
|
-
4.829521179199219,
|
184
|
-
43.96069638244953
|
185
|
-
],
|
186
|
-
[
|
187
|
-
4.819221496582031,
|
188
|
-
43.95501213750488
|
189
|
-
],
|
190
|
-
[
|
191
|
-
4.805145263671875,
|
192
|
-
43.955506441260546
|
193
|
-
],
|
194
|
-
[
|
195
|
-
4.799995422363281,
|
196
|
-
43.952046228624724
|
197
|
-
]
|
198
|
-
]
|
199
|
-
}
|
200
|
-
]
|
201
|
-
}
|
data/spec/fixtures/document.pdf
DELETED
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
["page 1, line 1\npage 1, line 2\npage 1, line 3\npage 1, line 4\npage 1, line 5\fpage 2, line 1\npage 2, line 2\npage 2, line 3\npage 2, line 4\npage 2, line 5\fpage 3, line 1\npage 3, line 2\npage 3, line 3\npage 3, line 4\npage 3, line 5",[74,149,225]]
|
data/spec/fixtures/new.html
DELETED
data/spec/fixtures/new.pdf
DELETED
Binary file
|
data/spec/fixtures/new.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
fixture-txt-new
|