avm-tools 0.30.0 → 0.31.0

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: 0cfe97a7d0fe91a8c981753c6a1f54613eca1224a291b21f79fc40d599706dcb
4
- data.tar.gz: 24af1b76d95b1f49502a676c2530cae9796848b601e97c66f2c2c2ad799ca30f
3
+ metadata.gz: b16ebdd42a72fca522a1d9ee15607fd367205816b0120fae9335a4161c648d78
4
+ data.tar.gz: 97fa9f4fc23ca7a8f8f948e5bbbce607236995ffffc7c8c18e2c929371d24cef
5
5
  SHA512:
6
- metadata.gz: c703058938922ecb22415179574396eff2d2ab775d7a9b9d46293e27f9510ee7701eb2c72184d777e5e5b8b2a4620b3622bf86c0af6c7ea09158762458f1b660
7
- data.tar.gz: a42d70070a33d8452e02aac392864a62aae5d30c159ba93eb10bf0c24d5691ba9607a4994ea3b00ce45c8734ac257fe7d48605cf178e40e2f3c8619f8b9b04ce
6
+ metadata.gz: c2de01964e826aa3abd422adb772360d526b0b547ffa68c5bc16ce56e901d6272be6b4ed6c7a10f3a1dbe0af93c2f0b7dbb6379c66501aa144a11634f3dbccd9
7
+ data.tar.gz: 62ae835eb68eb1b780c8c801393fa1345cfd8c053ad79f2c8fe401fc8817226b08d330f1f1b7a66675560736781f19403ad79ebcd2dfcd811f6cbc9c10b52874
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
4
+
3
5
  module Avm
4
6
  module Instances
5
7
  class Base
@@ -15,7 +17,8 @@ module Avm
15
17
  DEFAULT_SYSTEM = 'postgresql'
16
18
 
17
19
  def auto_database_name
18
- inherited_entry_value(:'database.id', 'database.name') || id
20
+ inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID,
21
+ ::Avm::Instances::EntryKeys::DATABASE_NAME) || id
19
22
  end
20
23
 
21
24
  def auto_database_hostname
@@ -41,12 +44,13 @@ module Avm
41
44
  private
42
45
 
43
46
  def database_auto_common(suffix)
44
- inherited_entry_value('database.id', "database.#{suffix}") ||
45
- inherited_entry_value(:host_id, "database.#{suffix}")
47
+ database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
48
+ inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
49
+ inherited_entry_value(:host_id, database_key)
46
50
  end
47
51
 
48
52
  def database_port_by_system
49
- read_entry_optional('database.system').if_present do |v|
53
+ read_entry_optional(::Avm::Instances::EntryKeys::DATABASE_SYSTEM).if_present do |v|
50
54
  DEFAULT_PORTS.fetch(v)
51
55
  end
52
56
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'addressable'
4
+ require 'avm/instances/entry_keys'
4
5
 
5
6
  module Avm
6
7
  module Instances
@@ -34,7 +35,7 @@ module Avm
34
35
  private
35
36
 
36
37
  def web_url_as_uri
37
- read_entry_optional('web.url').if_present do |v|
38
+ read_entry_optional(::Avm::Instances::EntryKeys::WEB_URL).if_present do |v|
38
39
  yield(::Addressable::URI.parse(v))
39
40
  end
40
41
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Instances
5
+ module EntryKeys
6
+ {
7
+ database: %w[id hostname name password port system username],
8
+ web: %w[authority hostname path port scheme url userinfo]
9
+ }.each do |prefix, suffixes|
10
+ suffixes.each do |suffix|
11
+ key = "#{prefix}.#{suffix}"
12
+ const_set(key.gsub('.', '_').upcase, key)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/docopt_runner'
4
+ require 'eac_ruby_utils/require_sub'
5
+
6
+ module Avm
7
+ module Stereotypes
8
+ module EacWebappBase0
9
+ module Runner
10
+ class Data < ::EacRubyUtils::Console::DocoptRunner
11
+ ::EacRubyUtils.require_sub(__FILE__)
12
+
13
+ DOC = <<~DOCOPT
14
+ Data utilities for EacRailsBase0 instances.
15
+
16
+ Usage:
17
+ __PROGRAM__ __SUBCOMMANDS__
18
+ __PROGRAM__ -h | --help
19
+
20
+ Options:
21
+ -h --help Show this screen.
22
+ DOCOPT
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -9,7 +9,7 @@ module Avm
9
9
  module Stereotypes
