avm-tools 0.3.0 → 0.4.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcd2489e79afff9fd8e2473e480008147176e85070d6a7dc92f027fbf90ef3d
|
4
|
+
data.tar.gz: 407dceebca4bc87475bc021eeff317e0c25e7a56539db3ca8b81945197ecdecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 421bd354a68bb427077c50265c2e62a805e2dc256b7eb48ee440873a5a4289042a9fff2e6c5f30d1726a1e64fd3d29a7d4c7bc0530ee19eeca727083a0a1fad2
|
7
|
+
data.tar.gz: a5d9c7a087a3e1c59dea4aebe05d658a9033b4f871b3e929345ab809a63666c43412f9f6f36d31e3abba3cb4586c1da243695eeae8bdc77bd48d02e0e951bc19
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/numeric/time'
|
4
|
+
require 'eac_ruby_utils/console/speaker'
|
5
|
+
require 'eac_ruby_utils/simple_cache'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class EacWordpressBase0 < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Data < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class Load < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
include ::EacRubyUtils::SimpleCache
|
14
|
+
include ::EacRubyUtils::Console::Speaker
|
15
|
+
|
16
|
+
DOC = <<~DOCUMENT
|
17
|
+
Load utility for EacRailsBase instance.
|
18
|
+
|
19
|
+
Usage:
|
20
|
+
__PROGRAM__ <dump-path>
|
21
|
+
DOCUMENT
|
22
|
+
|
23
|
+
def run
|
24
|
+
return ::Dev::Result.error("Dump \"#{dump_path}\" does not exist") unless
|
25
|
+
::File.exist?(dump_path)
|
26
|
+
|
27
|
+
before_load
|
28
|
+
load_dump
|
29
|
+
success("Dump loaded from \"#{dump_path}\"")
|
30
|
+
end
|
31
|
+
|
32
|
+
def dump_path_uncached
|
33
|
+
options.fetch('<dump-path>').to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
def load_dump
|
37
|
+
info "Loading dump \"#{dump_path}\"..."
|
38
|
+
::EacRubyUtils::Envs.local.command('cat', dump_path).pipe(load_command).execute!
|
39
|
+
end
|
40
|
+
|
41
|
+
def dump_instance_method
|
42
|
+
:dump_database
|
43
|
+
end
|
44
|
+
|
45
|
+
def before_load
|
46
|
+
info 'Clearing database (Dropping all tables)...'
|
47
|
+
sql = run_sql(drop_all_tables_sql)
|
48
|
+
run_sql(sql) if sql.present?
|
49
|
+
end
|
50
|
+
|
51
|
+
def drop_all_tables_sql
|
52
|
+
"select 'drop table \"' || tablename || '\" cascade;' from pg_tables " \
|
53
|
+
"where schemaname = 'public';"
|
54
|
+
end
|
55
|
+
|
56
|
+
def run_sql(sql)
|
57
|
+
context(:instance).pg.psql_command_command(sql).execute!
|
58
|
+
end
|
59
|
+
|
60
|
+
def load_command
|
61
|
+
context(:instance).pg.psql_command.prepend(['gzip', '-d', '@ESC_|'])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/avm/tools/runner/eac_wordpress_base0.rb
|
116
116
|
- lib/avm/tools/runner/eac_wordpress_base0/data.rb
|
117
117
|
- lib/avm/tools/runner/eac_wordpress_base0/data/dump.rb
|
118
|
+
- lib/avm/tools/runner/eac_wordpress_base0/data/load.rb
|
118
119
|
- lib/avm/tools/runner/files.rb
|
119
120
|
- lib/avm/tools/runner/files/rotate.rb
|
120
121
|
- lib/avm/tools/runner/git.rb
|