eac_tools 0.64.0 → 0.65.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +38 -32
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/aranha-parsers/aranha-parsers.gemspec +4 -4
  5. data/sub/aranha-parsers/lib/aranha/parsers/base.rb +10 -5
  6. data/sub/aranha-parsers/lib/aranha/parsers/html/base.rb +14 -0
  7. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default/string_support.rb +6 -6
  8. data/sub/aranha-parsers/lib/aranha/parsers/html/node/default.rb +16 -2
  9. data/sub/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  10. data/sub/avm/avm.gemspec +1 -1
  11. data/sub/avm/lib/avm/data/package.rb +1 -1
  12. data/sub/avm/lib/avm/data/unit.rb +25 -54
  13. data/sub/avm/lib/avm/data/unit_with_commands.rb +52 -0
  14. data/sub/avm/lib/avm/instances/data/files_unit.rb +1 -4
  15. data/sub/avm/lib/avm/instances/data/unit.rb +3 -3
  16. data/sub/avm/lib/avm/version.rb +1 -1
  17. data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +2 -2
  18. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +1 -4
  19. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
  20. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +4 -3
  21. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher_stereotypes/base/publish.rb +8 -9
  22. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  23. data/sub/avm-tools/avm-tools.gemspec +1 -1
  24. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/load.rb +31 -0
  25. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  26. data/sub/eac_envs-http/Gemfile +8 -0
  27. data/sub/eac_envs-http/eac_envs-http.gemspec +25 -0
  28. data/sub/eac_envs-http/lib/eac_envs/http/error.rb +8 -0
  29. data/sub/eac_envs-http/lib/eac_envs/http/request/body_field.rb +51 -0
  30. data/sub/eac_envs-http/lib/eac_envs/http/request/body_field_value.rb +32 -0
  31. data/sub/eac_envs-http/lib/eac_envs/http/request/body_fields.rb +39 -0
  32. data/sub/eac_envs-http/lib/eac_envs/http/request/faraday_connection.rb +75 -0
  33. data/sub/eac_envs-http/lib/eac_envs/http/request.rb +58 -0
  34. data/sub/eac_envs-http/lib/eac_envs/http/response/body.rb +57 -0
  35. data/sub/eac_envs-http/lib/eac_envs/http/response/headers.rb +41 -0
  36. data/sub/eac_envs-http/lib/eac_envs/http/response/links.rb +28 -0
  37. data/sub/eac_envs-http/lib/eac_envs/http/response/statuses.rb +21 -0
  38. data/sub/eac_envs-http/lib/eac_envs/http/response.rb +30 -0
  39. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/request_processor.rb +42 -0
  40. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server/webrick_servlet.rb +22 -0
  41. data/sub/eac_envs-http/lib/eac_envs/http/rspec/echo_server.rb +63 -0
  42. data/sub/eac_envs-http/lib/eac_envs/http/rspec.rb +11 -0
  43. data/sub/eac_envs-http/lib/eac_envs/http/version.rb +7 -0
  44. data/sub/eac_envs-http/lib/eac_envs/http.rb +9 -0
  45. data/sub/eac_envs-http/spec/lib/eac_envs/http/request/body_fields_spec.rb +47 -0
  46. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec.rb +68 -0
  47. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.source.yaml +5 -0
  48. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get.target.yaml +9 -0
  49. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.source.yaml +8 -0
  50. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/get_with_auth.target.yaml +10 -0
  51. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.source.yaml +10 -0
  52. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_array_body.target.yaml +11 -0
  53. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.source.yaml +4 -0
  54. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/post_string_body.target.yaml +11 -0
  55. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.source.yaml +6 -0
  56. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_hash_body.target.yaml +11 -0
  57. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.source.yaml +5 -0
  58. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/put_with_file.target.yaml +13 -0
  59. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.source.yaml +2 -0
  60. data/sub/eac_envs-http/spec/lib/eac_envs/http/request_spec_files/root.target.yaml +9 -0
  61. data/sub/eac_envs-http/spec/rubocop_spec.rb +3 -0
  62. data/sub/eac_envs-http/spec/spec_helper/request_builder.rb +61 -0
  63. data/sub/eac_envs-http/spec/spec_helper.rb +7 -0
  64. data/sub/eac_ruby_utils/lib/eac_ruby_utils/acts_as_abstract.rb +26 -5
  65. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +14 -2
  66. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  67. metadata +56 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 514082c79fd68acecc065cb4bfcac5debaa5e114e3a53e64962888d0b2cb2ebd
