eac_tools 0.37.2 → 0.38.0

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +55 -48
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/aranha-parsers/Gemfile +8 -0
  5. data/sub/aranha-parsers/aranha-parsers.gemspec +25 -0
  6. data/sub/aranha-parsers/lib/aranha/parsers/base.rb +81 -0
  7. data/sub/aranha-parsers/lib/aranha/parsers/html/base.rb +47 -0
  8. data/sub/aranha-parsers/lib/aranha/parsers/html/item.rb +24 -0
  9. data/sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb +33 -0
  10. data/sub/aranha-parsers/lib/aranha/parsers/html/node/base.rb +34 -0
  11. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default/numeric_support.rb +70 -0
  12. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default/string_support.rb +77 -0
  13. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default.rb +34 -0
  14. data/sub/aranha-parsers/lib/aranha/parsers/html/node.rb +13 -0
  15. data/sub/aranha-parsers/lib/aranha/parsers/html.rb +11 -0
  16. data/sub/aranha-parsers/lib/aranha/parsers/invalid_state_exception.rb +8 -0
  17. data/sub/aranha-parsers/lib/aranha/parsers/json/base.rb +20 -0
  18. data/sub/aranha-parsers/lib/aranha/parsers/json.rb +11 -0
  19. data/sub/aranha-parsers/lib/aranha/parsers/patches/ofx_parser.rb +38 -0
  20. data/sub/aranha-parsers/lib/aranha/parsers/patches.rb +11 -0
  21. data/sub/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +15 -0
  22. data/sub/aranha-parsers/lib/aranha/parsers/rspec/shared_examples/source_target_fixtures.rb +74 -0
  23. data/sub/aranha-parsers/lib/aranha/parsers/rspec/source_target_fixtures_controller.rb +39 -0
  24. data/sub/aranha-parsers/lib/aranha/parsers/rspec.rb +11 -0
  25. data/sub/aranha-parsers/lib/aranha/parsers/source_address/fetch_content_error.rb +10 -0
  26. data/sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb +31 -0
  27. data/sub/aranha-parsers/lib/aranha/parsers/source_address/hash_http_base.rb +92 -0
  28. data/sub/aranha-parsers/lib/aranha/parsers/source_address/hash_http_get.rb +13 -0
  29. data/sub/aranha-parsers/lib/aranha/parsers/source_address/hash_http_post.rb +13 -0
  30. data/sub/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +59 -0
  31. data/sub/aranha-parsers/lib/aranha/parsers/source_address.rb +57 -0
  32. data/sub/aranha-parsers/lib/aranha/parsers/source_target_fixtures/source_target_file.rb +19 -0
  33. data/sub/aranha-parsers/lib/aranha/parsers/source_target_fixtures.rb +78 -0
  34. data/sub/aranha-parsers/lib/aranha/parsers/version.rb +7 -0
  35. data/sub/aranha-parsers/lib/aranha/parsers.rb +9 -0
  36. data/sub/aranha-parsers/spec/lib/aranha/parsers/rspec/shared_examples/source_target_fixtures_spec.rb +9 -0
  37. data/sub/aranha-parsers/spec/lib/aranha/parsers/rspec/shared_examples/source_target_fixtures_spec_files/fixture1.source.txt +1 -0
  38. data/sub/aranha-parsers/spec/lib/aranha/parsers/rspec/shared_examples/source_target_fixtures_spec_files/fixture1.target.yaml +3 -0
  39. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_address/http_get_spec.rb +21 -0
  40. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_address_spec.rb +74 -0
  41. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec.rb +27 -0
  42. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub1.source.txt +1 -0
  43. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub1.target.html +1 -0
  44. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub2.source.html +1 -0
  45. data/sub/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub3.target.yaml +1 -0
  46. data/sub/aranha-parsers/spec/lib/rubocop_check_spec.rb +3 -0
  47. data/sub/aranha-parsers/spec/spec_helper.rb +4 -0
  48. data/sub/avm/avm.gemspec +2 -0
  49. data/sub/avm/lib/avm/executables.rb +1 -1
  50. data/sub/avm/lib/avm/file_formats/base.rb +2 -1
  51. data/sub/{avm-files/lib/avm/files/formatter.rb → avm/lib/avm/file_formats/search_formatter.rb} +17 -11
  52. data/sub/avm/lib/avm/file_formats/utf8_assert.rb +72 -0
  53. data/sub/avm/lib/avm/rspec/setup.rb +2 -1
  54. data/sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb +32 -0
  55. data/sub/avm/lib/avm/version.rb +1 -1
  56. data/sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec +1 -1
  57. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base.rb +2 -2
  58. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
  59. data/sub/avm-eac_generic_base0/spec/lib/avm/eac_generic_base0/file_formats/base_spec.rb +7 -0
  60. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_generic_base0/spec/lib/avm/eac_generic_base0/file_formats/base_spec_files}/plain_text.source +0 -0
  61. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_generic_base0/spec/lib/avm/eac_generic_base0/file_formats/base_spec_files}/plain_text.target +0 -0
  62. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +3 -3
  63. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/executables.rb +22 -0
  64. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +3 -1
  65. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +1 -1
  66. data/sub/avm-eac_php_base0/avm-eac_php_base0.gemspec +2 -2
  67. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/executables.rb +22 -0
  68. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/file_formats/base.rb +2 -2
  69. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/version.rb +1 -1
  70. data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec.rb +7 -0
  71. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_code.php.source +0 -0
  72. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_code.php.target +0 -0
  73. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_code2.php.source +0 -0
  74. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_code2.php.target +0 -0
  75. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_html_code.php.source +0 -0
  76. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_html_code.php.target +0 -0
  77. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_iso88591_code.php.source +0 -0
  78. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files}/php_iso88591_code.php.target +0 -0
  79. data/sub/avm-eac_python_base0/avm-eac_python_base0.gemspec +2 -2
  80. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/executables.rb +22 -0
  81. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/file_formats/base.rb +2 -2
  82. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/version.rb +1 -1
  83. data/sub/avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec.rb +7 -0
  84. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files}/python_code.source +0 -0
  85. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_python_base0/spec/lib/avm/eac_python_base0/file_formats/base_spec_files}/python_code.target +0 -0
  86. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +3 -3
  87. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  88. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec.rb +7 -0
  89. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec_files}/Gemfile.source +0 -0
  90. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec_files}/Gemfile.target +0 -0
  91. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec_files}/ruby_code.rb.source +0 -0
  92. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec_files}/ruby_code.rb.target +0 -0
  93. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +3 -3
  94. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/executables.rb +26 -0
  95. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/css/file_apply.rb +48 -0
  96. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/css.rb +22 -0
  97. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/javascript.rb +2 -2
  98. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/provider.rb +2 -1
  99. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/file_formats/xml.rb +2 -2
  100. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  101. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec.rb +7 -0
  102. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec_files/css1.source.css +11 -0
  103. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/css_spec_files/css1.target.css +11 -0
  104. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec.rb +7 -0
  105. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files}/html_code.html.erb.source +0 -0
  106. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files}/html_code.html.erb.target +0 -0
  107. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files}/html_code.html.source +0 -0
  108. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/html_spec_files}/html_code.html.target +0 -0
  109. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec.rb +7 -0
  110. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec_files}/javascript_code1.js.source +0 -0
  111. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/javascript_spec_files}/javascript_code1.js.target +0 -0
  112. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec.rb +7 -0
  113. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec_files}/json_code.json.source +0 -0
  114. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/json_spec_files}/json_code.json.target +0 -0
  115. data/sub/avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec.rb +7 -0
  116. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec_files}/xml_code.xml.source +0 -0
  117. data/sub/{avm-tools/spec/lib/avm/tools/runner/files/format_spec_files → avm-eac_webapp_base0/spec/lib/avm/eac_webapp_base0/file_formats/xml_spec_files}/xml_code.xml.target +0 -0
  118. data/sub/avm-files/avm-files.gemspec +2 -2
  119. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  120. data/sub/avm-tools/avm-tools.gemspec +4 -7
  121. data/sub/avm-tools/lib/avm/tools/runner/files/format.rb +5 -5
  122. data/sub/avm-tools/lib/avm/tools/runner/git/auto_commit.rb +4 -2
  123. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  124. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_bool.rb +12 -0
  125. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  126. metadata +113 -51
  127. data/sub/avm-files/lib/avm/files/formatter/utf8_assert.rb +0 -74
  128. data/sub/avm-tools/spec/lib/avm/tools/runner/files/format_spec.rb +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adddd8b71bf6e7fea8707749d003c2b70c48a9788a89203936cc2caf44577d21
