avm-tools 0.6.0 → 0.7.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: fcc3538fb91268f5d84ef2239fad15bfac0539e190604d58a0e9582282d0e23b
4
- data.tar.gz: 90263e1d8ef603f2f0d1b5ad26f2cdc272e9761533dd56a0c144659ab5cb762f
3
+ metadata.gz: 25b95f597939c9cbdc8e67d9a3d68f4edcb184197607c7ffdbe66a6713e5f2d2
4
+ data.tar.gz: 29a1f0c7bfe1f945db68bd2fba973bacd58d12b82551bc85e6922fad5206c80c
5
5
  SHA512:
6
- metadata.gz: 3f5ddafb0c5f8aec71859bf29a29dfc4ad2f45f77698c27c579b12c423e772b9236f843d877b973f8569c0257a002aae34c01c4dc50702e461d821876dd649c2
7
- data.tar.gz: 125edbfe26fa8a367efbcba55c31bef29e3b45e5ccdf0da0dc84a2db365bd6798301a67b702dcd590b5e6983122be0004a03173e3da9046869f1315cdeebc336
6
+ metadata.gz: 4c86b25b35d775fde5b9c82ee4d963f9d185e27d846f5e7e81e4f016774eadbe0fcf3ddf6628dd8db76276be8809938355968b15609ffd25e3778011ce3c7b42
7
+ data.tar.gz: a1bc826968c160a28c8d63424139fd2e3e326a99a3568c35d765b6c0d0ac6f7ffd661f3db1a3a9383863ec2cc10765478624981502f2f7a4ea4ee43699508b56
@@ -8,6 +8,15 @@ module Avm
8
8
  module EacWordpressBase0
9
9
  class Instance < ::Avm::Instances::Base
10
10
  include ::Avm::Stereotypes::Postgresql::InstanceWith
11
+
12
+ def data_dump(argv = [])
13
+ run_subcommand(::Avm::Tools::Runner::EacWordpressBase0::Data::Dump, argv)
14
+ end
15
+
16
+ def run_subcommand(subcommand_class, argv)
17
+ parent = ::OpenStruct.new(instance: self)
18
+ subcommand_class.new(argv: argv, parent: parent).run
19
+ end
11
20
  end
12
21
  end
13
22
  end
@@ -37,6 +37,7 @@ module Avm
37
37
  warn(format(NO_DUMP_MESSAGE, dump_path))
38
38
  end
39
39
  success("Dump path: \"#{dump_path}\"")
40
+ dump_path
40
41
  end
41
42
 
42
43
  private
@@ -17,7 +17,12 @@ module Avm
17
17
  Load utility for EacRailsBase instance.
18
18
 
19
19
  Usage:
20
- __PROGRAM__ <dump-path>
20
+ __PROGRAM__ (<dump-path>|--source-instance=<source-instance>)
21
+ __PROGRAM__ -h | --help
22
+
23
+ Options:
24
+ -h --help Show this screen.
25
+ -S --source-instance=<source-instance> Informa a instância a ser extraída o dump.
21
26
  DOCUMENT
22
27
 
23
28
  def run
@@ -26,11 +31,21 @@ module Avm
26
31
 
27
32
  before_load
28
33
  load_dump
34
+ fix_web_addresses
29
35
  success("Dump loaded from \"#{dump_path}\"")
30
36
  end
31
37
 
32
38
  def dump_path_uncached
33
- options.fetch('<dump-path>').to_s
39
+ return options.fetch('<dump-path>').to_s if options.fetch('<dump-path>').present?
40
+ return source_instance_dump_path if options.fetch('--source-instance').present?
41
+
42
+ raise "Dump path unknown (Options: #{options})"
43
+ end
44
+
45
+ def source_instance_dump_path
46
+ ::Avm::Stereotypes::EacWordpressBase0::Instance.by_id(
47
+ options.fetch('--source-instance')
48
+ ).data_dump
34
49
  end
35
50
 
36
51
  def load_dump
@@ -60,6 +75,15 @@ module Avm
60
75
  def load_command
61
76
  context(:instance).pg.psql_command.prepend(['gzip', '-d', '@ESC_|'])
62
77
  end
78
+
79
+ def fix_web_addresses
80
+ info 'Fixing web addresses...'
81
+ run_sql(<<~SQL)
82
+ update wp_options
83
+ set option_value = '#{context(:instance).read_entry('url')}'
84
+ where option_name in ('siteurl', 'home')
85
+ SQL
86
+ end
63
87
  end
64
88
  end
65
89
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_launcher