4
- data.tar.gz: bdbc2be06b220888e839844b9562fed56431c3dd5b70ebc771a18ab5a6809ca1
3
+ metadata.gz: 8723a175022efba79f604084a0180cbeaf95a4f2505c3eeb40c5bb6e305f3a24
4
+ data.tar.gz: 64b727ef144842f33fb362a51677c595ec12b9703ec68b7ddc686c93f4429f65
5
5
  SHA512:
6
- metadata.gz: e6674ee3ea87209102c847f980c389666c0bc02d5e82252bc962beb86cebfa58f0bfcd8ff498ee4bdb7db79b56238953c11f1e02d40f3fa43342589a8ab5d1c6
7
- data.tar.gz: 203ae1b9a4a08408f276adf59c5dd4ba0fab61137653200a5c71f3b0620afca96b5b0500b0ec9fe7762e1fcaeed11a4d77b84e6bc46756a89c03b69f454bda46
6
+ metadata.gz: 5a546f59fb7e0e70180a13ec0cf47a8901b413e017ca5c3118dd6e4485e11dd10d88d1b8e0b49070a1c55972ad51e9ae0b53d8e0d46ea354072e75adbb05d19b
7
+ data.tar.gz: 185f2fe7167b8f6b338cae914d2763758bd41e9f3aa7b79bcd56131beaab4e96f83dfcf6a2a512ec69afca44063cb58004a4814eeca6c16da19be24c5cff579a
data/Gemfile.lock CHANGED
@@ -1,34 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.64.0)
5
- avm (~> 0.70)
4
+ eac_tools (0.65.1)
5
+ avm (~> 0.71)
6
6
  avm-eac_asciidoctor_base0 (~> 0.19)
7
7
  avm-eac_generic_base0 (~> 0.12)
8
8
  avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
9
9
  avm-eac_php_base0 (~> 0.4, >= 0.4.2)
10
- avm-eac_postgresql_base0 (~> 0.5)
10
+ avm-eac_postgresql_base0 (~> 0.5, >= 0.5.1)
11
11
  avm-eac_python_base0 (~> 0.2, >= 0.2.1)
12
12
  avm-eac_rails_base0 (~> 0.10, >= 0.10.2)
13
13
  avm-eac_rails_base1 (~> 0.8, >= 0.8.4)
14
14
  avm-eac_redmine_base0 (~> 0.20, >= 0.20.1)
15
15
  avm-eac_redmine_plugin_base0 (~> 0.4)
16
- avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
16
+ avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
17
17
  avm-eac_webapp_base0 (~> 0.17)
18
18
  avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
19
19
  avm-git (~> 0.13, >= 0.13.2)
20
- avm-tools (~> 0.146)
21
- eac_ruby_utils (~> 0.114)
20
+ avm-tools (~> 0.147)
21
+ eac_ruby_utils (~> 0.116)
22
22
 
23
23
  PATH
24
24
  remote: sub/aranha-parsers
25
25
  specs:
26
- aranha-parsers (0.17.1)
26
+ aranha-parsers (0.18.0)
27
27
  activesupport (>= 4.0.0)
28
- addressable (~> 2.8, >= 2.8.3)
29
- eac_envs-http (~> 0.3)
30
- eac_ruby_utils (~> 0.112)
31
- nokogiri (~> 1.14, >= 1.14.2)
28
+ addressable (~> 2.8, >= 2.8.4)
29
+ eac_envs-http (~> 0.3, >= 0.3.1)
30
+ eac_ruby_utils (~> 0.116)
31
+ nokogiri (~> 1.14, >= 1.14.4)
32
32
  ofx-parser (~> 1.1)