4
- data.tar.gz: 33e2a116d3f440f20a6dcdb1472d11ed1b62225c2d5c83e670d675cb707b3e22
3
+ metadata.gz: 177dcaeff3e81307599207d1fdd3a52e8e88c3461e08a5e4c8319b1a354bd3d5
4
+ data.tar.gz: 6c3fad0d63f50e97c7cc0fffcc7384c66e6066743874916acd5997237c8b6142
5
5
  SHA512:
6
- metadata.gz: 81a7b7abf41d216ddcf599907100e128be48f1a45af08d16501ba842f6eb083f17c8dc8b35ee022b6708d840f6a3189e1604afbe816c0192d43a439cbe7819ee
7
- data.tar.gz: 292a5afc0448b0010973a90a9ab8a7e92e932d1475368e2c11130bad74046c7961639f9a56d00b9a41b675b098b5850cdef351678aa880b8d611459c2dd22043
6
+ metadata.gz: e5628867398318c613bd94c4da4dff8e069553ec4bab91b8dfefacd137bf74ed4294047b31455247f4187b39b45b23d898cb318cfca269f03a3c6dcd6458194c
7
+ data.tar.gz: 4f97c29c0ff189dd0ddc6dbc29d20c4b665d57a6bdc677a98a651427d1ee758fa275c8f29d931f466d6ff981f36ee5f075cf300a45d9486dda125c70f8c5b5f1
data/Gemfile.lock CHANGED
@@ -1,21 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.37.2)
5
- avm (~> 0.51)
4
+ eac_tools (0.38.0)
5
+ avm (~> 0.52)
6
6
  avm-eac_asciidoctor_base0 (~> 0.7, >= 0.7.1)
