pg_export 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/pg_export/entities/dump.rb +48 -0
- data/lib/pg_export/includable_modules/dump/size_human.rb +1 -1
- data/lib/pg_export/services/aes/decryptor.rb +1 -1
- data/lib/pg_export/services/aes/encryptor.rb +1 -1
- data/lib/pg_export/services/bash_utils.rb +1 -1
- data/lib/pg_export/services/dump_storage.rb +1 -1
- data/lib/pg_export/version.rb +1 -1
- data/lib/pg_export.rb +1 -3
- metadata +3 -5
- data/lib/pg_export/entities/dump/base.rb +0 -42
- data/lib/pg_export/entities/encrypted_dump.rb +0 -7
- data/lib/pg_export/entities/plain_dump.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763552e9063089d2137c2eff38b159caee96f457
|
4
|
+
data.tar.gz: 445e0c662a841abf1c9ee1f3ba4fa05dc845e6e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8e27408b4aa14d29783f3672c456d09521cce85195fee112fbd32b8fd3b987f039a82dc28e652553fc40f63be0d80509cf05eb1299494c9beaac57ff8d7f2f
|
7
|
+
data.tar.gz: ab1c4938fbbb933735c35f806d6eca4745d240a7d749641180724ccebaba06e976b49a73762bc36eb4a7a577fdb6f2fe8e20ca41f4028cba29f8c235125c9204
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -71,7 +71,7 @@ __Step 1.__ Prepare FTP account and put configuration into env variables. Dumps
|
|
71
71
|
BACKUP_FTP_USER="user"
|
72
72
|
BACKUP_FTP_PASSWORD="password"
|
73
73
|
|
74
|
-
__Step 2.__ Put dump encryption key into env variable (
|
74
|
+
__Step 2.__ Put dump encryption key into env variable (exactly 16 characters). Dumps will be SSL(AES-128-CBC) encrypted using that key.
|
75
75
|
|
76
76
|
# /etc/environment
|
77
77
|
DUMP_ENCRYPTION_KEY="1234567890abcdef"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class PgExport
|
2
|
+
class Dump
|
3
|
+
extend Forwardable
|
4
|
+
include SizeHuman
|
5
|
+
|
6
|
+
CHUNK_SIZE = (2**16).freeze
|
7
|
+
|
8
|
+
def_delegators :file, :path, :read, :write, :<<, :rewind, :close, :size, :eof?
|
9
|
+
|
10
|
+
attr_reader :name
|
11
|
+
|
12
|
+
def initialize(name)
|
13
|
+
@name = name
|
14
|
+
end
|
15
|
+
|
16
|
+
def ext
|
17
|
+
''
|
18
|
+
end
|
19
|
+
|
20
|
+
def open(operation_type, &block)
|
21
|
+
case operation_type.to_sym
|
22
|
+
when :read then File.open(path, 'r', &block)
|
23
|
+
when :write then File.open(path, 'w', &block)
|
24
|
+
else raise ArgumentError, 'Operation type can be only :read or :write'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def each_chunk
|
29
|
+
open(:read) do |file|
|
30
|
+
yield file.read(CHUNK_SIZE) until file.eof?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"#{name} (#{size_human})"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def file
|
41
|
+
@file ||= Tempfile.new(file_name)
|
42
|
+
end
|
43
|
+
|
44
|
+
def file_name
|
45
|
+
name.downcase.gsub(/[^0-9a-z]/, '_')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/pg_export/version.rb
CHANGED
data/lib/pg_export.rb
CHANGED
@@ -12,9 +12,7 @@ require 'pg_export/includable_modules/dump/size_human'
|
|
12
12
|
require 'pg_export/includable_modules/services_container'
|
13
13
|
require 'pg_export/errors'
|
14
14
|
require 'pg_export/configuration'
|
15
|
-
require 'pg_export/entities/dump
|
16
|
-
require 'pg_export/entities/plain_dump'
|
17
|
-
require 'pg_export/entities/encrypted_dump'
|
15
|
+
require 'pg_export/entities/dump'
|
18
16
|
require 'pg_export/services/ftp_adapter'
|
19
17
|
require 'pg_export/services/ftp_connection'
|
20
18
|
require 'pg_export/services/bash_utils'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Maicher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cli_spinnable
|
@@ -148,9 +148,7 @@ files:
|
|
148
148
|
- bin/setup
|
149
149
|
- lib/pg_export.rb
|
150
150
|
- lib/pg_export/configuration.rb
|
151
|
-
- lib/pg_export/entities/dump
|
152
|
-
- lib/pg_export/entities/encrypted_dump.rb
|
153
|
-
- lib/pg_export/entities/plain_dump.rb
|
151
|
+
- lib/pg_export/entities/dump.rb
|
154
152
|
- lib/pg_export/errors.rb
|
155
153
|
- lib/pg_export/includable_modules/colourable_string.rb
|
156
154
|
- lib/pg_export/includable_modules/dump/size_human.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class PgExport
|
2
|
-
module Dump
|
3
|
-
class Base
|
4
|
-
extend Forwardable
|
5
|
-
include SizeHuman
|
6
|
-
|
7
|
-
CHUNK_SIZE = (2**16).freeze
|
8
|
-
|
9
|
-
def_delegators :file, :path, :read, :write, :<<, :rewind, :close, :size, :eof?
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@file = Tempfile.new('dump')
|
13
|
-
end
|
14
|
-
|
15
|
-
def ext
|
16
|
-
''
|
17
|
-
end
|
18
|
-
|
19
|
-
def open(operation_type, &block)
|
20
|
-
case operation_type.to_sym
|
21
|
-
when :read then File.open(path, 'r', &block)
|
22
|
-
when :write then File.open(path, 'w', &block)
|
23
|
-
else raise ArgumentError, 'Operation type can be only :read or :write'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def each_chunk
|
28
|
-
open(:read) do |file|
|
29
|
-
yield file.read(CHUNK_SIZE) until file.eof?
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_s
|
34
|
-
"#{name || self.class} #{file.class} (#{size_human})"
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
attr_reader :file
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|