33
33
 
34
34
  PATH
@@ -67,9 +67,9 @@ PATH
67
67
  PATH
68
68
  remote: sub/avm-eac_postgresql_base0
69
69
  specs:
70
- avm-eac_postgresql_base0 (0.5.0)
71
- avm (~> 0.70)
72
- eac_ruby_utils (~> 0.114)
70
+ avm-eac_postgresql_base0 (0.5.1)
71
+ avm (~> 0.71)
72
+ eac_ruby_utils (~> 0.115)
73
73
 
74
74
  PATH
75
75
  remote: sub/avm-eac_python_base0
@@ -117,11 +117,12 @@ PATH
117
117
  PATH
118
118
  remote: sub/avm-eac_ruby_base1
119
119
  specs:
120
- avm-eac_ruby_base1 (0.30.2)
121
- aranha-parsers (~> 0.17, >= 0.17.1)
122
- avm (~> 0.67, >= 0.67.1)
120
+ avm-eac_ruby_base1 (0.30.3)
121
+ aranha-parsers (~> 0.18)
122
+ avm (~> 0.71)
123
123
  avm-eac_generic_base0 (~> 0.12)
124
- eac_ruby_utils (~> 0.112)
124
+ eac_envs-http (~> 0.3, >= 0.3.2)
125
+ eac_ruby_utils (~> 0.116)
125
126
 
126
127
  PATH
127
128
  remote: sub/avm-eac_ubuntu_base0
@@ -173,9 +174,9 @@ PATH
173
174
  PATH
174
175
  remote: sub/avm-tools
175
176
  specs:
176
- avm-tools (0.146.0)
177
+ avm-tools (0.147.0)
177
178
  aranha-parsers (~> 0.17, >= 0.17.1)
178
- avm (~> 0.70)
179
+ avm (~> 0.71)
179
180
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
180
181
  avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
181
182
  avm-files (~> 0.6, >= 0.6.2)
@@ -191,14 +192,14 @@ PATH
191
192
  PATH
192
193
  remote: sub/avm
193
194
  specs:
194
- avm (0.70.0)
195
+ avm (0.71.0)
195
196
  aranha-parsers (~> 0.17, >= 0.17.1)
196
197
  eac_cli (~> 0.33)
197
198
  eac_config (~> 0.12)
198
199
  eac_docker (~> 0.7)
199
200
  eac_fs (~> 0.16)
200
201
  eac_git (~> 0.14, >= 0.14.1)
201
- eac_ruby_utils (~> 0.114)
202
+ eac_ruby_utils (~> 0.115)
202
203
  eac_templates (~> 0.5)
203
204
  filesize (~> 0.2)
204
205
  htmlbeautifier (~> 1.4, >= 1.4.2)
@@ -226,6 +227,18 @@ PATH
226
227
  eac_ruby_utils (~> 0.112)
227
228
  eac_templates (~> 0.3, >= 0.3.2)
228
229
 
230
+ PATH
231
+ remote: sub/eac_envs-http
232
+ specs:
233
+ eac_envs-http (0.3.2)
234
+ eac_fs (~> 0.16)
235
+ eac_ruby_utils (~> 0.116)
236
+ faraday (~> 2.7, >= 2.7.4)
237
+ faraday-follow_redirects (~> 0.3)
238
+ faraday-gzip (~> 0.1)
239
+ faraday-multipart (~> 1.0, >= 1.0.4)
240
+ faraday-retry (~> 2.1)
241
+
229
242
  PATH
230
243
  remote: sub/eac_fs
231
244
  specs:
@@ -261,7 +274,7 @@ PATH
261
274
  PATH
262
275
  remote: sub/eac_ruby_utils
263
276
  specs:
264
- eac_ruby_utils (0.114.0)
277
+ eac_ruby_utils (0.116.0)
265
278
  activesupport (>= 4, < 7)
266
279
  addressable (~> 2.8, >= 2.8.4)
