eac_tools 0.22.0 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +60 -60
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +3 -3
  5. data/sub/avm/lib/avm/entries/base/uri_component_entry_value.rb +55 -0
  6. data/sub/avm/lib/avm/entries/base.rb +2 -0
  7. data/sub/avm/lib/avm/entries/entry.rb +10 -1
  8. data/sub/avm/lib/avm/entries/uri_builder.rb +4 -0
  9. data/sub/avm/lib/avm/instances/base/auto_values/install.rb +5 -13
  10. data/sub/avm/lib/avm/instances/base.rb +1 -1
  11. data/sub/avm/lib/avm/instances/entry_keys.rb +2 -1
  12. data/sub/avm/lib/avm/sources/base/application.rb +34 -0
  13. data/sub/avm/lib/avm/sources/base/configuration.rb +2 -0
  14. data/sub/avm/lib/avm/sources/base/testing.rb +1 -1
  15. data/sub/avm/lib/avm/version.rb +1 -1
  16. data/sub/avm/spec/lib/avm/instances/base_spec.rb +16 -0
  17. data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
  18. data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +5 -5
  19. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb +13 -0
  20. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances.rb +11 -0
  21. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  22. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +3 -3
  23. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +2 -2
  24. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +1 -1
  25. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +2 -2
  26. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances/base.rb +13 -0
  27. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances.rb +11 -0
  28. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/runners/base.rb +1 -1
  29. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  30. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_host_spec.rb +2 -2
  31. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/apache_path_spec.rb +2 -2
  32. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +4 -4
  33. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/base.rb +27 -0
  34. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances.rb +11 -0
  35. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb +1 -1
  36. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +2 -2
  37. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  38. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +6 -6
  39. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +48 -4
  40. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances.rb +11 -0
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/runners/base.rb +1 -1
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/runners.rb +11 -0
  43. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources.rb +11 -0
  44. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  45. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  46. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb +8 -1
  47. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile.lock +1 -0
  48. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/_gitignore +2 -0
  49. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile.lock +1 -0
  50. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/_gitignore +2 -0
  51. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +4 -4
  52. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/subcommand_parent.rb +26 -0
  53. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +61 -0
  54. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/dump.rb +65 -0
  55. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/load.rb +57 -0
  56. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data.rb +19 -0
  57. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners.rb +13 -0
  58. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  59. data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +3 -3
  60. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/base.rb +2 -2
  61. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
  62. data/sub/avm-tools/avm-tools.gemspec +3 -3
  63. data/sub/avm-tools/lib/avm/tools/runner/app_src/info.rb +10 -8
  64. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  65. data/sub/eac_config/eac_config.gemspec +2 -2
  66. data/sub/eac_config/lib/eac_config/entry_path.rb +6 -1
  67. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  68. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +9 -1
  69. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +5 -0
  70. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +17 -2
  71. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  72. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +32 -82
  73. metadata +49 -61
  74. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instance.rb +0 -11
  75. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instance.rb +0 -11
  76. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instance.rb +0 -25
  77. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb +0 -57
  78. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +0 -24
  79. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +0 -62
  80. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/dump.rb +0 -63
  81. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data/load.rb +0 -55
  82. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/runner/data.rb +0 -17
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_rails_base0/apache_host'
4
- require 'avm/eac_rails_base0/instance'
4
+ require 'avm/eac_rails_base0/instances/base'
5
5
 
6
6
  RSpec.describe ::Avm::EacRailsBase0::ApacheHost do
7
7
  describe '#no_ssl_site_content' do
8
- let(:instance) { ::Avm::EacRailsBase0::Instance.by_id('stub-app_0') }
8
+ let(:instance) { ::Avm::EacRailsBase0::Instances::Base.by_id('stub-app_0') }
9
9
  let(:apache_host) { described_class.new(instance) }
10
10
  let(:fixtures_dir) { ::Pathname.new('apache_host_spec_files').expand_path(__dir__) }
11
11
  let(:expected_content) { fixtures_dir.join('apache_host_spec_no_ssl_content.conf').read }
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_rails_base0/apache_path'
4
- require 'avm/eac_rails_base0/instance'
4
+ require 'avm/eac_rails_base0/instances/base'
5
5
 
6
6
  RSpec.describe ::Avm::EacRailsBase0::ApachePath do
7
7
  describe '#no_ssl_site_content' do
8
- let(:instance) { ::Avm::EacRailsBase0::Instance.by_id('stub-app_0') }
8
+ let(:instance) { ::Avm::EacRailsBase0::Instances::Base.by_id('stub-app_0') }
9
9
  let(:apache_path) { described_class.new(instance) }
10
10
  let(:fixtures_dir) { ::Pathname.new('apache_path_spec_files').expand_path(__dir__) }