7
- avm-eac_generic_base0 (~> 0.6)
8
- avm-eac_latex_base0 (~> 0.2, >= 0.2.1)
9
- avm-eac_php_base0 (~> 0.2)
7
+ avm-eac_generic_base0 (~> 0.7)
8
+ avm-eac_latex_base0 (~> 0.3)
9
+ avm-eac_php_base0 (~> 0.3)
10
10
  avm-eac_rails_base0 (~> 0.8, >= 0.8.1)
11
11
  avm-eac_rails_base1 (~> 0.7)
12
12
  avm-eac_redmine_base0 (~> 0.16)
13
13
  avm-eac_redmine_plugin_base0 (~> 0.3)
14
- avm-eac_ruby_base1 (~> 0.26)
15
- avm-eac_webapp_base0 (~> 0.11)
14
+ avm-eac_ruby_base1 (~> 0.26, >= 0.26.1)
15
+ avm-eac_webapp_base0 (~> 0.12)
16
16
  avm-eac_wordpress_base0 (~> 0.2, >= 0.2.1)
17
- avm-tools (~> 0.142, >= 0.142.2)
18
- eac_ruby_utils (~> 0.105)
17
+ avm-tools (~> 0.142, >= 0.142.3)
18
+ eac_ruby_utils (~> 0.106)
19
+
20
+ PATH
21
+ remote: sub/aranha-parsers
22
+ specs:
23
+ aranha-parsers (0.14.4)
24
+ activesupport (>= 4.0.0)
25
+ addressable (~> 2.8, >= 2.8.1)
26
+ curb (~> 0.9, >= 0.9.11)
27
+ eac_ruby_utils (~> 0.106)
28
+ faraday-gzip (~> 0.1)
29
+ faraday_middleware (~> 1.2)
30
+ nokogiri (~> 1.13, >= 1.13.9)
31
+ ofx-parser (~> 1.1)
19
32
 