267
280
  bundler
@@ -295,14 +308,6 @@ GEM
295
308
  parslet (~> 2.0)
296
309
  curb (0.9.11)
297
310
  diff-lcs (1.5.0)
298
- eac_envs-http (0.3.1)
299
- eac_fs (~> 0.16)
300
- eac_ruby_utils (~> 0.112)
301
- faraday (~> 2.7, >= 2.7.4)
302
- faraday-follow_redirects (~> 0.3)
303
- faraday-gzip (~> 0.1)
304
- faraday-multipart (~> 1.0, >= 1.0.4)
305
- faraday-retry (~> 2.1)
306
311
  eac_ruby_gem_support (0.5.1)
307
312
  eac_ruby_utils (~> 0.74)
308
313
  rspec (~> 3.9)
@@ -335,7 +340,7 @@ GEM
335
340
  minitest (5.18.0)
336
341
  multipart-post (2.3.0)
337
342
  net-ssh (4.2.0)
338
- nokogiri (1.14.4-x86_64-linux)
343
+ nokogiri (1.15.0-x86_64-linux)
339
344
  racc (~> 1.4)
340
345
  ofx-parser (1.1.0)
341
346
  hpricot (>= 0.6)
@@ -413,6 +418,7 @@ DEPENDENCIES
413
418
  eac_cli!
414
419
  eac_config!
415
420
  eac_docker!
421
+ eac_envs-http!
416
422
  eac_fs!
417
423
  eac_git!
418
424
  eac_rest!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.64.0'
4
+ VERSION = '0.65.1'
5
5
  end
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'activesupport', '>= 4.0.0'
16
- s.add_dependency 'addressable', '~> 2.8', '>= 2.8.3'
17
- s.add_dependency 'eac_envs-http', '~> 0.3'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.112'
19
- s.add_dependency 'nokogiri', '~> 1.14', '>= 1.14.2'
16
+ s.add_dependency 'addressable', '~> 2.8', '>= 2.8.4'
17
+ s.add_dependency 'eac_envs-http', '~> 0.3', '>= 0.3.1'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.116'
19
+ s.add_dependency 'nokogiri', '~> 1.14', '>= 1.14.4'
20
20
  s.add_dependency 'ofx-parser', '~> 1.1'
21
21
 
22
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
@@ -9,20 +9,25 @@ module Aranha
9
9
  module Parsers
10
10
  class Base
11
11
  class << self
12
+ # @deprecated Use {#from_string} instead.
13
+ # @param content [String]
14
+ # @return [Aranha::Parsers::Base]
12
15
  def from_content(content)
16
+ from_string(content)
17
+ end
18
+
19
+ # @param string [String]
20
+ # @return [Aranha::Parsers::Base]
21
+ def from_string(string)
13
22
  ::EacRubyUtils::Fs::Temp.on_file do |path|
14
23
  ::File.open(path.to_s, 'w:UTF-8') do |f|
15
- f.write content.dup.force_encoding('UTF-8')
24
+ f.write string.dup.force_encoding('UTF-8')
16
25
  end
17
26
  r = new(path.to_path)
18
27
  r.content
19
28
  r
20
29
  end
21
30
  end
22
-
23
- def parse_content(content)
24
- from_content(content).data
25
- end
26
31
  end
27
32
 
28
33
  LOG_DIR_ENVVAR = 'ARANHA_PARSERS_LOG_DIR'
@@ -19,6 +19,20 @@ module Aranha
19
19
  @fields << Field.new(name, type, xpath)
20
20
  end
21
21
 
22
+ # @param node [Nokogiri::XML::Node]
23
+ # @return [Aranha::Parsers::Html::Base]
24
+ def from_node(node)
25
+ from_string(node.to_html)
26
+ end
27
+
28
+ # @param haystack [String]
29
+ # @param needle [String]
30
+ # @return [String]
31
+ def xpath_ends_with(haystack, needle)
32
+ "substring(#{haystack}, string-length(#{haystack}) - string-length(#{needle}) + 1) " \
33
+ "= #{needle}"
34
+ end
35
+
22
36
  Field = Struct.new(:name, :type, :xpath)