11
11
  let(:expect_file) { fixtures_dir.join('stub-app_0_apache_path.conf') }
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.31'
16
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.11'
17
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.3'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.97'
15
+ s.add_dependency 'avm', '~> 0.35', '>= 0.35.1'
16
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.19'
17
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.4'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.98'
19
19
 
20
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
21
21
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/sources/base'
4
+ require 'avm/eac_webapp_base0/instances/base'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ class Base < ::Avm::EacWebappBase0::Instances::Base
10
+ DEFAULT_RAILS_ENVIRONMENT = 'production'
11
+
12
+ def bundle(*args)
13
+ the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', DEFAULT_RAILS_ENVIRONMENT)
14
+ end
15
+
16
+ def rake(*args)
17
+ bundle('exec', 'rake', *args)
18
+ end
19
+
20
+ def the_gem
21
+ @the_gem ||= ::Avm::EacRubyBase1::Sources::Base.new(::File.join(read_entry('fs_path')))
22
+ .env_set(host_env)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/instance'
3
+ require 'avm/eac_rails_base1/instances/base'
4
4
  require 'avm/eac_rails_base1/runner_with/rails_environment'
5
5
  require 'eac_cli/runner'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_rails_base1/instance'
3
+ require 'avm/eac_rails_base1/instances/base'
4
4
  require 'eac_cli/runner'
5
5
 
6
6
  module Avm
@@ -22,7 +22,7 @@ module Avm
22
22
  def default_rails_environment
23
23
  const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
24
24
  rescue ::NameError
25
- ::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
25
+ ::Avm::EacRailsBase1::Instances::Base::DEFAULT_RAILS_ENVIRONMENT
26
26
  end
27
27
  end
28
28
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRailsBase1
5
- VERSION = '0.4.2'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
@@ -12,14 +12,14 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.29'
16
- s.add_dependency 'avm-eac_generic_base0', '~> 0.4'
17
- s.add_dependency 'avm-eac_rails_base1', '~> 0.4', '>= 0.4.1'
15
+ s.add_dependency 'avm', '~> 0.35', '>= 0.35.1'
16
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
17
+ s.add_dependency 'avm-eac_rails_base1', '~> 0.5'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
19
- s.add_dependency 'curb', '~> 0.9.11'
20
- s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.2'
19
+ s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
20
+ s.add_dependency 'eac_fs', '~> 0.12', '>= 0.12.3'
21
21
  s.add_dependency 'eac_rest', '~> 0.6', '>= 0.6.1'
22
- s.add_dependency 'eac_ruby_utils', '~> 0.95', '>= 0.95.2'
22
+ s.add_dependency 'eac_ruby_utils', '~> 0.98'
23
23
 
24
24
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
25
25
  end
@@ -1,13 +1,57 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/base'
4
- require 'avm/eac_redmine_base0/instances/runners'
5
- require 'eac_ruby_utils/core_ext'
3
+ require 'addressable/uri'
4
+ require 'avm/eac_redmine_base0/data_unit'
5
+ require 'avm/eac_redmine_base0/instances/docker_image'
6
+ require 'avm/eac_redmine_base0/rest_api'
7
+ require 'avm/eac_rails_base1/instances/base'
6
8
 
7
9
  module Avm
8
10
  module EacRedmineBase0
9
11
  module Instances
10
- class Base < ::Avm::Instances::Base
12
+ class Base < ::Avm::EacRailsBase1::Instances::Base
13
+ enable_simple_cache
14
+
15
+ FILES_UNITS = { files: 'files' }.freeze
16
+
17
+ def docker_image_class
18
+ ::Avm::EacRedmineBase0::Instances::DockerImage
19
+ end
20
+
21
+ def docker_run_arguments
22
+ [
23
+ '--volume',
24
+ "#{read_entry(::Avm::Instances::EntryKeys::FS_PATH)}:/home/myuser/eac_redmine_base0",
25
+ '--publish', "#{read_entry(:ssh_port)}:22",
26
+ '--publish', "#{read_entry(:http_port)}:80",
27
+ '--publish', "#{read_entry(:https_port)}:443"
28
+ ]
29
+ end
30
+
31
+ def data_package
32
+ @data_package ||= ::Avm::Data::Instance::Package.new(
33
+ self,
34
+ units: {
35
+ all: ::Avm::EacRedmineBase0::DataUnit.new(self)
36
+ }
37
+ )
38
+ end
39
+
40
+ # @return [Addressable::URI]
41
+ def root_url
42
+ r = ::Addressable::URI.parse(read_entry(::Avm::Instances::EntryKeys::WEB_URL))
43
+ r.query_values = nil
44
+ r
45
+ end
46
+
47
+ private
48
+
49
+ # @return [Avm::EacRedmineBase0::RestApi]
50
+ def rest_api_uncached
51
+ url = root_url
52
+ url.query_values = { key: read_entry('api.key') }
53
+ ::Avm::EacRedmineBase0::RestApi.new(url)
54
+ end
11
55
  end
