avm-eac_postgresql_base0 0.5.2 → 0.6.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: 482f1f478319ae175f57604f3b227e9e69cbefd2552284cb78ee1b27a8927c1e
4
- data.tar.gz: f5060713798f4b42ca597856f60a7860decec95b6bbc7c2175b53a78173c0a64
3
+ metadata.gz: 30d9adec0df407334be0ce013c4f23e3d6b8869f60ea5a93ccce0de95f3a3ed2
4
+ data.tar.gz: 10ea286adcc5921d581185248f22c035c63c8c4ec50af9d3a29e22d72354a81f
5
5
  SHA512:
6
- metadata.gz: 462dba98f08f83a8380a6a7f11885df477aa91e5a143407e1feecb20ec480a01a53337c6adcc028aec12f734ab7b5fb5a725432d9a879f647f6f04ca5286c965
7
- data.tar.gz: a89df87b96697f7337cbdd9f0456116bc06f8f08651a928f18cff2f5b1bc82d2dd92ba00468ee932824b3553ea8ba4a753eb774195ce80540b992f43d31964d3
6
+ metadata.gz: 451a03834485483067fd8a938f19475d65a660b0f3e85482c08b6d263632c39ad7133db293acd715b72a30682d5b0c71b6394cf93fee339c7e3b1e8e01edaa43
7
+ data.tar.gz: 59e223d228d3f1a00a0719d7de8f8dd95e815c43ff10486fe3510f7f4c618b3925fd162f090c9df931a5d04222b511002fb22705c1d7632fa94d1ffd5ed840a3
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module Avm
6
4
  module EacPostgresqlBase0
7
5
  class Instance
@@ -29,7 +27,7 @@ module Avm
29
27
  end
30
28
 
31
29
  def current_owner