23
37
  end
24
38
 
@@ -27,16 +27,16 @@ module Aranha
27
27
  raise "Pattern \"#{pattern}\" not found in string \"#{s}\""
28
28
  end
29
29
 
30
+ # @param node [Nokogiri::XML::Node]
31
+ # @param xpath [String]
32
+ # @return [String]
30
33
  def string_value(node, xpath)
31
- if node.at_xpath(xpath)
32
- sanitize_string(node.at_xpath(xpath).text)
33
- else
34
- ''
35
- end
34
+ found = node_value(node, xpath)
35
+ found ? sanitize_string(found.text) : ''
36
36
  end
37
37
 
38
38
  def string_recursive_value(node, xpath, required = true)
39
- root = node.at_xpath(xpath)
39
+ root = node_value(node, xpath)
40
40
  if root.blank?
41
41
  return nil unless required
42
42
 
@@ -11,13 +11,13 @@ module Aranha
11
11
  require_sub __FILE__, include_modules: true
12
12
 
13
13
  def array_value(node, xpath)
14
- r = node.xpath(xpath).map { |n| n.text.strip }
14
+ r = node_set_value(node, xpath).map { |n| n.text.strip }
15
15
  r.join('|')
16
16
  end
17
17
 
18
18
  def join_value(node, xpath)
19
19
  m = ''
20
- node.xpath(xpath).each do |n|
20
+ node_set_value(node, xpath).each do |n|
21
21
  m << n.text.strip
22
22
  end
23
23
  m
@@ -27,6 +27,20 @@ module Aranha
27
27
  m = /(\d+) m/.match(join_value(node, xpath))
28
28
  m ? m[1].to_i : nil
29
29
  end
30
+
31
+ # @param node [Nokogiri::XML::Node]
32
+ # @param xpath [String]
33
+ # @return [Nokogiri::XML::NodeSet]
34
+ def node_set_value(node, xpath)
35
+ node.xpath(xpath)
36
+ end
37
+
38
+ # @param node [Nokogiri::XML::Node]
39
+ # @param xpath [String]
40
+ # @return [Nokogiri::XML::Node]
41
+ def node_value(node, xpath)
42
+ node.at_xpath(xpath)
43
+ end
30
44
  end
31
45
  end
32
46
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Parsers
5
- VERSION = '0.17.1'
5
+ VERSION = '0.18.0'
6
6
  end
7
7
  end
data/sub/avm/avm.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'eac_docker', '~> 0.7'
19
19
  s.add_dependency 'eac_fs', '~> 0.16'
20
20
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
21
- s.add_dependency 'eac_ruby_utils', '~> 0.114'
21
+ s.add_dependency 'eac_ruby_utils', '~> 0.115'
22
22
  s.add_dependency 'eac_templates', '~> 0.5'
23
23
  s.add_dependency 'filesize', '~> 0.2'
24
24
  s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
@@ -46,7 +46,7 @@ module Avm
46
46
  end
47
47
 
48
48
  # @param id [Symbol]
49
- # @return [Avm::Data::Unit]
49
+ # @return [Avm::Data::UnitWithCommands]
50
50
  def unit(identifier)
51
51
  units[identifier.to_sym] || raise("No unit found with identifier \"#{identifier}\"")
52
52
  end
@@ -6,72 +6,43 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Data
8
8
  class Unit
9
- include ::Avm::Data::Callbacks
10
-
9
+ acts_as_abstract(
10
+ do_clear: [],
11
+ do_dump: [:dump_path],
12
+ do_load: [:dump_path],
13
+ dump_path_extension: []
14
+ )
11
15
  enable_speaker
16
+ include ::Avm::Data::Callbacks
12
17
 
