eac_tools 0.86.3 → 0.86.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -27
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -1
- data/sub/avm/lib/avm/scms/base.rb +5 -0
- data/sub/avm/lib/avm/sources/base.rb +5 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/{avm-tools → avm}/spec/lib/avm/launcher/context_spec.rb +7 -7
- data/sub/avm/spec/spec_helper/eac_launcher/settings.yml +6 -0
- data/sub/avm/spec/spec_helper.rb +1 -0
- data/sub/avm-git/avm-git.gemspec +3 -1
- data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +0 -7
- data/sub/avm-git/lib/avm/git/issue/complete.rb +9 -6
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/commit.rb +3 -3
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/deploy.rb +3 -3
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/dirty_files.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/organize.rb +3 -3
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/revisions_test.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/subrepo/check.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/subrepo/clone.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/subrepo/fix.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git → avm-git/lib/avm/git/runners/base}/subrepo.rb +4 -4
- data/sub/{avm-tools/lib/avm/tools/runner/git.rb → avm-git/lib/avm/git/runners/base.rb} +11 -4
- data/sub/{avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0.rb → avm-git/lib/avm/git/runners.rb} +4 -2
- data/sub/avm-git/lib/avm/git/scms/git.rb +7 -0
- data/sub/avm-git/lib/avm/git/version.rb +1 -1
- data/sub/{avm-tools → avm-git}/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec.rb +4 -4
- data/sub/{avm-tools/spec/lib/avm/tools/runner/git → avm-git/spec/lib/avm/git/runners/base}/deploy_spec.rb +20 -20
- data/sub/avm-git/spec/spec_helper/eac_launcher.rb +50 -0
- data/sub/avm-git/spec/spec_helper.rb +2 -1
- data/sub/avm-tools/avm-tools.gemspec +3 -12
- data/sub/avm-tools/lib/avm/tools/runner/files/format.rb +8 -8
- data/sub/avm-tools/lib/avm/tools/runner/source/issue/complete.rb +13 -7
- data/sub/avm-tools/lib/avm/tools/runner/source/issue.rb +1 -1
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/avm-tools/lib/avm/tools.rb +3 -2
- data/sub/avm-tools/spec/spec_helper.rb +0 -3
- metadata +46 -54
- data/sub/avm-eac_postgresql_base0/Gemfile +0 -8
- data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +0 -20
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/assert.rb +0 -77
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/commands.rb +0 -79
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +0 -65
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +0 -49
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance_with.rb +0 -25
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +0 -7
- data/sub/avm-eac_postgresql_base0/spec/rubocop_spec.rb +0 -3
- data/sub/avm-eac_postgresql_base0/spec/spec_helper.rb +0 -4
- /data/sub/{avm-tools → avm}/spec/dummy/avm-tools_stub/avm-tools.gemspec +0 -0
- /data/sub/{avm-tools → avm}/spec/dummy/avm-tools_stub/lib/avm/tools/version.rb +0 -0
- /data/sub/{avm-tools → avm}/spec/dummy/avm-tools_stub/lib/avm/tools.rb +0 -0
- /data/sub/{avm-tools → avm}/spec/dummy/ruby_gem_stub/lib/ruby_gem_stub/version.rb +0 -0
- /data/sub/{avm-tools → avm}/spec/dummy/ruby_gem_stub/lib/ruby_gem_stub.rb +0 -0
- /data/sub/{avm-tools → avm}/spec/dummy/ruby_gem_stub/ruby_gem_stub.gemspec +0 -0
- /data/sub/{avm-tools → avm}/spec/lib/avm/launcher/context_spec.yml +0 -0
- /data/sub/{avm-tools → avm}/spec/spec_helper/eac_launcher.rb +0 -0
- /data/sub/{avm-tools → avm}/template/avm/self/docker_image/Dockerfile +0 -0
- /data/sub/{avm-tools → avm}/template/avm/self/docker_image/entrypoint.sh +0 -0
- /data/sub/{avm-tools → avm-git}/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_settings.yml +0 -0
- /data/sub/{avm-tools → avm-git}/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec.rb +0 -0
- /data/sub/{avm-tools → avm-git}/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_settings.yml +0 -0
- /data/sub/{avm-tools/spec/lib/avm/tools/runner/git → avm-git/spec/lib/avm/git/runners/base}/deploy_spec_files/append1/stub3.txt.template +0 -0
- /data/sub/{avm-tools/spec/lib/avm/tools/runner/git → avm-git/spec/lib/avm/git/runners/base}/deploy_spec_files/append2/stub4.txt +0 -0
- /data/sub/{avm-tools → avm-git}/spec/spec_helper/eac_launcher/settings.yml +0 -0
@@ -1,79 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/eac_postgresql_base0/instance/data_unit'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module EacPostgresqlBase0
|
8
|
-
class Instance
|
9
|
-
module Commands
|
10
|
-
DUMP_EXCLUDE_PATTERNS = ['(CREATE|COMMENT ON) EXTENSION',
|
11
|
-
'SET default_table_access_method'].freeze
|
12
|
-
|
13
|
-
# @return [EacRubyUtils::Envs::Command]
|
14
|
-
def dump_command
|
15
|
-
DUMP_EXCLUDE_PATTERNS
|
16
|
-
.inject(pg_dump_command) { |a, e| a.pipe(exclude_pattern_command(e)) }
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [EacRubyUtils::Envs::Command]
|
20
|
-
def dump_gzip_command
|
21
|
-
dump_command.pipe(gzip_compress_command)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [EacRubyUtils::Envs::Command]
|
25
|
-
def gzip_compress_command
|
26
|
-
env.command('gzip', '-9', '-c')
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [EacRubyUtils::Envs::Command]
|
30
|
-
def gzip_decompress_command
|
31
|
-
env.command('gzip', '-d')
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [EacRubyUtils::Envs::Command]
|
35
|
-
def load_gzip_command
|
36
|
-
gzip_decompress_command.pipe(psql_command)
|
37
|
-
end
|
38
|
-
|
39
|
-
# @return [String]
|
40
|
-
def password_command_argument
|
41
|
-
"@ESC_PGPASSWORD=#{password}"
|
42
|
-
end
|
43
|
-
|
44
|
-
def psql_command(database = true) # rubocop:disable Style/OptionalBooleanParameter
|
45
|
-
env.command(password_command_argument, 'psql', '--variable', 'ON_ERROR_STOP=t',
|
46
|
-
*common_command_args(database))
|
47
|
-
end
|
48
|
-
|
49
|
-
def psql_command_command(sql, database = true) # rubocop:disable Style/OptionalBooleanParameter
|
50
|
-
psql_command(database).append(['--quiet', '--tuples-only', '--command', sql])
|
51
|
-
end
|
52
|
-
|
53
|
-
def root_psql_command(sql = nil)
|
54
|
-
args = ['sudo', '-u', 'postgres', 'psql']
|
55
|
-
args += ['--quiet', '--tuples-only', '--command', sql] if sql.present?
|
56
|
-
env.command(*args)
|
57
|
-
end
|
58
|
-
|
59
|
-
def common_command_args(database = true) # rubocop:disable Style/OptionalBooleanParameter
|
60
|
-
['--host', host, '--username', user, '--port', port,
|
61
|
-
(database ? name : MAINTENANCE_DATABASE)]
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
# @return [EacRubyUtils::Envs::Command]
|
67
|
-
def exclude_pattern_command(pattern)
|
68
|
-
env.command('sed', '--regexp-extended', "s/(^|\\n)#{pattern}[^;]*;//gm")
|
69
|
-
end
|
70
|
-
|
71
|
-
# @return [EacRubyUtils::Envs::Command]
|
72
|
-
def pg_dump_command
|
73
|
-
env.command('pg_dump', '--no-privileges', '--no-owner', *common_command_args)
|
74
|
-
.envvar('PGPASSWORD', password)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/instances/data/unit'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module EacPostgresqlBase0
|
7
|
-
class Instance
|
8
|
-
class DataUnit < ::Avm::Instances::Data::Unit
|
9
|
-
EXTENSION = '.pgdump.gz'
|
10
|
-
SCHEMA_VAR = '%%SCHEMA%%'
|
11
|
-
TABLE_PARTS_SEPARATOR = '/'
|
12
|
-
TABLES_SQL = "select schemaname || '#{TABLE_PARTS_SEPARATOR}' || tablename from " \
|
13
|
-
"pg_tables where schemaname = '#{SCHEMA_VAR}'"
|
14
|
-
|
15
|
-
def do_clear
|
16
|
-
ts = tables
|
17
|
-
if ts.empty?
|
18
|
-
info 'Database has no tables'
|
19
|
-
else
|
20
|
-
info "Removing #{ts.count} table(s)..."
|
21
|
-
run_sql(drop_tables_sql(ts))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def dump_command
|
26
|
-
instance.pg.dump_gzip_command
|
27
|
-
end
|
28
|
-
|
29
|
-
def load_command
|
30
|
-
instance.pg.load_gzip_command
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
# @param table_list [Array<String>]
|
36
|
-
# @return [String]
|
37
|
-
def drop_tables_sql(table_list)
|
38
|
-
"drop table #{table_list.map(&:to_s).join(', ')} cascade"
|
39
|
-
end
|
40
|
-
|
41
|
-
# @param parts [Array<String>, Strings]
|
42
|
-
# @return [String]
|
43
|
-
def join_table_parts(parts)
|
44
|
-
parts = parts.to_s.split(TABLE_PARTS_SEPARATOR) unless parts.is_a?(::Enumerable)
|
45
|
-
parts.map { |p| "\"#{p}\"" }.join('.')
|
46
|
-
end
|
47
|
-
|
48
|
-
def run_sql(sql)
|
49
|
-
instance.pg.psql_command_command(sql).execute!
|
50
|
-
end
|
51
|
-
|
52
|
-
# @return [Array<String>]
|
53
|
-
def tables
|
54
|
-
run_sql(tables_sql).each_line.map(&:strip).compact_blank
|
55
|
-
.map { |line| join_table_parts(line) }
|
56
|
-
end
|
57
|
-
|
58
|
-
# @return [String]
|
59
|
-
def tables_sql
|
60
|
-
TABLES_SQL.gsub(SCHEMA_VAR, instance.pg.schema)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/eac_postgresql_base0/instance/data_unit'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module EacPostgresqlBase0
|
8
|
-
class Instance
|
9
|
-
require_sub __FILE__, include_modules: true
|
10
|
-
|
11
|
-
DEFAULT_HOSTNAME = '127.0.0.1'
|
12
|
-
DEFAULT_PORT = 5432
|
13
|
-
DEFAULT_SCHEMA = 'public'
|
14
|
-
MAINTENANCE_DATABASE = 'postgres'
|
15
|
-
|
16
|
-
common_constructor :env, :connection_params do
|
17
|
-
self.connection_params = connection_params.with_indifferent_access
|
18
|
-
end
|
19
|
-
|
20
|
-
def assert
|
21
|
-
::Avm::EacPostgresqlBase0::Instance::Assert.new(self).perform
|
22
|
-
end
|
23
|
-
|
24
|
-
def host
|
25
|
-
connection_params[:host] || DEFAULT_HOSTNAME
|
26
|
-
end
|
27
|
-
|
28
|
-
def port
|
29
|
-
connection_params[:port] || DEFAULT_PORT
|
30
|
-
end
|
31
|
-
|
32
|
-
def user
|
33
|
-
connection_params.fetch(:user)
|
34
|
-
end
|
35
|
-
|
36
|
-
def password
|
37
|
-
connection_params.fetch(:password)
|
38
|
-
end
|
39
|
-
|
40
|
-
def name
|
41
|
-
connection_params.fetch(:name)
|
42
|
-
end
|
43
|
-
|
44
|
-
def schema
|
45
|
-
connection_params[:schema] || DEFAULT_SCHEMA
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/instances/entry_keys'
|
4
|
-
require 'avm/eac_postgresql_base0/instance'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module EacPostgresqlBase0
|
8
|
-
module InstanceWith
|
9
|
-
def pg
|
10
|
-
@pg ||= ::Avm::EacPostgresqlBase0::Instance.new(
|
11
|
-
host_env, host: database_hostname,
|
12
|
-
port: database_port,
|
13
|
-
user: database_username,
|
14
|
-
password: database_password,
|
15
|
-
name: database_name
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [Avm::EacPostgresqlBase0::Instance::DataUnit]
|
20
|
-
def pg_data_unit
|
21
|
-
::Avm::EacPostgresqlBase0::Instance::DataUnit.new(self)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/sub/{avm-tools → avm-git}/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|