32
- root_query(<<~SQL
30
+ root_query(<<~SQL.squish
33
31
  SELECT pg_catalog.pg_get_userbyid(datdba)
34
32
  FROM pg_catalog.pg_database
35
33
  WHERE datname = '#{name}'
@@ -43,7 +41,7 @@ module Avm
43
41
 
44
42
  def password_ok?
45
43
  instance.psql_command_command('SELECT 1', false)
46
- .execute!(exit_outputs: { 512 => 'login_failed' }).strip == '1'
44
+ .execute!(exit_outputs: { 512 => 'login_failed' }).strip == '1'
47
45
  end
48
46
 
49
47
  def user_exist?
@@ -60,7 +58,7 @@ module Avm
60
58
 
61
59
  private
62
60
 
63
- def root_boolean_query(sql_after_projection)
61
+ def root_boolean_query(sql_after_projection) # rubocop:disable Naming/PredicateMethod
64
62
  root_query("SELECT 1 #{sql_after_projection}") == '1'
65
63
  end
66
64
 
@@ -1,39 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_postgresql_base0/instance/data_unit'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module Avm
7
4
  module EacPostgresqlBase0
8
5
  class Instance
9
6
  module Commands
10
- DUMP_EXCLUDE_PATTERNS = ['(CREATE|COMMENT ON) EXTENSION',
11
- 'SET default_table_access_method'].freeze
12
-
13
7
  # @return [EacRubyUtils::Envs::Command]
14
8
  def dump_command
15
- DUMP_EXCLUDE_PATTERNS
16
- .inject(pg_dump_command) { |a, e| a.pipe(exclude_pattern_command(e)) }
9
+ pg_dump_command
17
10
  end
18
11
 
19
12
  # @return [EacRubyUtils::Envs::Command]
20
13
  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')
14
+ dump_command
32
15
  end
33
16
 
34
17
  # @return [EacRubyUtils::Envs::Command]
35
18
  def load_gzip_command
36
- gzip_decompress_command.pipe(psql_command)
19
+ pg_restore_command
37
20
  end
38
21
 
39
22
  # @return [String]
@@ -41,12 +24,12 @@ module Avm
41
24
  "@ESC_PGPASSWORD=#{password}"
42
25
  end
43
26
 
44
- def psql_command(database = true)
27
+ def psql_command(database = true) # rubocop:disable Style/OptionalBooleanParameter
45
28
  env.command(password_command_argument, 'psql', '--variable', 'ON_ERROR_STOP=t',
46
29
  *common_command_args(database))
47
30
  end
48
31
 
49
- def psql_command_command(sql, database = true)
32
+ def psql_command_command(sql, database = true) # rubocop:disable Style/OptionalBooleanParameter
50
33
  psql_command(database).append(['--quiet', '--tuples-only', '--command', sql])
51
34
  end
52
35
 
@@ -56,22 +39,30 @@ module Avm
56
39
  env.command(*args)
57
40
  end
58
41
 
59
- def common_command_args(database = true)
60
- ['--host', host, '--username', user, '--port', port,
61
- (database ? name : MAINTENANCE_DATABASE)]
42
+ def common_command_args(database = true) # rubocop:disable Style/OptionalBooleanParameter
43
+ ['--host', host, '--username', user, '--port', port] + database_args(database)
62
44
  end
63
45
 
64
46
  private
65
47
 
66
- # @return [EacRubyUtils::Envs::Command]
67
- def exclude_pattern_command(pattern)
68
- env.command('sed', '--regexp-extended', "s/(^|\\n)#{pattern}[^;]*;//gm")
48
+ # @param database [Boolean, String]
49
+ # @return [String]
50
+ def database_args(database)
51
+ return [database, name] if database.is_a?(String)
52
+
53
+ [database ? name : MAINTENANCE_DATABASE]
69
54
  end
70
55
 
71
56
  # @return [EacRubyUtils::Envs::Command]
72
57
  def pg_dump_command
73
- env.command('pg_dump', '--no-privileges', '--no-owner', *common_command_args)
74
- .envvar('PGPASSWORD', password)
58
+ env.command('pg_dump', '--no-privileges', '--no-owner', '--format=custom',
59
+ *common_command_args).envvar('PGPASSWORD', password)
60
+ end
61
+
62
+ # @return [EacRubyUtils::Envs::Command]
63
+ def pg_restore_command
64
+ env.command('pg_restore', '--exit-on-error', '--no-owner', '--no-comments',
65
+ *common_command_args('--dbname')).envvar('PGPASSWORD', password)
75
66
  end
76
67
  end
77
68
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/data/unit'
4
-
5
3
  module Avm
6
4
  module EacPostgresqlBase0
7
5
  class Instance
@@ -10,7 +8,7 @@ module Avm
10
8
  SCHEMA_VAR = '%%SCHEMA%%'
11
9
  TABLE_PARTS_SEPARATOR = '/'
12
10
  TABLES_SQL = "select schemaname || '#{TABLE_PARTS_SEPARATOR}' || tablename from " \
13
- "pg_tables where schemaname = '#{SCHEMA_VAR}'"
11
+ "pg_tables where schemaname = '#{SCHEMA_VAR}'"
14
12
 
15
13
  def do_clear
16
14
  ts = tables
@@ -35,7 +33,7 @@ module Avm
35
33
  # @param table_list [Array<String>]
36
34
  # @return [String]
37
35
  def drop_tables_sql(table_list)
38
- 'drop table ' + table_list.map(&:to_s).join(', ') + ' cascade'
36
+ "drop table #{table_list.map(&:to_s).join(', ')} cascade"
39
37
  end
40
38
 
41
39
  # @param parts [Array<String>, Strings]
@@ -51,8 +49,8 @@ module Avm
51
49
 
52
50
  # @return [Array<String>]
53
51
  def tables
54
- run_sql(tables_sql).each_line.map(&:strip).reject(&:blank?)
55
- .map { |line| join_table_parts(line) }
52
+ run_sql(tables_sql).each_line.map(&:strip).compact_blank
53
+ .map { |line| join_table_parts(line) }
56
54
  end
57
55
 
58
56
  # @return [String]
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_postgresql_base0/instance/data_unit'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module Avm
7
4
  module EacPostgresqlBase0
8
5
  class Instance
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/entry_keys'
4
- require 'avm/eac_postgresql_base0/instance'
5
-
6
3
  module Avm
7
4
  module EacPostgresqlBase0
8
5
  module InstanceWith
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.5.2'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_ruby_utils'
4
+ EacRubyUtils::RootModuleSetup.perform __FILE__
4
5
 
5
6
  module Avm
6
7
  module EacPostgresqlBase0
7
- require_sub __FILE__
8
8
  end
9
9
  end
10
+
11
+ require 'avm'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_postgresql_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-19 00:00:00.000000000 Z
11
+ date: 2026-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,50 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.79'
19
+ version: '0.98'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.98.4
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '0.79'
29
+ version: '0.98'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.98.4
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: eac_ruby_utils
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0.119'
39
+ version: '0.129'
34
40
  - - ">="
35
41
  - !ruby/object:Gem::Version
36
- version: 0.119.1
42
+ version: 0.129.1
37
43
  type: :runtime
38
44
  prerelease: false
39
45
  version_requirements: !ruby/object:Gem::Requirement
40
46
  requirements:
41
47
  - - "~>"
42
48
  - !ruby/object:Gem::Version
43
- version: '0.119'
49
+ version: '0.129'
44
50
  - - ">="
45
51
  - !ruby/object:Gem::Version
46
- version: 0.119.1
52
+ version: 0.129.1
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: eac_ruby_gem_support
49
55
  requirement: !ruby/object:Gem::Requirement
50
56
  requirements:
51
57
  - - "~>"
52
58
  - !ruby/object:Gem::Version
53
- version: 0.5.1
59
+ version: '0.12'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.12.1
54
63
  type: :development
55
64
  prerelease: false
56
65
  version_requirements: !ruby/object:Gem::Requirement
57
66
  requirements:
58
67
  - - "~>"
59
68
  - !ruby/object:Gem::Version
60
- version: 0.5.1
61
- description:
62
- email:
69
+ version: '0.12'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.12.1
73
+ description:
74
+ email:
63
75
  executables: []
64
76
  extensions: []
65
77
  extra_rdoc_files: []
@@ -71,10 +83,10 @@ files:
71
83
  - lib/avm/eac_postgresql_base0/instance/data_unit.rb
72
84
  - lib/avm/eac_postgresql_base0/instance_with.rb
73
85
  - lib/avm/eac_postgresql_base0/version.rb
74
- homepage:
86
+ homepage:
75
87
  licenses: []
76
88
  metadata: {}
77
- post_install_message:
89
+ post_install_message:
78
90
  rdoc_options: []
79
91
  require_paths:
80
92
  - lib
@@ -82,15 +94,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
94
  requirements:
83
95
  - - ">="
84
96
  - !ruby/object:Gem::Version
85
- version: '0'
97
+ version: '2.7'
86
98
  required_rubygems_version: !ruby/object:Gem::Requirement
87
99
  requirements:
88
100
  - - ">="
89
101
  - !ruby/object:Gem::Version
90
102
  version: '0'
91
103
  requirements: []
92
- rubygems_version: 3.1.6
93
- signing_key:
104
+ rubygems_version: 3.4.19
105
+ signing_key:
94
106
  specification_version: 4
95
107
  summary: Put here de description.
96
108
  test_files: []