remote_database_importer 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +60 -41
- data/lib/remote_database_importer/operation.rb +5 -5
- data/lib/remote_database_importer/version.rb +1 -1
- data/remote_database_importer.gemspec +34 -0
- metadata +7 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9326e0cda0a7b8e678c0b295c7cf832003fb7f8ce20cf4d0c54aa50971ba7644
|
|
4
|
+
data.tar.gz: a65791d2d7757ce1cf9b1b9da4b9bf48b1f5455b9e7ba6ccd1e3207cadf6f00f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef95e2381637966692792848bf4f4f64c6eebe726a6c9588dd4d767b975d5c737aaefd25194a771f40e9b451f23f09a1efcca0e458526902aad5208b9cbca013
|
|
7
|
+
data.tar.gz: 91b80d7b5174af2ad34741d93d32c97206872c52f808d2cd7c02630314bf22fd66812e6600a26730defb0cd3544deb0cf3e55b099863a3f864e46cf6412b4148
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -5,8 +5,8 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in remote_database_importer.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem "rake", "~> 13.
|
|
8
|
+
gem "rake", "~> 13.4"
|
|
9
9
|
|
|
10
|
-
gem "rspec", "~> 3.
|
|
10
|
+
gem "rspec", "~> 3.13"
|
|
11
11
|
|
|
12
|
-
gem "standard", "~> 1.
|
|
12
|
+
gem "standard", "~> 1.55"
|
data/Gemfile.lock
CHANGED
|
@@ -1,71 +1,90 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
remote_database_importer (0.1.
|
|
4
|
+
remote_database_importer (0.1.5)
|
|
5
5
|
tty-config (~> 0.6)
|
|
6
|
-
tty-spinner (~> 0.9)
|
|
6
|
+
tty-spinner (~> 0.9.3)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
ast (2.4.
|
|
12
|
-
diff-lcs (1.5.
|
|
13
|
-
json (2.
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
ast (2.4.3)
|
|
12
|
+
diff-lcs (1.5.1)
|
|
13
|
+
json (2.19.9)
|
|
14
|
+
language_server-protocol (3.17.0.5)
|
|
15
|
+
lint_roller (1.1.0)
|
|
16
|
+
parallel (2.1.0)
|
|
17
|
+
parser (3.3.11.1)
|
|
16
18
|
ast (~> 2.4.1)
|
|
19
|
+
racc
|
|
20
|
+
prism (1.9.0)
|
|
21
|
+
racc (1.8.1)
|
|
17
22
|
rainbow (3.1.1)
|
|
18
|
-
rake (13.
|
|
19
|
-
regexp_parser (2.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
rspec-
|
|
23
|
-
rspec-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
rspec-expectations (3.11.1)
|
|
23
|
+
rake (13.4.2)
|
|
24
|
+
regexp_parser (2.12.0)
|
|
25
|
+
rspec (3.13.0)
|
|
26
|
+
rspec-core (~> 3.13.0)
|
|
27
|
+
rspec-expectations (~> 3.13.0)
|
|
28
|
+
rspec-mocks (~> 3.13.0)
|
|
29
|
+
rspec-core (3.13.0)
|
|
30
|
+
rspec-support (~> 3.13.0)
|
|
31
|
+
rspec-expectations (3.13.0)
|
|
28
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
-
rspec-support (~> 3.
|
|
30
|
-
rspec-mocks (3.
|
|
33
|
+
rspec-support (~> 3.13.0)
|
|
34
|
+
rspec-mocks (3.13.0)
|
|
31
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.
|
|
33
|
-
rspec-support (3.
|
|
34
|
-
rubocop (1.
|
|
36
|
+
rspec-support (~> 3.13.0)
|
|
37
|
+
rspec-support (3.13.0)
|
|
38
|
+
rubocop (1.87.0)
|
|
35
39
|
json (~> 2.3)
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
language_server-protocol (~> 3.17.0.2)
|
|
41
|
+
lint_roller (~> 1.1.0)
|
|
42
|
+
parallel (>= 1.10)
|
|
43
|
+
parser (>= 3.3.0.2)
|
|
38
44
|
rainbow (>= 2.2.2, < 4.0)
|
|
39
|
-
regexp_parser (>=
|
|
40
|
-
|
|
41
|
-
rubocop-ast (>= 1.20.1, < 2.0)
|
|
45
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
46
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
42
47
|
ruby-progressbar (~> 1.7)
|
|
43
|
-
unicode-display_width (>=
|
|
44
|
-
rubocop-ast (1.
|
|
45
|
-
parser (>= 3.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
49
|
+
rubocop-ast (1.49.1)
|
|
50
|
+
parser (>= 3.3.7.2)
|
|
51
|
+
prism (~> 1.7)
|
|
52
|
+
rubocop-performance (1.26.1)
|
|
53
|
+
lint_roller (~> 1.1)
|
|
54
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
55
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
56
|
+
ruby-progressbar (1.13.0)
|
|
57
|
+
standard (1.55.0)
|
|
58
|
+
language_server-protocol (~> 3.17.0.2)
|
|
59
|
+
lint_roller (~> 1.0)
|
|
60
|
+
rubocop (~> 1.87.0)
|
|
61
|
+
standard-custom (~> 1.0.0)
|
|
62
|
+
standard-performance (~> 1.8)
|
|
63
|
+
standard-custom (1.0.2)
|
|
64
|
+
lint_roller (~> 1.0)
|
|
65
|
+
rubocop (~> 1.50)
|
|
66
|
+
standard-performance (1.9.0)
|
|
67
|
+
lint_roller (~> 1.1)
|
|
68
|
+
rubocop-performance (~> 1.26.0)
|
|
53
69
|
tty-config (0.6.0)
|
|
54
70
|
tty-cursor (0.7.1)
|
|
55
71
|
tty-spinner (0.9.3)
|
|
56
72
|
tty-cursor (~> 0.7)
|
|
57
|
-
unicode-display_width (2.
|
|
73
|
+
unicode-display_width (3.2.0)
|
|
74
|
+
unicode-emoji (~> 4.1)
|
|
75
|
+
unicode-emoji (4.2.0)
|
|
58
76
|
|
|
59
77
|
PLATFORMS
|
|
60
78
|
arm64-darwin-20
|
|
61
79
|
arm64-darwin-21
|
|
80
|
+
arm64-darwin-23
|
|
62
81
|
x86_64-linux
|
|
63
82
|
|
|
64
83
|
DEPENDENCIES
|
|
65
|
-
rake (~> 13.
|
|
84
|
+
rake (~> 13.4)
|
|
66
85
|
remote_database_importer!
|
|
67
|
-
rspec (~> 3.
|
|
68
|
-
standard (~> 1.
|
|
86
|
+
rspec (~> 3.13)
|
|
87
|
+
standard (~> 1.55)
|
|
69
88
|
|
|
70
89
|
BUNDLED WITH
|
|
71
90
|
2.3.7
|
|
@@ -68,7 +68,7 @@ module RemoteDatabaseImporter
|
|
|
68
68
|
|
|
69
69
|
# terminate local db sessions, otherwise the db can't be dropped
|
|
70
70
|
def terminate_current_db_sessions
|
|
71
|
-
"psql -d #{config.fetch("local_db_name")} -c 'SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname = current_database() AND pid <> pg_backend_pid();'
|
|
71
|
+
"psql -d #{config.fetch("local_db_name")} -c 'SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname = current_database() AND pid <> pg_backend_pid();' >> #{LOG_FILE} 2>&1"
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def dump_remote_db
|
|
@@ -81,18 +81,18 @@ module RemoteDatabaseImporter
|
|
|
81
81
|
postgres_port = current_environment["connection"]["postgres_port"]
|
|
82
82
|
|
|
83
83
|
if dump_type == "ssh_tunnel"
|
|
84
|
-
"ssh #{ssh_user}@#{host} -p #{ssh_port} 'pg_dump -Fc -U #{db_user} -d #{db_name} -h localhost -C' > #{db_dump_location}"
|
|
84
|
+
"ssh #{ssh_user}@#{host} -p #{ssh_port} 'pg_dump -Fc -U #{db_user} -d #{db_name} -h localhost -C' > #{db_dump_location} 2>> #{LOG_FILE}"
|
|
85
85
|
else
|
|
86
|
-
"pg_dump -Fc 'host=#{host} dbname=#{db_name} user=#{db_user} port=#{postgres_port}' > #{db_dump_location}"
|
|
86
|
+
"pg_dump -Fc 'host=#{host} dbname=#{db_name} user=#{db_user} port=#{postgres_port}' > #{db_dump_location} 2>> #{LOG_FILE}"
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def drop_and_create_local_db
|
|
91
|
-
"rails db:environment:set RAILS_ENV=development; rake db:drop db:create
|
|
91
|
+
"rails db:environment:set RAILS_ENV=development >> #{LOG_FILE} 2>&1; rake db:drop db:create >> #{LOG_FILE} 2>&1"
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def restore_db
|
|
95
|
-
"pg_restore --jobs 8 --no-privileges --no-owner --dbname #{config.fetch("local_db_name")} #{db_dump_location}"
|
|
95
|
+
"pg_restore --jobs 8 --no-privileges --no-owner --dbname #{config.fetch("local_db_name")} #{db_dump_location} >> #{LOG_FILE} 2>&1"
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def remove_logfile
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/remote_database_importer/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "remote_database_importer"
|
|
7
|
+
spec.version = RemoteDatabaseImporter::VERSION
|
|
8
|
+
spec.authors = ["Leon Vogt"]
|
|
9
|
+
spec.email = ["nonick@nonick.ch"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Dump remote databases and import it locally"
|
|
12
|
+
spec.description = "Dump remote databases and import it locally. At the moment only Postgres databases are supported"
|
|
13
|
+
spec.homepage = "https://github.com/leon-vogt/remote_database_importer"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "bin"
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_dependency "tty-config", "~> 0.6"
|
|
33
|
+
spec.add_dependency "tty-spinner", "~> 0.9.3"
|
|
34
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: remote_database_importer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leon Vogt
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: tty-config
|
|
@@ -30,14 +29,14 @@ dependencies:
|
|
|
30
29
|
requirements:
|
|
31
30
|
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: 0.9.3
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: 0.9.3
|
|
41
40
|
description: Dump remote databases and import it locally. At the moment only Postgres
|
|
42
41
|
databases are supported
|
|
43
42
|
email:
|
|
@@ -63,6 +62,7 @@ files:
|
|
|
63
62
|
- lib/tasks/remote_database_importer.rake
|
|
64
63
|
- readme_assets/config_sample.png
|
|
65
64
|
- readme_assets/import-job.gif
|
|
65
|
+
- remote_database_importer.gemspec
|
|
66
66
|
- sig/remote_database_importer.rbs
|
|
67
67
|
homepage: https://github.com/leon-vogt/remote_database_importer
|
|
68
68
|
licenses:
|
|
@@ -71,7 +71,7 @@ metadata:
|
|
|
71
71
|
homepage_uri: https://github.com/leon-vogt/remote_database_importer
|
|
72
72
|
source_code_uri: https://github.com/leon-vogt/remote_database_importer
|
|
73
73
|
changelog_uri: https://github.com/leon-vogt/remote_database_importer/blob/main/CHANGELOG.md
|
|
74
|
-
|
|
74
|
+
rubygems_mfa_required: 'true'
|
|
75
75
|
rdoc_options: []
|
|
76
76
|
require_paths:
|
|
77
77
|
- lib
|
|
@@ -86,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
87
|
version: '0'
|
|
88
88
|
requirements: []
|
|
89
|
-
rubygems_version:
|
|
90
|
-
signing_key:
|
|
89
|
+
rubygems_version: 4.0.14
|
|
91
90
|
specification_version: 4
|
|
92
91
|
summary: Dump remote databases and import it locally
|
|
93
92
|
test_files: []
|