13
- %w[dump load].each do |action|
14
- method_name = "#{action}_command"
15
- class_eval <<~CODE, __FILE__, __LINE__ + 1
16
- # Should be overrided.
17
- # @return [EacRubyUtils::Envs::Command]
18
- def #{method_name}
19
- fail "\\"#{method_name}\\" is a abstract method. Override in #{singleton_class}."
20
- end
21
- CODE
22
- end
23
-
24
- def extension
25
- singleton_class.const_get('EXTENSION')
26
- rescue NameError
27
- ''
28
- end
29
-
30
- def name
31
- self.class
32
- end
33
-
34
- def load_from_directory(directory, identifier)
35
- load(unit_on_directory_path(directory, identifier))
36
- end
37
-
38
- def dump_to_directory(directory, identifier)
39
- dump(unit_on_directory_path(directory, identifier))
18
+ # @param dump_path [Pathname]
19
+ # @return [void]
20
+ def clear
21
+ run_callbacks(:dump) { do_clear }
40
22
  end
41
23
 
42
- def dump(data_path)
24
+ # @param dump_path [Pathname]
25
+ # @return [void]
26
+ def dump(dump_path)
43
27
  run_callbacks :dump do
44
- infom "Dumping unit \"#{name}\" to \"#{data_path}\"..."
45
- do_dump(data_path)
28
+ infom "Dumping unit \"#{name}\" to \"#{dump_path}\"..."
29
+ do_dump(dump_path)
46
30
  end
47
31
  end
48
32
 
49
- # @return [Struct(:key, :subpath), nil]
50
- def installation_files_data
51
- nil
52
- end
53
-
54
- def load(data_path)
33
+ # @param dump_path [Pathname]
34
+ # @return [void]
35
+ def load(dump_path)
55
36
  run_callbacks :load do
56
- infom "Loading unit \"#{name}\" from \"#{data_path}\"..."
57
- do_load(data_path)
37
+ clear
38
+ infom "Loading unit \"#{name}\" from \"#{dump_path}\"..."
39
+ do_load(dump_path)
58
40
  end
59
41
  end
60
42
 
61
- protected
62
-
63
- def do_dump(data_path)
64
- dump_command.execute!(output_file: data_path)
65
- end
66
-
67
- def do_load(data_path)
68
- load_command.execute!(input_file: data_path)
69
- end
70
-
71
- private
72
-
73
- def unit_on_directory_path(directory, identifier)
74
- ::File.join(directory, "#{identifier}#{extension}")
43
+ # @return [String]
44
+ def name
45
+ self.class.name
75
46
  end
76
47
  end
77
48
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/callbacks'
4
+ require 'avm/data/unit'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Data
9
+ class UnitWithCommands < ::Avm::Data::Unit
10
+ acts_as_abstract
11
+
12
+ abstract_method :dump_command
13
+ abstract_method :load_command
14
+
15
+ # @return [String]
16
+ def dump_path_extension
17
+ singleton_class.const_get('EXTENSION')
18
+ rescue NameError
19
+ ''
20
+ end
21
+
22
+ def load_from_directory(directory, identifier)
23
+ load(unit_on_directory_path(directory, identifier))
24
+ end
25
+
26
+ def dump_to_directory(directory, identifier)
27
+ dump(unit_on_directory_path(directory, identifier))
28
+ end
29
+
30
+ # @return [Struct(:key, :subpath), nil]
31
+ def installation_files_data
32
+ nil
33
+ end
34
+
35
+ protected
36
+
37
+ def do_dump(data_path)
38
+ dump_command.execute!(output_file: data_path)
39
+ end
40
+
41
+ def do_load(data_path)
42
+ load_command.execute!(input_file: data_path)
43
+ end
44
+
45
+ private
46
+
47
+ def unit_on_directory_path(directory, identifier)
48
+ ::File.join(directory, "#{identifier}#{dump_path_extension}")
49
+ end
50
+ end
51
+ end
52
+ end
@@ -17,8 +17,6 @@ module Avm
17
17
  self.options = self.class.lists.option.hash_keys_validate!(options)
18
18
  end
19
19
 
20
- before_load :clear
21
-
22
20
  # @return [Pathname]
23
21
  def files_path
24
22
  fs_path_subpath