12
56
  end
13
57
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRedmineBase0
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_redmine_base0/instance'
3
+ require 'avm/eac_redmine_base0/instances/base'
4
4
  require 'avm/eac_redmine_base0/deploy'
5
5
  require 'avm/eac_redmine_base0/apache_host'
6
6
  require 'avm/eac_rails_base1/runner'
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRedmineBase0
7
+ module Runners
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRedmineBase0
7
+ module Sources
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.11.0'
5
+ VERSION = '0.12.0'
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.19.0'
5
+ VERSION = '0.19.1'
6
6
  end
7
7
  end
@@ -33,10 +33,17 @@ RSpec.describe ::Avm::EacRubyBase1::SourceGenerators::Base do
33
33
 
34
34
  def directory_to_h(dir)
35
35
  dir.children.map do |child|
36
- [child.basename.to_path, fs_object_to_h(child)]
36
+ [fs_object_basename(child), fs_object_to_h(child)]
37
37
  end.to_h
38
38
  end
39
39
 
40
+ # @return [String]
41
+ def fs_object_basename(obj)
42
+ r = obj.basename.to_path
43
+ r = '.gitignore' if r == '_gitignore'
44
+ r
45
+ end
46
+
40
47
  def fs_object_to_h(obj)
41
48
  if obj.file?
42
49
  file_to_h(obj)
@@ -0,0 +1 @@
1
+ Is expected that this content be replaced by "TRUNCATED\n".
@@ -0,0 +1 @@
1
+ Is expected that this content be replaced by "TRUNCATED\n".
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.1'
16
- s.add_dependency 'avm-eac_generic_base0', '~> 0.1'
17
- s.add_dependency 'avm-eac_postgresql_base0', '~> 0.1'
15
+ s.add_dependency 'avm', '~> 0.35', '>= 0.35.1'
16
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
17
+ s.add_dependency 'avm-eac_postgresql_base0', '~> 0.2'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
19
- s.add_dependency 'eac_ruby_utils', '~> 0.68'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.98'
20
20
 