20
33
  PATH
21
34
  remote: sub/avm-eac_asciidoctor_base0
@@ -30,31 +43,31 @@ PATH
30
43
  PATH
31
44
  remote: sub/avm-eac_generic_base0
32
45
  specs:
33
- avm-eac_generic_base0 (0.6.0)
34
- avm (~> 0.51)
46
+ avm-eac_generic_base0 (0.7.0)
47
+ avm (~> 0.52)
35
48
  eac_ruby_utils (~> 0.105)
36
49
 
37
50
  PATH
38
51
  remote: sub/avm-eac_latex_base0
39
52
  specs:
40
- avm-eac_latex_base0 (0.2.1)
41
- avm (~> 0.45)
42
- avm-eac_webapp_base0 (~> 0.9)
43
- eac_ruby_utils (~> 0.104)
53
+ avm-eac_latex_base0 (0.3.0)
54
+ avm (~> 0.52)
55
+ avm-eac_webapp_base0 (~> 0.12)
56
+ eac_ruby_utils (~> 0.106)
44
57
 
45
58
  PATH
46
59
  remote: sub/avm-eac_php_base0
47
60
  specs:
48
- avm-eac_php_base0 (0.2.0)
49
- avm-eac_generic_base0 (~> 0.6)
50
- eac_ruby_utils (~> 0.105)
61
+ avm-eac_php_base0 (0.3.0)
62
+ avm-eac_generic_base0 (~> 0.7)
63
+ eac_ruby_utils (~> 0.106)
51
64
 
52
65
  PATH
53
66
  remote: sub/avm-eac_python_base0
54
67
  specs:
55
- avm-eac_python_base0 (0.1.0)
56
- avm-eac_generic_base0 (~> 0.6)
57
- eac_ruby_utils (~> 0.105)
68
+ avm-eac_python_base0 (0.2.0)
69
+ avm-eac_generic_base0 (~> 0.7)
70
+ eac_ruby_utils (~> 0.106)
58
71
 
59
72
  PATH
60
73
  remote: sub/avm-eac_rails_base0
@@ -95,20 +108,20 @@ PATH
95
108
  PATH
96
109
  remote: sub/avm-eac_ruby_base1
97
110
  specs:
98
- avm-eac_ruby_base1 (0.26.0)
99
- avm (~> 0.51)
100
- avm-eac_generic_base0 (~> 0.6)
101
- eac_ruby_utils (~> 0.105)
111
+ avm-eac_ruby_base1 (0.26.1)
112
+ avm (~> 0.52)
113
+ avm-eac_generic_base0 (~> 0.7)
114
+ eac_ruby_utils (~> 0.106)
102
115
 
103
116
  PATH
104
117
  remote: sub/avm-eac_webapp_base0
105
118
  specs:
106
- avm-eac_webapp_base0 (0.11.0)
107
- avm (~> 0.51)
108
- avm-eac_generic_base0 (~> 0.6)
119
+ avm-eac_webapp_base0 (0.12.0)
120
+ avm (~> 0.52)
121
+ avm-eac_generic_base0 (~> 0.7)
109
122
  avm-eac_postgresql_base0 (~> 0.2)