@@ -33,8 +31,7 @@ module Avm
33
31
  instance_command('tar', '-xzf', '-', '-C', files_path)
34
32
  end
35
33
 
36
- def clear
37
- infom "Removing all files under #{files_path}..."
34
+ def do_clear
38
35
  instance_command('mkdir', '-p', files_path).execute!
39
36
  instance_command('find', files_path, '-mindepth', 1, '-delete').execute!
40
37
  end
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/data/unit'
3
+ require 'avm/data/unit_with_commands'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Instances
8
8
  module Data
9
- class Unit < ::Avm::Data::Unit
9
+ class Unit < ::Avm::Data::UnitWithCommands
10
10
  common_constructor :instance
11
11
 
12
12
  # @return [Pathname]
13
13
  def data_default_dump_path
14
14
  instance.data_default_dump_path.to_pathname.basename_sub('.*') do |b|
15
- "#{b}_#{identifier}#{extension}"
15
+ "#{b}_#{identifier}#{dump_path_extension}"
16
16
  end
17
17
  end
18
18
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.70.0'
4
+ VERSION = '0.71.0'
5
5
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.70'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.114'
15
+ s.add_dependency 'avm', '~> 0.71'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.115'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
19
  end
@@ -12,10 +12,7 @@ module Avm
12
12
  TABLES_SQL = "select schemaname || '#{TABLE_PARTS_SEPARATOR}' || tablename from " \
13
13
  "pg_tables where schemaname = '#{SCHEMA_VAR}'"
14
14
 
15
- before_load :clear
16
-
17
- def clear
18
- info 'Clearing database (Dropping all tables)...'
15
+ def do_clear
19
16
  ts = tables
20
17
  if ts.empty?
21
18
  info 'Database has no tables'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
@@ -12,10 +12,11 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
16
- s.add_dependency 'avm', '~> 0.67', '>= 0.67.1'
15
+ s.add_dependency 'aranha-parsers', '~> 0.18'
16
+ s.add_dependency 'avm', '~> 0.71'
17
17
  s.add_dependency 'avm-eac_generic_base0', '~> 0.12'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.112'
18
+ s.add_dependency 'eac_envs-http', '~> 0.3', '>= 0.3.2'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.116'
19
20
 
20
21
  s.add_development_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
21
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
3
  require 'eac_ruby_utils/simple_cache'
5
4
  require 'rubygems'
6
5
  require 'eac_cli/speaker'
7
- require 'aranha/parsers/source_address'
8
6
  require 'avm/launcher/publish/base'
9
7
  require 'avm/launcher/publish/check_result'
10
8
  require 'avm/eac_ruby_base1/launcher/gem'
9
+ require 'eac_envs/http/request'
10
+ require 'eac_envs/http/response'
11
11
 
12
12
  module Avm
13
13
  module EacRubyBase1
@@ -97,14 +97,13 @@ module Avm
97
97
  gem_version_max.present? && ::Gem::Version.new(gem_spec.version) < gem_version_max
98
98
  end
99
99
 
100
+ # @return [Array]
100
101
  def gem_versions_uncached
101
- ::JSON.parse!(
102
- ::Aranha::Parsers::SourceAddress.detect_sub(
103
- "https://rubygems.org/api/v1/versions/#{gem_spec.name}.json"
104
- ).content
105
- )
106
- rescue ::Aranha::Parsers::SourceAddress::FetchContentError => e
107
- e.request.status == 404 ? [] : raise(e)
102
+ ::EacEnvs::Http::Request.new
103
+ .url("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
104
+ .response.body_data_or_raise
105
+ rescue EacEnvs::Http::Response => e
106
+ e.status == 404 ? [] : raise(e)
108
107
  end
109
108
 
110
109
  def gem_version_max_uncached
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.30.2'
5
+ VERSION = '0.30.3'
6
6
  end
7
7
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
18
- s.add_dependency 'avm', '~> 0.70'
18
+ s.add_dependency 'avm', '~> 0.71'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.30', '>= 0.30.2'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
21
21
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'