moxml 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +15 -0
  3. data/.github/workflows/release.yml +23 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +2 -0
  6. data/.rubocop_todo.yml +65 -0
  7. data/.ruby-version +1 -0
  8. data/Gemfile +10 -3
  9. data/README.adoc +401 -594
  10. data/lib/moxml/adapter/base.rb +102 -0
  11. data/lib/moxml/adapter/customized_oga/xml_declaration.rb +18 -0
  12. data/lib/moxml/adapter/customized_oga/xml_generator.rb +104 -0
  13. data/lib/moxml/adapter/nokogiri.rb +319 -0
  14. data/lib/moxml/adapter/oga.rb +318 -0
  15. data/lib/moxml/adapter/ox.rb +325 -0
  16. data/lib/moxml/adapter.rb +26 -170
  17. data/lib/moxml/attribute.rb +47 -14
  18. data/lib/moxml/builder.rb +64 -0
  19. data/lib/moxml/cdata.rb +4 -26
  20. data/lib/moxml/comment.rb +6 -22
  21. data/lib/moxml/config.rb +39 -15
  22. data/lib/moxml/context.rb +29 -0
  23. data/lib/moxml/declaration.rb +16 -26
  24. data/lib/moxml/doctype.rb +9 -0
  25. data/lib/moxml/document.rb +51 -63
  26. data/lib/moxml/document_builder.rb +87 -0
  27. data/lib/moxml/element.rb +63 -97
  28. data/lib/moxml/error.rb +20 -0
  29. data/lib/moxml/namespace.rb +12 -37
  30. data/lib/moxml/node.rb +78 -58
  31. data/lib/moxml/node_set.rb +19 -222
  32. data/lib/moxml/processing_instruction.rb +6 -25
  33. data/lib/moxml/text.rb +4 -26
  34. data/lib/moxml/version.rb +1 -1
  35. data/lib/moxml/xml_utils/encoder.rb +55 -0
  36. data/lib/moxml/xml_utils.rb +80 -0
  37. data/lib/moxml.rb +33 -33
  38. data/moxml.gemspec +1 -1
  39. data/spec/moxml/adapter/nokogiri_spec.rb +14 -0
  40. data/spec/moxml/adapter/oga_spec.rb +14 -0
  41. data/spec/moxml/adapter/ox_spec.rb +49 -0
  42. data/spec/moxml/all_with_adapters_spec.rb +46 -0
  43. data/spec/moxml/config_spec.rb +55 -0
  44. data/spec/moxml/error_spec.rb +71 -0
  45. data/spec/moxml/examples/adapter_spec.rb +27 -0
  46. data/spec/moxml_spec.rb +50 -0
  47. data/spec/spec_helper.rb +32 -0
  48. data/spec/support/shared_examples/attribute.rb +165 -0
  49. data/spec/support/shared_examples/builder.rb +25 -0
  50. data/spec/support/shared_examples/cdata.rb +70 -0
  51. data/spec/support/shared_examples/comment.rb +65 -0
  52. data/spec/support/shared_examples/context.rb +35 -0
  53. data/spec/support/shared_examples/declaration.rb +93 -0
  54. data/spec/support/shared_examples/doctype.rb +25 -0
  55. data/spec/support/shared_examples/document.rb +110 -0
  56. data/spec/support/shared_examples/document_builder.rb +43 -0
  57. data/spec/support/shared_examples/edge_cases.rb +185 -0
  58. data/spec/support/shared_examples/element.rb +130 -0
  59. data/spec/support/shared_examples/examples/attribute.rb +42 -0
  60. data/spec/support/shared_examples/examples/basic_usage.rb +67 -0
  61. data/spec/support/shared_examples/examples/memory.rb +54 -0
  62. data/spec/support/shared_examples/examples/namespace.rb +65 -0
  63. data/spec/support/shared_examples/examples/readme_examples.rb +100 -0
  64. data/spec/support/shared_examples/examples/thread_safety.rb +43 -0
  65. data/spec/support/shared_examples/examples/xpath.rb +39 -0
  66. data/spec/support/shared_examples/integration.rb +135 -0
  67. data/spec/support/shared_examples/namespace.rb +96 -0
  68. data/spec/support/shared_examples/node.rb +110 -0
  69. data/spec/support/shared_examples/node_set.rb +90 -0
  70. data/spec/support/shared_examples/processing_instruction.rb +88 -0
  71. data/spec/support/shared_examples/text.rb +66 -0
  72. data/spec/support/shared_examples/xml_adapter.rb +191 -0
  73. data/spec/support/xml_matchers.rb +27 -0
  74. metadata +55 -6
  75. data/.github/workflows/main.yml +0 -27
  76. data/lib/moxml/error_handler.rb +0 -77
  77. data/lib/moxml/errors.rb +0 -169
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5af0cdcef46537756d906e223504b5d82cf7fd7156918cc6c7b023c5eeab3e2
4
- data.tar.gz: 1775b4f3bdcb0e4bc09a5ab1ca59ce03757ba99e19a60c2a3014aaf21cceb27f
3
+ metadata.gz: 590ee539c3419cf7c36cbd58a031a0939f2e6fc87637509c012292b3d8b09ebd
4
+ data.tar.gz: 5452e3fc378dbff7ab557dfae51553b287dbca33f2ddd07db38728ccf1e01a16
5
5
  SHA512:
