aixm 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fa3066c9e65afaa76e4327da9a11a42c27f1baad1a712de3fee6400765c0b6a
4
- data.tar.gz: 6c0d4261d076fddc05b150b5c1851a61ffa011ff6b8f15f254492987e4f80fb4
3
+ metadata.gz: 49f4c417f17321e81579c5ec2f63e94e95e3e5b466def5304051e508aac0db04
4
+ data.tar.gz: 78dcbe01cde6c2eac9bf49ed2f8828a96f1ea112393e2730e2e2a902177ee0b3
5
5
  SHA512:
6
- metadata.gz: 88bcefbea10f86f6f5b3c483f546197409dcd06b8751b8f0ced1d2e3730e27559a248486015a0673685d24afb04f306df4ea0acf3f14fe5347c3c9f89d72e23c
7
- data.tar.gz: 067ee1c2ffc6b251a9063982ee4e5d07492746aa0d780be020b46f549868992397348054c09d08704bb5e4744a0a78da8936ee739870822029a8eb32776c10c0
6
+ metadata.gz: f6901fd3474f200ef670161e5377c550c882e9adbc24fd34c3a790b6ca7c44157f5509ee737c85ad10187ce93acaba7b81635e385b461944f5cbf29436f522f5
7
+ data.tar.gz: 9a204bb3611c4405252dfff814ab5d10f628b85936067ccf10358786446ad719c25753cb1a9d8aafb26540311034e6c6c30994cad96fe44a73807ce847fe14ef
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Nothing so far
4
4
 
5
+ ## 1.3.3
6
+
7
+ #### Changes
8
+ * Extend `ckmid` and `mkmid` to accept multiple files and globbing.
9
+
5
10
  ## 1.3.2
6
11
 