110
123
  avm-eac_ubuntu_base0 (~> 0.3)
111
- eac_ruby_utils (~> 0.105)
124
+ eac_ruby_utils (~> 0.106)
112
125
 
113
126
  PATH
114
127
  remote: sub/avm-eac_wordpress_base0
@@ -121,11 +134,11 @@ PATH
121
134
  PATH
122
135
  remote: sub/avm-files
123
136
  specs:
124
- avm-files (0.5.0)
125
- avm (~> 0.51)
137
+ avm-files (0.6.0)
138
+ avm (~> 0.52)
126
139
  eac_cli (~> 0.28)
127
140
  eac_fs (~> 0.12, >= 0.12.3)
128
- eac_ruby_utils (~> 0.105)
141
+ eac_ruby_utils (~> 0.106)
129
142
  eac_templates (~> 0.3, >= 0.3.2)
130
143
 
131
144
  PATH
@@ -141,12 +154,12 @@ PATH
141
154
  PATH
142
155
  remote: sub/avm-tools
143
156
  specs:
144
- avm-tools (0.142.2)
145
- aranha-parsers (~> 0.14, >= 0.14.3)
146
- avm (~> 0.51)
147
- avm-eac_ruby_base1 (~> 0.26)
157
+ avm-tools (0.142.3)
158
+ aranha-parsers (~> 0.14, >= 0.14.4)
159
+ avm (~> 0.52)
160
+ avm-eac_ruby_base1 (~> 0.26, >= 0.26.1)
148
161
  avm-eac_ubuntu_base0 (~> 0.3)
149
- avm-files (~> 0.5)
162
+ avm-files (~> 0.6)
150
163
  avm-git (~> 0.8)
151
164
  clipboard (~> 1.3, >= 1.3.6)
152
165
  curb (~> 0.9, >= 0.9.11)
@@ -159,10 +172,12 @@ PATH
159
172
  PATH
160
173
  remote: sub/avm
161
174
  specs:
162
- avm (0.51.0)
175
+ avm (0.52.0)
176
+ aranha-parsers (~> 0.14, >= 0.14.4)
163
177
  eac_cli (~> 0.28)
164
178
  eac_config (~> 0.11, >= 0.11.1)
165
179
  eac_docker (~> 0.5)
180
+ eac_fs (~> 0.12, >= 0.12.3)
166
181
  eac_git (~> 0.13)
167
182
  eac_ruby_utils (~> 0.105)
168
183
  eac_templates (~> 0.3, >= 0.3.2)
@@ -219,7 +234,7 @@ PATH
219
234
  PATH
220
235
  remote: sub/eac_ruby_utils
221
236
  specs:
222
- eac_ruby_utils (0.105.0)
237
+ eac_ruby_utils (0.106.0)
223
238
  activesupport (>= 4, < 7)
224
239
  addressable (~> 2.8, >= 2.8.1)
225
240
  bundler
@@ -237,15 +252,6 @@ GEM
237
252
  zeitwerk (~> 2.3)
238
253
  addressable (2.8.1)
239
254
  public_suffix (>= 2.0.2, < 6.0)
240
- aranha-parsers (0.14.3)
241
- activesupport (>= 4.0.0)
242
- addressable (~> 2.8, >= 2.8.1)
243
- curb (~> 0.9, >= 0.9.11)
244
- eac_ruby_utils (~> 0.102, >= 0.102.1)
245
- faraday-gzip (~> 0.1)
246
- faraday_middleware (~> 1.2)
247
- nokogiri (~> 1.13, >= 1.13.8)
248
- ofx-parser (~> 1.1)
249
255
  asciidoctor (2.0.18)
250
256
  ast (2.4.2)
251
257
  avm-eac_postgresql_base0 (0.2.0)
@@ -370,6 +376,7 @@ PLATFORMS
370
376
  x86_64-linux