21
21
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
22
22
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ module Instances
8
+ class Base < ::Avm::Instances::Base
9
+ class SubcommandParent
10
+ enable_simple_cache
11
+ common_constructor :instance
12
+
13
+ private
14
+
15
+ def runner_context_uncached
16
+ ::EacCli::Runner::Context.new(self, argv: runner_argv)
17
+ end
18
+
19
+ def runner_argv
20
+ [instance.class.name.split('::')[-2].dasherize, instance.id]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/eac_postgresql_base0/instance_with'
5
+ require 'avm/data/instance/files_unit'
6
+ require 'avm/data/instance/package'
7
+ require 'avm/eac_webapp_base0/deploy/file_unit'
8
+ require 'avm/eac_webapp_base0/instances/runners'
9
+ require 'avm/eac_ubuntu_base0/instances/base'
10
+
11
+ module Avm
12
+ module EacWebappBase0
13
+ module Instances
14
+ class Base < ::Avm::Instances::Base
15
+ require_sub __FILE__
16
+ include ::Avm::EacPostgresqlBase0::InstanceWith
17
+ enable_simple_cache
18
+
19
+ FILES_UNITS = [].freeze
20
+
21
+ def data_dump(argv = [])
22
+ run_subcommand(data_dump_runner_class, argv)
23
+ end
24
+
25
+ def data_dump_runner_class
26
+ "#{stereotype_namespace_module}::Runner::Data::Dump".constantize
27
+ end
28
+
29
+ def run_subcommand(subcommand_class, argv)
30
+ subcommand_class.create(
31
+ argv: argv,
32
+ parent: ::Avm::EacWebappBase0::Instance::SubcommandParent.new(self)
33
+ ).run
34
+ end
35
+
36
+ def data_package
37
+ @data_package ||= ::Avm::Data::Instance::Package.new(
38
+ self, units: { database: database_unit }.merge(files_units)
39
+ )
40
+ end
41
+
42
+ def database_unit
43
+ pg.data_unit
44
+ end
45
+
46
+ private
47
+
48
+ # @return [Avm::EacUbuntuBase0::Instances::Base]
49
+ def platform_instance_uncached
50
+ ::Avm::EacUbuntuBase0::Instances::Base.by_id(id)
51
+ end
52
+
53
+ def files_units
54
+ self.class.const_get('FILES_UNITS').transform_values do |fs_path_subpath|
55
+ ::Avm::Data::Instance::FilesUnit.new(self, fs_path_subpath)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/package/dump'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ module Instances
9
+ module Runners
10
+ class Data
11
+ class Dump
12
+ DUMP_EXPIRE_TIME = 1.day
13
+ DEFAULT_DUMP_PATH_ENTRY_SUFFIX = 'data.default_dump_path'
14
+ NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
15
+ 'dump was expired.'
16
+
17
+ runner_with :help do
18
+ desc 'Dump utility for EacRailsBase instance.'
19
+ bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
20
+ arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
21
+ end
22
+
23
+ def run
24
+ infov 'Instance to dump', "#{instance} (#{instance.class})"
25
+ if package_dump.runnable?
26
+ package_dump.run
27
+ else
28
+ warn(package_dump.cannot_run_reason)
29
+ end
30
+ success("Dump path: \"#{dump_path}\"")
31
+ dump_path
32
+ end
33
+
34
+ private
35
+
36
+ def instance
37
+ runner_context.call(:instance)
38
+ end
39
+
40
+ def package_dump_uncached
41
+ instance
42
+ .data_package.dump(dump_path, existing: package_dump_existing)
43
+ end
44
+
45
+ def dump_path
46
+ parsed.dump_path || default_dump_path
47
+ end
48
+
49
+ def default_dump_path
50
+ instance.read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
51
+ end
52
+
53
+ def package_dump_existing
54
+ if parsed.rewrite?
55
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE
56
+ else
57
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/numeric/time'
4
+ require 'eac_cli/speaker'
5
+ require 'eac_ruby_utils/simple_cache'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ module Instances
10
+ module Runners
11
+ class Data
12
+ class Load
13
+ runner_with :help do
14
+ desc 'Load utility for EacRailsBase instance.'
15
+ arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
16
+ pos_arg :dump_path, optional: true
17
+ end
18
+
19
+ def run
20
+ return ::Dev::Result.error("Dump \"#{dump_path}\" does not exist") unless
21
+ ::File.exist?(dump_path)
22
+
23
+ load_dump
24
+ success("Dump loaded from \"#{dump_path}\"")
25
+ end
26
+
27
+ def dump_path_uncached
28
+ return parsed.dump_path.to_s if parsed.dump_path.present?
29
+ return source_instance_dump_path if parsed.source_instance.present?
30
+
31
+ raise "Dump path unknown (Options: #{parsed})"
32
+ end
33
+
34
+ def source_instance_dump_path
35
+ runner_context.call(:instance).class.by_id(parsed.source_instance).data_dump
36
+ end
37
+
38
+ def load_dump
39
+ info "Loading dump \"#{dump_path}\"..."
40
+ package_load.run
41
+ end
42
+
43
+ def dump_instance_method
44
+ :dump_database
45
+ end
46
+
47
+ private
48
+
49
+ def package_load_uncached
50
+ runner_context.call(:instance).data_package.load(dump_path)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ module Instances
8
+ module Runners
9
+ class Data
10
+ require_sub __FILE__
11
+ runner_with :help, :subcommands do
12
+ desc 'Data utilities for EacRailsBase0 instances.'
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ module Instances
8
+ module Runners
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWebappBase0
5
- VERSION = '0.3.1'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.35'
16
- s.add_dependency 'avm-eac_webapp_base0', '~> 0.3', '>= 0.3.1'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.97'
15
+ s.add_dependency 'avm', '~> 0.35', '>= 0.35.1'
16
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.4'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.98'
18
18
 
19
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
20
20
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/instances/entry_keys'
4
- require 'avm/eac_webapp_base0/instance'
4
+ require 'avm/eac_webapp_base0/instances/base'
5
5
 
6
6
  module Avm
7
7
  module EacWordpressBase0
8
8
  module Instances
9
- class Base < ::Avm::EacWebappBase0::Instance
9
+ class Base < ::Avm::EacWebappBase0::Instances::Base
10
10
  FILES_UNITS = { uploads: 'wp-content/uploads', themes: 'wp-content/themes' }.freeze
11
11
 
12
12
  def database_unit
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWordpressBase0
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
@@ -15,14 +15,14 @@ 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.14', '>= 0.14.1'
18
- s.add_dependency 'avm', '~> 0.35', '>= 0.35.1'
19
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.19'
18
+ s.add_dependency 'avm', '~> 0.37'
19
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.19', '>= 0.19.1'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
21
21
  s.add_dependency 'avm-files', '~> 0.3', '>= 0.3.2'
22
22
  s.add_dependency 'avm-git', '~> 0.4'
23
23
  s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
24
24
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
25
- s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.1'
25
+ s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.2'
26
26
  s.add_dependency 'eac_ruby_base0', '~> 0.16', '>= 0.16.6'
27
27
  s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.1'
28
28
  s.add_dependency 'git', '~> 1.11'