7
12
  #### Changes
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Version](https://img.shields.io/gem/v/aixm.svg?style=flat)](https://rubygems.org/gems/aixm)
2
- [![Tests](https://img.shields.io/github/workflow/status/svoop/aixm/Test.svg?style=flat&label=tests)](https://github.com/svoop/aixm/actions?workflow=Test)
2
+ [![Tests](https://img.shields.io/github/actions/workflow/status/svoop/aixm/test.yml?style=flat&label=tests)](https://github.com/svoop/aixm/actions?workflow=Test)
3
3
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/svoop/aixm.svg?style=flat)](https://codeclimate.com/github/svoop/aixm/)
4
4
  [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](https://donorbox.org/bitcetera)
5
5
 
@@ -291,7 +291,7 @@ By `using AIXM::Refinements` you get a few handy [extensions to Ruby core classe
291
291
 
292
292
  ### mkmid
293
293
 
294
- The `mkmid` executable reads an OFMX file, adds [OFMX-compliant `mid` values](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid) into all `*Uid` elements and validates the result against the schema.
294
+ The `mkmid` executable reads OFMX files, adds [OFMX-compliant `mid` values](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid) into all `*Uid` elements and validates the result against the schema.
295
295
 
296
296
  ```
297
297
  mkmid --help
@@ -299,7 +299,7 @@ mkmid --help
299
299
 
300
300
  ### ckmid
301
301
 
302
- The `chmid` executable reads an OFMX file, validates it against the schema and checks all `mid` attributes for [OFMX-compliance](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid).
302
+ The `chmid` executable reads OFMX files, validates them against the schema and checks all `mid` attributes for [OFMX-compliance](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid).
303
303
 
304
304
  ```
305
305
  ckmid --help
@@ -8,36 +8,37 @@ module AIXM
8
8
  @options = options
9
9
  OptionParser.new do |o|
10
10
  o.banner = <<~END
11
- Add mid attributes to a schema valid OFMX file.
12
- Usage: #{File.basename($0)} infile.ofmx
11
+ Add mid attributes to OFMX files.
12
+ Usage: #{File.basename($0)} files
13
13
  END
14
14
  o.on('-i', '--[no-]in-place', 'overwrite file instead of dumping to STDOUT (default: false)') { @options[:in_place] = _1 }
15
15
  o.on('-f', '--[no-]force', 'ignore XML schema validation errors (default: false)') { @options[:force] = _1 }
16
16
  o.on('-A', '--about', 'show author/license information and exit') { AIXM::Executables.about }
17
17
  o.on('-V', '--version', 'show version and exit') { AIXM::Executables.version }
18
18
  end.parse!
19
- @infile = ARGV.shift
19
+ @files = ARGV
20
20
  end
21
21
 
22
22
  def run
23
- fail 'cannot read file' unless @infile && File.readable?(@infile)
24
- fail 'file ist not OFMX' unless @infile.match?(/\.ofmx$/)
25
- AIXM.ofmx!
26
- document = File.open(@infile) { Nokogiri::XML(_1) }
27
- AIXM::PayloadHash::Mid.new(document).insert_mid
28
- errors = Nokogiri::XML::Schema(File.open(AIXM.schema(:xsd))).validate(document)
29
- case
30
- when errors.any? && !@options[:force]
31
- puts errors
32
- fail "OFMX file is not schema valid"
33
- when @options[:in_place]
34
- File.write(@infile, document.to_xml)
35
- else
36
- puts document.to_xml
23
+ @files.each do |file|
24
+ fail "cannot read #{file}" unless file && File.readable?(file)
25
+ fail "#{file} is not OFMX" unless file.match?(/\.ofmx$/)
26
+ AIXM.ofmx!
27
+ document = File.open(file) { Nokogiri::XML(_1) }
28
+ AIXM::PayloadHash::Mid.new(document).insert_mid
29
+ errors = Nokogiri::XML::Schema(File.open(AIXM.schema(:xsd))).validate(document)
30
+ case
31
+ when errors.any? && !@options[:force]
32
+ fail (["#{file} is not valid..."] + errors).join("\n")
33
+ when @options[:in_place]
34
+ File.write(file, document.to_xml)
35
+ else
36
+ puts document.to_xml
37
+ end
38
+ rescue => error
39
+ puts "ERROR: #{error.message}"
40
+ exit 1
37
41
  end
38
- rescue => error
39
- puts "ERROR: #{error.message}"
40
- exit 1
41
42
  end
42
43
  end
43
44
 
@@ -45,29 +46,31 @@ module AIXM
45
46
  def initialize(**options)
46
47
  OptionParser.new do |o|
47
48
  o.banner = <<~END
48
- Check mid attributes of an OFMX file.
49
- Usage: #{File.basename($0)} infile.ofmx
49
+ Check mid attributes of OFMX files.
50
+ Usage: #{File.basename($0)} files
50
51
  END
51
52
  o.on('-A', '--about', 'show author/license information and exit') { AIXM::Executables.about }
52
53
  o.on('-V', '--version', 'show version and exit') { AIXM::Executables.version }
53
54
  end.parse!
54
- @infile = ARGV.shift
55
+ @files = ARGV
55
56
  end
56
57
 
57
58
  def run
58
- fail 'cannot read file' unless @infile && File.readable?(@infile)
59
- fail 'file ist not OFMX' unless @infile.match?(/\.ofmx$/)
60
- AIXM.ofmx!
61
- document = File.open(@infile) { Nokogiri::XML(_1) }
62
- errors = Nokogiri::XML::Schema(File.open(AIXM.schema(:xsd))).validate(document)
63
- errors += AIXM::PayloadHash::Mid.new(document).check_mid
64
- if errors.any?
65
- puts errors
66
- fail "OFMX file has errors"
67
- end
68
- rescue => error
69
- puts "ERROR: #{error.message}"
70
- exit 1
59
+ exit(
60
+ @files.reduce(true) do |success, file|
61
+ fail "cannot read #{file}" unless file && File.readable?(file)
62
+ fail "#{file} is not OFMX" unless file.match?(/\.ofmx$/)
63
+ AIXM.ofmx!
64
+ document = File.open(file) { Nokogiri::XML(_1) }
65
+ errors = Nokogiri::XML::Schema(File.open(AIXM.schema(:xsd))).validate(document)
66
+ errors += AIXM::PayloadHash::Mid.new(document).check_mid
67
+ fail (["#{file} is not valid..."] + errors).join("\n") if errors.any?
68
+ success && true
69
+ rescue RuntimeError => error
70
+ puts "ERROR: #{error.message}"
71
+ false
72
+ end
73
+ )
71
74
  end
72
75
  end
73
76
 
data/lib/aixm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AIXM
2
- VERSION = "1.3.2".freeze
2
+ VERSION = "1.3.3".freeze
3
3
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aixm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -29,7 +29,7 @@ cert_chain:
29
29
  kAyiRqgxF4dJviwtqI7mZIomWL63+kXLgjOjMe1SHxfIPo/0ji6+r1p4KYa7o41v
30
30
  fwIwU1MKlFBdsjkd
31
31
  -----END CERTIFICATE-----
32
- date: 2022-11-18 00:00:00.000000000 Z
32
+ date: 2023-01-05 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: nokogiri
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
312
  - !ruby/object:Gem::Version
313
313
  version: '0'
314
314
  requirements: []
315
- rubygems_version: 3.3.26
315
+ rubygems_version: 3.4.2
316
316
  signing_key:
317
317
  specification_version: 4
318
318
  summary: Builder for AIXM/OFMX aeronautical information
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- sc�8����\~а�
2
- V�%���=�4
1
+ ���Yw�����c� +˥wZ�I9��~T������%�+-��uF0���V������ �
2
+ ��\��% {����5�&x��vy����٤R?J$�O�/� 9�?��IC��D��:H�o�@q"��E��YC��̅;\^�7�XZD2�_O�����Ĝ;.{���:�.�u��n�ۛw�$7��v�o�{���.�?C�O]� ��