10
10
  module EacWebappBase0
11
11
  module Runner
12
- module Data
12
+ class Data < ::EacRubyUtils::Console::DocoptRunner
13
13
  class Dump < ::EacRubyUtils::Console::DocoptRunner
14
14
  include ::EacRubyUtils::SimpleCache
15
15
  include ::EacRubyUtils::Console::Speaker
@@ -5,9 +5,9 @@ require 'eac_ruby_utils/console/speaker'
5
5
  require 'eac_ruby_utils/simple_cache'
6
6
 
7
7
  module Avm
8
- module Tools
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
10
- class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
8
+ module Stereotypes
9
+ module EacWebappBase0
10
+ module Runner
11
11
  class Data < ::EacRubyUtils::Console::DocoptRunner
12
12
  class Load < ::EacRubyUtils::Console::DocoptRunner
13
13
  include ::EacRubyUtils::SimpleCache
@@ -41,7 +41,7 @@ module Avm
41
41
  end
42
42
 
43
43
  def source_instance_dump_path
44
- ::Avm::Stereotypes::EacWordpressBase0::Instance.by_id(
44
+ context(:instance).class.by_id(
45
45
  options.fetch('--source-instance')
46
46
  ).data_dump
47
47
  end
@@ -49,7 +49,6 @@ module Avm
49
49
  def load_dump
50
50
  info "Loading dump \"#{dump_path}\"..."
51
51
  package_load.run
52
- #::EacRubyUtils::Envs.local.command('cat', dump_path).pipe(load_command).execute!
53
52
  end
54
53
 
55
54
  def dump_instance_method
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
3
4
  require 'avm/stereotypes/eac_webapp_base0/instance'
4
5
 
5
6
  module Avm
@@ -9,12 +10,12 @@ module Avm
9
10
  FILES_UNITS = { uploads: 'wp-content/uploads', themes: 'wp-content/themes' }.freeze
10
11
 
11
12
  def database_unit
12
- self_instance = self
13
+ web_url = read_entry(::Avm::Instances::EntryKeys::WEB_URL)
13
14
  super.after_load do
14
15
  info 'Fixing web addresses...'
15
16
  run_sql(<<~SQL)
16
17
  update wp_options
17
- set option_value = '#{self_instance.read_entry('url')}'
18
+ set option_value = '#{web_url}'
18
19
  where option_name in ('siteurl', 'home')
19
20
  SQL
20
21
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/instances/entry_keys'
3
4
  require 'avm/stereotypes/postgresql/instance'
4
5
 
5
6
  module Avm
@@ -8,8 +9,9 @@ module Avm
8
9
  module InstanceWith
9
10
  def pg
10
11
  @pg ||= ::Avm::Stereotypes::Postgresql::Instance.new(
11
- host_env, user: read_entry('database.user'), password: read_entry('database.password'),
12
- name: read_entry('database.name')
12
+ host_env, user: read_entry(::Avm::Instances::EntryKeys::DATABASE_USERNAME),
13
+ password: read_entry(::Avm::Instances::EntryKeys::DATABASE_PASSWORD),
14
+ name: read_entry(::Avm::Instances::EntryKeys::DATABASE_NAME)
13
15
  )
14
16
  end
15
17
  end
@@ -1,25 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/stereotypes/eac_webapp_base0/runner/data'
3
4
  require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/require_sub'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
9
9
  class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Data < ::EacRubyUtils::Console::DocoptRunner
11
- ::EacRubyUtils.require_sub(__FILE__)
12
-
13
- DOC = <<~DOCOPT
14
- Data utilities for EacRailsBase0 instances.
15
-
16
- Usage:
17
- __PROGRAM__ __SUBCOMMANDS__
18
- __PROGRAM__ -h | --help
19
-
20
- Options:
21
- -h --help Show this screen.
22
- DOCOPT
10
+ class Data < ::Avm::Stereotypes::EacWebappBase0::Runner::Data
23
11
  end
24
12
  end
25
13
  end
@@ -1,24 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/stereotypes/eac_webapp_base0/runner/data'
3
4
  require 'eac_ruby_utils/console/docopt_runner'
4
- require 'avm/tools/runner/eac_wordpress_base0/data/dump'
5
- require 'avm/tools/runner/eac_wordpress_base0/data/load'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner < ::EacRubyUtils::Console::DocoptRunner
10
9
  class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
11
- class Data < ::EacRubyUtils::Console::DocoptRunner
12
- DOC = <<~DOCOPT
13
- Data utilities for EacWordpressBase0 instances.
14
-
15
- Usage:
16
- __PROGRAM__ __SUBCOMMANDS__
17
- __PROGRAM__ -h | --help
18
-
19
- Options:
20
- -h --help Show this screen.
21
- DOCOPT
10
+ class Data < ::Avm::Stereotypes::EacWebappBase0::Runner::Data
22
11
  end
23
12
  end
24
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.30.0'
5
+ VERSION = '0.31.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
@@ -220,6 +220,7 @@ files:
220
220
  - lib/avm/instances/base/dockerizable.rb
221
221
  - lib/avm/instances/entries.rb
222
222
  - lib/avm/instances/entries/entry_reader.rb
223
+ - lib/avm/instances/entry_keys.rb
223
224
  - lib/avm/patches.rb
224
225
  - lib/avm/patches/eac_launcher_git_base.rb
225
226
  - lib/avm/patches/object/template.rb
@@ -247,7 +248,9 @@ files:
247
248
  - lib/avm/stereotypes/eac_webapp_base0/deploy/_appended_directories.rb
248
249
  - lib/avm/stereotypes/eac_webapp_base0/deploy/file_unit.rb
249
250
  - lib/avm/stereotypes/eac_webapp_base0/instance.rb
251
+ - lib/avm/stereotypes/eac_webapp_base0/runner/data.rb
250
252
  - lib/avm/stereotypes/eac_webapp_base0/runner/data/dump.rb
253
+ - lib/avm/stereotypes/eac_webapp_base0/runner/data/load.rb
251
254
  - lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb
252
255
  - lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
253
256
  - lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
@@ -263,7 +266,6 @@ files:
263
266
  - lib/avm/tools/runner/eac_rails_base0.rb
264
267
  - lib/avm/tools/runner/eac_rails_base0/apache_host.rb
265
268
  - lib/avm/tools/runner/eac_rails_base0/data.rb
266
- - lib/avm/tools/runner/eac_rails_base0/data/dump.rb
267
269
  - lib/avm/tools/runner/eac_rails_base0/deploy.rb
268
270
  - lib/avm/tools/runner/eac_redmine_base0.rb
269
271
  - lib/avm/tools/runner/eac_redmine_base0/bundle.rb
@@ -272,8 +274,6 @@ files:
272
274
  - lib/avm/tools/runner/eac_wordpress_base0.rb
273
275
  - lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb
274
276
  - lib/avm/tools/runner/eac_wordpress_base0/data.rb
275
- - lib/avm/tools/runner/eac_wordpress_base0/data/dump.rb
276
- - lib/avm/tools/runner/eac_wordpress_base0/data/load.rb
277
277
  - lib/avm/tools/runner/eac_wordpress_base0/deploy.rb
278
278
  - lib/avm/tools/runner/files.rb
279
279
  - lib/avm/tools/runner/files/rotate.rb
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'avm/stereotypes/eac_webapp_base0/runner/data/dump'
5
-
6
- module Avm
7
- module Tools
8
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
- class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Data < ::EacRubyUtils::Console::DocoptRunner
11
- class Dump < ::Avm::Stereotypes::EacWebappBase0::Runner::Data::Dump
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'avm/stereotypes/eac_webapp_base0/runner/data/dump'
5
-
6
- module Avm
7
- module Tools
8
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
- class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
10
- class Data < ::EacRubyUtils::Console::DocoptRunner
11
- class Dump < ::Avm::Stereotypes::EacWebappBase0::Runner::Data::Dump
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end