6
- metadata.gz: 9380edc8414a43db39ce2d0e1dcb7f6701dfc327270db371ccf1fbbc54dafbc72334d9716c718ba337dda686a86330d324a1484c02c5204fcbdddcca1eafd4fb
7
- data.tar.gz: 7d61a828ed818594306b236890c293c98b4099bd2515ae753fd6c986c8e6965231536912ac5989290773b4bddabda07b84b828bbfb2660fcd0e241107a2a3bdd
6
+ metadata.gz: 95cc452d7d28c352589a036c6a2a2aff8496e020c77b61da797d962a656466ca770480d94288af538fd541eba6b2d031e1d6b3ee9cb8c12b62da471f03258be4
7
+ data.tar.gz: 54dcff1b9875e3344d42a2cdaca136511d163d92b8303785b495a84b0c2dfcb7c9ea3853fc65c0b8a926d9ad0c00651fd0edd02be4d9db8980fd4171c6197418
@@ -0,0 +1,15 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
+ secrets:
15
+ pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
@@ -0,0 +1,23 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ repository_dispatch:
14
+ types: [ do-release ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
19
+ with:
20
+ next_version: ${{ github.event.inputs.next_version }}
21
+ secrets:
22
+ rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
23
+ pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
data/.gitignore CHANGED
@@ -6,6 +6,9 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .byebug_history
10
+ Gemfile.lock
9
11
 
10
12
  # rspec failure tracking
11
13
  .rspec_status
14
+ /spec/examples.txt
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
4
  TargetRubyVersion: 3.0
3
5
 
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,65 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-13 02:38:07 UTC using RuboCop version 1.70.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Lint/IneffectiveAccessModifier:
11
+ Exclude:
12
+ - 'lib/moxml/node.rb'
13
+
14
+ # Offense count: 1
15
+ # Configuration parameters: MaximumRangeSize.
16
+ Lint/MissingCopEnableDirective:
17
+ Exclude:
18
+ - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
19
+
20
+ # Offense count: 1
21
+ # Configuration parameters: AllowedParentClasses.
22
+ Lint/MissingSuper:
23
+ Exclude:
24
+ - 'lib/moxml/adapter/customized_oga/xml_declaration.rb'
25
+
26
+ # Offense count: 5
27
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
28
+ Metrics/AbcSize:
29
+ Max: 30
30
+
31
+ # Offense count: 46
32
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
33
+ # AllowedMethods: refine
34
+ Metrics/BlockLength:
35
+ Max: 152
36
+
37
+ # Offense count: 3
38
+ # Configuration parameters: CountComments, CountAsOne.
39
+ Metrics/ClassLength:
40
+ Max: 246
41
+
42
+ # Offense count: 3
43
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
44
+ Metrics/CyclomaticComplexity:
45
+ Max: 10
46
+
47
+ # Offense count: 9
48
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
49
+ Metrics/MethodLength:
50
+ Max: 20
51
+
52
+ # Offense count: 4
53
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
54
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
55
+ Naming/MethodParameterName:
56
+ Exclude:
57
+ - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
58
+ - 'lib/moxml/adapter/nokogiri.rb'
59
+ - 'lib/moxml/adapter/ox.rb'
60
+ - 'lib/moxml/attribute.rb'
61
+
62
+ # Offense count: 27
63
+ # Configuration parameters: AllowedConstants.
64
+ Style/Documentation:
65
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.7@moxml
data/Gemfile CHANGED
@@ -5,8 +5,15 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in moxml.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
9
-
8
+ gem "byebug"
9
+ gem "get_process_mem", "~> 1.0"
10
+ gem "nokogiri", "~> 1.15"
11
+ gem "oga", "~> 3.4"
12
+ gem "ox", "~> 2.14"
13
+ gem "rake", "~> 13"
10
14
  gem "rspec", "~> 3.0"
11
-
12
15
  gem "rubocop", "~> 1.21"
16
+ gem "tempfile", "~> 0.3"
17
+
18
+ # Needed by get_process_mem on Windows
19
+ gem "sys-proctable" if Gem.win_platform?