371
377
 
372
378
  DEPENDENCIES
379
+ aranha-parsers!
373
380
  avm!
374
381
  avm-eac_asciidoctor_base0!
375
382
  avm-eac_generic_base0!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.37.2'
4
+ VERSION = '0.38.0'
5
5
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'aranha/parsers/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'aranha-parsers'
9
+ s.version = ::Aranha::Parsers::VERSION
10
+ s.authors = ['Esquilo Azul Company']
11
+ s.summary = 'Parsers\' utilities for Ruby.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'activesupport', '>= 4.0.0'
16
+ s.add_dependency 'addressable', '~> 2.8', '>= 2.8.1'
17
+ s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.106'
19
+ s.add_dependency 'faraday-gzip', '~> 0.1'
20
+ s.add_dependency 'faraday_middleware', '~> 1.2'
21
+ s.add_dependency 'nokogiri', '~> 1.13', '>= 1.13.9'
22
+ s.add_dependency 'ofx-parser', '~> 1.1'
23
+
24
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
25
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open-uri'
4
+ require 'fileutils'
5
+ require 'aranha/parsers/source_address'
6
+ require 'eac_ruby_utils/fs/temp'
7
+
8
+ module Aranha
9
+ module Parsers
10
+ class Base
11
+ class << self
12
+ def from_content(content)
13
+ ::EacRubyUtils::Fs::Temp.on_file do |path|
14
+ ::File.open(path.to_s, 'w:UTF-8') do |f|
15
+ f.write content.dup.force_encoding('UTF-8')
16
+ end
17
+ r = new(path.to_path)
18
+ r.content
19
+ r
20
+ end
21
+ end
22
+
23
+ def parse_content(content)
24
+ from_content(content).data
25
+ end
26
+ end
27
+
28
+ LOG_DIR_ENVVAR = 'ARANHA_PARSERS_LOG_DIR'
29
+
30
+ attr_reader :source_address
31
+
32
+ def initialize(url)
33
+ @source_address = ::Aranha::Parsers::SourceAddress.new(url)
34
+ log_content(source_address.serialize, '-source-address')
35
+ end
36
+
37
+ delegate :url, to: :source_address
38
+
39
+ def content
40
+ @content ||= log_content(source_address_content)
41
+ end
42
+
43
+ # @return [String]
44
+ delegate :content, to: :source_address, prefix: true
45
+
46
+ private
47
+
48
+ # @return [String]
49
+ def log_content(content, suffix = '')
50
+ path = log_file(suffix)
51
+
52
+ File.open(path, 'wb') { |file| file.write(content) } if path
53
+
54
+ content
55
+ end
56
+
57
+ def log_file(suffix)
58
+ dir = log_parsers_dir
59
+ return nil unless dir
60
+
61
+ f = ::File.join(dir, "#{self.class.name.parameterize}#{suffix}.log")
62
+ FileUtils.mkdir_p(File.dirname(f))
63
+ f
64
+ end
65
+
66
+ def log_parsers_dir
67
+ return ENV[LOG_DIR_ENVVAR] if ENV[LOG_DIR_ENVVAR]
68
+ return ::Rails.root.join('log', 'parsers') if rails_root_exist?
69
+
70
+ nil
71
+ end
72
+
73
+ def rails_root_exist?
74
+ ::Rails.root
75
+ true
76
+ rescue NameError
77
+ false
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'nokogiri'
4
+ require 'aranha/parsers/base'
5
+ require 'aranha/parsers/html/node/default'
6
+
7
+ module Aranha
8
+ module Parsers
9
+ module Html
10
+ class Base < ::Aranha::Parsers::Base
11
+ class << self
12
+ def fields
13
+ @fields ||= []
14
+ @fields.dup
15
+ end
16
+
17
+ def field(name, type, xpath)
18
+ @fields ||= []
19
+ @fields << Field.new(name, type, xpath)
20
+ end
21
+
22
+ Field = Struct.new(:name, :type, :xpath)
23
+ end
24
+
25
+ def nokogiri
26
+ @nokogiri ||= Nokogiri::HTML(content, &:noblanks)
27
+ end
28
+
29
+ protected
30
+
31
+ def node_parser_class
32
+ ::Aranha::Parsers::Html::Node::Default
33
+ end
34
+
35
+ private
36
+
37
+ def node_parser
38
+ @node_parser ||= node_parser_class.new(fields)
39
+ end
40
+
41
+ def fields
42
+ self.class.fields.map { |f| [f.name, f.type, f.xpath] }
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/base'
4
+
5
+ module Aranha
6
+ module Parsers
7
+ module Html
8
+ class Item < Base
9
+ def data
10
+ @data ||= node_parser.parse(item_node)
11
+ end
12
+
13
+ def item_node
14
+ @item_node ||= begin
15
+ r = item_xpath ? nokogiri.at_xpath(item_xpath) : nokogiri
16
+ raise "Item node not found (Item xpath: #{item_xpath})" unless r
17
+
18
+ r
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/base'
4
+
5
+ module Aranha
6
+ module Parsers
7
+ module Html
8
+ class ItemList < Base
9
+ def data
10
+ items_data
11
+ end
12
+
13
+ def item_data(item)
14
+ item
15
+ end
16
+
17
+ def items_data
18
+ count = 0
19
+ @data ||= nokogiri.xpath(items_xpath).map do |m|
20
+ count += 1
21
+ item_data(node_parser.parse(m))
22
+ end
23
+ rescue StandardError => e
24
+ raise StandardError, "#{e.message} (Count: #{count})"
25
+ end
26
+
27
+ def items_xpath
28
+ raise "Class #{self.class} has no method \"#{__method__}\". Implement it"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aranha
4
+ module Parsers
5
+ module Html
6
+ module Node
7
+ class Base
8
+ attr_reader :fields
9
+
10
+ def initialize(fields)
11
+ @fields = fields
12
+ end
13
+
14
+ def parse(node)
15
+ fields.map do |f|
16
+ [f[0], parse_field(node, f[2], f[1])]
17
+ rescue StandardError => e
18
+ raise StandardError, "#{e.message}\nFields: #{f}"
19
+ end.to_h
20
+ end
21
+
22
+ private
23
+
24
+ def parse_field(node, xpath, parser_method)
25
+ value_method = "#{parser_method}_value"
26
+ return send(value_method, node, xpath) if respond_to?(value_method)
27
+
28
+ raise "Method \"#{value_method}\" not found in #{self.class}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/node/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Aranha
7
+ module Parsers
8
+ module Html
9
+ module Node
10
+ class Default < ::Aranha::Parsers::Html::Node::Base
11
+ module NumericSupport
12
+ def integer_value(node, xpath)
13
+ r = string_value(node, xpath)
14
+ return nil if r.blank?
15
+
16
+ m = /\d+/.match(r)
17
+ raise "Integer not found in \"#{r}\"" unless m
18
+
19
+ m[0].to_i
20
+ end
21
+
22
+ def integer_optional_value(node, xpath)
23
+ r = string_value(node, xpath)
24
+ m = /\d+/.match(r)
25
+ m ? m[0].to_i : nil
26
+ end
27
+
28
+ def float_value(node, xpath)
29
+ parse_float(node, xpath, true)
30
+ end
31
+
32
+ def float_optional_value(node, xpath)
33
+ parse_float(node, xpath, false)
34
+ end
35
+
36
+ def us_decimal_value(node, xpath)
37
+ parse_us_decimal(node, xpath, true)
38
+ end
39
+
40
+ def us_decimal_optional_value(node, xpath)
41
+ parse_us_decimal(node, xpath, false)
42
+ end
43
+
44
+ private
45
+
46
+ def parse_float(node, xpath, required)
47
+ s = string_value(node, xpath)
48
+ m = /\d+(?:[\.\,](\d+))?/.match(s)
49
+ if m
50
+ m[0].delete('.').tr(',', '.').to_f
51
+ elsif required
52
+ raise "Float value not found in \"#{s}\""
53
+ end
54
+ end
55
+
56
+ def parse_us_decimal(node, xpath, required)
57
+ s = string_value(node, xpath)
58
+ m = /\d+(?:[\.\,](\d+))?/.match(s)
59
+ if m
60
+ m[0].delete(',').to_f
61
+ elsif required
62
+ raise "US decimal value not found in \"#{s}\""
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/node/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Aranha
7
+ module Parsers
8
+ module Html
9
+ module Node
10
+ class Default < ::Aranha::Parsers::Html::Node::Base
11
+ module StringSupport
12
+ def quoted_value(node, xpath)
13
+ s = string_value(node, xpath)
14
+ return '' unless s
15
+
16
+ m = /\"([^\"]+)\"/.match(s)
17
+ return m[1] if m
18
+
19
+ ''
20
+ end
21
+
22
+ def regxep(node, xpath, pattern)
23
+ s = string_value(node, xpath)
24
+ m = pattern.match(s)
25
+ return m if m
26
+
27
+ raise "Pattern \"#{pattern}\" not found in string \"#{s}\""
28
+ end
29
+
30
+ def string_value(node, xpath)
31
+ if node.at_xpath(xpath)
32
+ sanitize_string(node.at_xpath(xpath).text)
33
+ else
34
+ ''
35
+ end
36
+ end
37
+
38
+ def string_recursive_value(node, xpath, required = true)
39
+ root = node.at_xpath(xpath)
40
+ if root.blank?
41
+ return nil unless required
42
+
43
+ raise "No node found (Xpath: #{xpath})"
44
+ end
45
+ result = string_recursive(root)
46
+ return result if result.present?
47
+ return nil unless required
48
+
49
+ raise "String blank (Xpath: #{xpath})"
50
+ end
51
+
52
+ def string_recursive_optional_value(node, xpath)
53
+ string_recursive_value(node, xpath, false)
54
+ end
55
+
56
+ private
57
+
58
+ def sanitize_string(obj)
59
+ obj.to_s.tr("\u00A0", ' ').strip
60
+ end
61
+
62
+ def string_recursive(node)
63
+ return sanitize_string(node.text) if node.is_a?(::Nokogiri::XML::Text)
64
+
65
+ s = ''
66
+ node.children.each do |child|
67
+ child_s = string_recursive(child)
68
+ s += ' ' + child_s if child_s.present?
69
+ end
70
+ sanitize_string(s)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/html/node/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Aranha
7
+ module Parsers
8
+ module Html
9
+ module Node
10
+ class Default < ::Aranha::Parsers::Html::Node::Base
11
+ require_sub __FILE__, include_modules: true
12
+
13
+ def array_value(node, xpath)
14
+ r = node.xpath(xpath).map { |n| n.text.strip }
15
+ r.join('|')
16
+ end
17
+
18
+ def join_value(node, xpath)
19
+ m = ''
20
+ node.xpath(xpath).each do |n|
21
+ m << n.text.strip
22
+ end
23
+ m
24
+ end
25
+
26
+ def duration_value(node, xpath)
27
+ m = /(\d+) m/.match(join_value(node, xpath))
28
+ m ? m[1].to_i : nil
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+
5
+ module Aranha
6
+ module Parsers
7
+ module Html
8
+ module Node
9
+ ::EacRubyUtils.require_sub __FILE__
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+
5
+ module Aranha
6
+ module Parsers
7
+ module Html
8
+ ::EacRubyUtils.require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aranha
4
+ module Parsers
5
+ class InvalidStateException < StandardError
6
+ end
7
+ end
8
+ end