pg_export 0.7.4 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +6 -3
  4. data/CHANGELOG.md +18 -0
  5. data/README.md +14 -11
  6. data/bin/pg_export +72 -16
  7. data/lib/pg_export/configuration.rb +12 -8
  8. data/lib/pg_export/container.rb +17 -8
  9. data/lib/pg_export/import.rb +1 -1
  10. data/lib/pg_export/lib/pg_export/factories/ftp_gateway_factory.rb +22 -0
  11. data/lib/pg_export/lib/pg_export/factories/ssh_gateway_factory.rb +22 -0
  12. data/lib/pg_export/lib/pg_export/{adapters/ftp_adapter.rb → gateways/ftp.rb} +11 -8
  13. data/lib/pg_export/lib/pg_export/gateways/ssh.rb +82 -0
  14. data/lib/pg_export/lib/pg_export/listeners/interactive/build_dump.rb +4 -4
  15. data/lib/pg_export/lib/pg_export/listeners/interactive/{close_ftp_connection.rb → close_connection.rb} +1 -1
  16. data/lib/pg_export/lib/pg_export/listeners/interactive/decrypt_dump.rb +2 -2
  17. data/lib/pg_export/lib/pg_export/listeners/interactive/download_dump_from_ftp.rb +2 -2
  18. data/lib/pg_export/lib/pg_export/listeners/interactive/encrypt_dump.rb +2 -2
  19. data/lib/pg_export/lib/pg_export/listeners/interactive/{open_ftp_connection.rb → open_connection.rb} +1 -1
  20. data/lib/pg_export/lib/pg_export/listeners/interactive/remove_old_dumps_from_ftp.rb +5 -5
  21. data/lib/pg_export/lib/pg_export/listeners/interactive/restore.rb +2 -2
  22. data/lib/pg_export/lib/pg_export/listeners/interactive/upload_dump_to_ftp.rb +2 -2
  23. data/lib/pg_export/lib/pg_export/listeners/interactive_listener.rb +2 -2
  24. data/lib/pg_export/lib/pg_export/listeners/plain/build_dump.rb +2 -2
  25. data/lib/pg_export/lib/pg_export/listeners/plain/{close_ftp_connection.rb → close_connection.rb} +2 -2
  26. data/lib/pg_export/lib/pg_export/listeners/plain/decrypt_dump.rb +2 -2
  27. data/lib/pg_export/lib/pg_export/listeners/plain/download_dump_from_ftp.rb +2 -2
  28. data/lib/pg_export/lib/pg_export/listeners/plain/encrypt_dump.rb +2 -2
  29. data/lib/pg_export/lib/pg_export/listeners/plain/fetch_dumps_from_ftp.rb +2 -2
  30. data/lib/pg_export/lib/pg_export/listeners/plain/open_connection.rb +15 -0
  31. data/lib/pg_export/lib/pg_export/listeners/plain/remove_old_dumps_from_ftp.rb +3 -3
  32. data/lib/pg_export/lib/pg_export/listeners/plain/restore.rb +1 -1
  33. data/lib/pg_export/lib/pg_export/listeners/plain/upload_dump_to_ftp.rb +2 -2
  34. data/lib/pg_export/lib/pg_export/listeners/plain_listener.rb +2 -2
  35. data/lib/pg_export/lib/pg_export/operations/{open_ftp_connection.rb → open_connection.rb} +5 -5
  36. data/lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb +6 -6
  37. data/lib/pg_export/lib/pg_export/repositories/{ftp_dump_file_repository.rb → gateway_dump_file_repository.rb} +3 -3
  38. data/lib/pg_export/lib/pg_export/repositories/{ftp_dump_repository.rb → gateway_dump_repository.rb} +7 -7
  39. data/lib/pg_export/lib/pg_export/transactions/export_dump.rb +8 -8
  40. data/lib/pg_export/lib/pg_export/transactions/import_dump_interactively.rb +14 -14
  41. data/lib/pg_export/lib/pg_export/types.rb +1 -1
  42. data/lib/pg_export/system/boot/interactive.rb +1 -1
  43. data/lib/pg_export/system/boot/plain.rb +2 -2
  44. data/lib/pg_export/version.rb +1 -1
  45. data/pg_export.gemspec +13 -9
  46. metadata +88 -31
  47. data/lib/pg_export/lib/pg_export/factories/ftp_adapter_factory.rb +0 -22
  48. data/lib/pg_export/lib/pg_export/listeners/plain/open_ftp_connection.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4053a7e2cf643fd2ddac77dca85a976f67debb6d1b1af2298d1c4822f85004bc
4
- data.tar.gz: 4ddb7f36e7938d4c0219e706f29ffae86a6027ea5ab0795d4f4fed5efe250a16
3
+ metadata.gz: 96c2a7a23f195dba8cb7e21e3de8d9d130fd5849291e68ed153892b1f9e7aef6
4
+ data.tar.gz: 6f3fe11961d2d6b2089b6abacf93a1f37e48deee88d697c8402a9ac73b3dbbd3
5
5
  SHA512:
6
- metadata.gz: 7ca8ae75c2ef881d39d19e7ea8414be3beafb83a840a154e1677556d07658ceaeca98227e3db0693d91831384deb766b6bca8246002bd79402f8c55f50bf61f3
7
- data.tar.gz: 5bdf98eec343414e3ed78cc6756df13ec161d25f636ee392aaa26406eb2baa37a533b132f953ca79937a41e75c6d5bc185d3159ec1653472efe8e3dff1924065
6
+ metadata.gz: 320d541ded251f9053bffa686fb429e22572b306f48227cb9b51aaa4bae76fd452ce2ab8e8f84ac63a0b1b4628bc8c70fbfbfb26d2295d5fc7bd1c1f9188330f
7
+ data.tar.gz: db3b2d4799b5ddc7e0628070b8d99406655d7fc3111a34a93dc8237a189ea01ef004a72d8ed2716ad03d74b901ec597d4dc796c9e893b0557e0f698639788a48
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .idea
data/.travis.yml CHANGED
@@ -1,9 +1,12 @@
1
- sudo: false
2
1
  language: ruby
3
2
  rvm:
4
- - 2.3.0
3
+ - 3.0.0
4
+ - 2.7.2
5
+ - 2.4.10
6
+ services:
7
+ - postgresql
5
8
  addons:
6
9
  code_climate:
7
10
  repo_token: db03e5968c5bcd68b12ca50f5d41ae07dd74fe80d4e1421d754e31c316e7477a
8
- before_install: gem install bundler -v 1.16.6
11
+ before_install: gem install bundler -v 2.2.3
9
12
  after_success: codeclimate-test-reporter
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ### 1.0.0 - 2021.03.20
2
+ - Make it compatible with Ruby 3.0
3
+ - Change configuration envs:
4
+ - BACKUP_FTP_HOST -> PG_EXPORT_GATEWAY_HOST
5
+ - BACKUP_FTP_USER -> PG_EXPORT_GATEWAY_USER
6
+ - BACKUP_FTP_PASSWORD -> PG_EXPORT_GATEWAY_PASSWORD
7
+ - DUMP_ENCRYPTION_KEY -> PG_EXPORT_ENCRYPTION_KEY
8
+ - Drop Ruby 2.3 support
9
+ - Add SSH option
10
+
11
+ ### 0.7.7 - 2020.09.07
12
+
13
+ - Upgrade dry-initializer
14
+
15
+ ### 0.7.6 - 2020.09.05
16
+
17
+ - Upgrade dry-types, dry-struct dry-system
18
+
1
19
  ### 0.7.0 - 2018.10.18
2
20
 
3
21
  - Change required ruby version from 2.2.0 to 2.3.0.
data/README.md CHANGED
@@ -26,7 +26,7 @@ Features:
26
26
 
27
27
  ## Dependencies
28
28
 
29
- * Ruby >= 2.3.0
29
+ * Ruby >= 2.4 (works with Ruby 3.0)
30
30
  * $ pg_dump
31
31
  * $ pg_restore
32
32
 
@@ -51,29 +51,32 @@ Or install it yourself as:
51
51
  $ pg_export -h
52
52
 
53
53
  Usage: pg_export [options]
54
+ -g, --gateway GATEWAY [Optional] ssh or ftp (default: ftp)
54
55
  -d, --database DATABASE [Required] Name of the database to export
55
56
  -k, --keep [KEEP] [Optional] Number of dump files to keep on FTP (default: 10)
56
57
  -t, --timestamped [Optional] Enables log messages with timestamps
57
58
  -m, --muted [Optional] Mutes log messages (overrides -t option)
58
59
  -i, --interactive [Optional] Interactive command line mode - for restoring dumps into databases
60
+ -v, --version Show version
59
61
  -h, --help Show this message
60
-
62
+
61
63
  Setting can be verified by running following commands:
62
64
  -c, --configuration Prints the configuration
63
- -f, --ftp Tries connecting to FTP to verify the connection
65
+ -w, --welcome Tries connecting to the gateway (FTP or SSH) to verify the connection
66
+
64
67
 
65
68
  ## How to start
66
69
 
67
70
  __Step 1.__ Prepare ENV variables.
68
71
 
69
72
  /* FTP storage for database dumps. */
70
- BACKUP_FTP_HOST=yourftp.example.com
71
- BACKUP_FTP_USER=user
72
- BACKUP_FTP_PASSWORD=password
73
+ PG_EXPORT_GATEWAY_HOST=yourftp.example.com
74
+ PG_EXPORT_GATEWAY_USER=user
75
+ PG_EXPORT_GATEWAY_PASSWORD=password
73
76
 
74
- /* Encryption key shoul have exactly 16 characters. */
77
+ /* Encryption key should have exactly 16 characters. */
75
78
  /* Dumps will be SSL(AES-128-CBC) encrypted using this key. */
76
- DUMP_ENCRYPTION_KEY=1234567890abcdef
79
+ PG_EXPORT_ENCRYPTION_KEY=1234567890abcdef
77
80
 
78
81
  /* Dumps to be kept on FTP */
79
82
  /* Optional, defaults to 10 */
@@ -84,12 +87,12 @@ Note, that variables cannot include `#` sign, [more info](http://serverfault.com
84
87
  __Step 2.__ Print the configuration to verify if env variables has been loaded properly.
85
88
 
86
89
  $ pg_export --configuration
87
- => {:dump_encryption_key=>"k4***", :ftp_host=>"yourftp.example.com", :ftp_user=>"your_ftp_user",
88
- :ftp_password=>"pass***", :logger_format=>"plain", :keep_dumps=>2}
90
+ => {:dump_encryption_key=>"k4***", :gateway_host=>"yourftp.example.com", :gateway_user=>"your_gateway_user",
91
+ :gateway_password=>"pass***", :logger_format=>"plain", :keep_dumps=>2}
89
92
 
90
93
  __Step 3.__ Try connecting to FTP to verify the connection.
91
94
 
92
- $ pg_export --ftp
95
+ $ pg_export --gateway ftp --welcome
93
96
  => 230 User your_ftp_user logged in
94
97
 
95
98
  __Step 4.__ Perform database export.
data/bin/pg_export CHANGED
@@ -4,65 +4,121 @@
4
4
  require 'optparse'
5
5
 
6
6
  require 'pg_export'
7
- require 'pg_export/container'
8
7
 
9
8
  ENV['KEEP_DUMPS'] = ENV['KEEP_DUMPS'] || '10'
9
+ ENV['GATEWAY'] = 'ftp'
10
+
10
11
  interactive = false
11
12
  database = nil
12
13
 
14
+
13
15
  option_parser = OptionParser.new do |opts|
14
- opts.banner = 'Usage: pg_export [options]'
16
+ opts.banner = <<~TXT
17
+ NAME
18
+ pg_export - CLI for exporting/importing PostgreSQL dumps via FTP/SSH
19
+
20
+ SYNOPSIS (default mode)
21
+ pg_export DATABASE [options]
22
+
23
+ SYNOPSIS (interactive mode)
24
+ pg_export --interactive [DATABASE] [options]
25
+
26
+ ARGUMENTS
27
+ DATABASE - database name to export (when default mode)
28
+ - phrase to filter database dumps by (when interactive mode)
29
+
30
+ OPTIONS
31
+ TXT
32
+
33
+ opts.on('-g', '--gateway GATEWAY', String, 'ssh or ftp (default: ftp) - credentials need to be set via ENVs') do |g|
34
+ ENV['GATEWAY'] = g
35
+ end
36
+
37
+ opts.on('-s', '--ssh', 'Same as "--gateway ssh"') do
38
+ ENV['GATEWAY'] = 'ssh'
39
+ end
40
+
41
+ opts.on('-f', '--ftp', 'Same as "--gateway ftp"') do
42
+ ENV['GATEWAY'] = 'ftp'
43
+ end
15
44
 
16
- opts.on('-d', '--database DATABASE', String, '[Required] Name of the database to export') do |d|
45
+ opts.on('-d', '--database DATABASE', String, 'Alternative way of specifying name of the database to export or phrase to filter by') do |d|
17
46
  database = d
18
47
  end
19
48
 
20
- opts.on('-k', '--keep [KEEP]', String, "[Optional] Number of dump files to keep on FTP (default: #{ENV['KEEP_DUMPS']})") do |keep|
49
+ opts.on('-e', '--encryption_key KEY', String, 'Dumps will be SSL(AES-128-CBC) encrypted using this key. Should have exactly 16 characters. Overwrites PG_EXPORT_ENCRYPTION_KEY env') do |key|
50
+ ENV['PG_EXPORT_ENCRYPTION_KEY'] = key
51
+ end
52
+
53
+ opts.on('-k', '--keep KEEP', String, "Number of dump files to keep on FTP (default: 10). Overwrites KEEP_DUMPS env") do |keep|
21
54
  ENV['KEEP_DUMPS'] = keep
22
55
  end
23
56
 
24
- opts.on('-t', '--timestamped', '[Optional] Enables log messages with timestamps') do
57
+ opts.on('-t', '--timestamped', 'Enables log messages with timestamps') do
25
58
  ENV['LOGGER_FORMAT'] = 'timestamped'
26
59
  end
27
60
 
28
- opts.on('-m', '--muted', '[Optional] Mutes log messages (overrides -t option)') do
61
+ opts.on('-m', '--muted', 'Mutes log messages (overrides -t option)') do
29
62
  ENV['LOGGER_FORMAT'] = 'muted'
30
63
  end
31
64
 
32
- opts.on('-i', '--interactive', '[Optional] Interactive command line mode - for restoring dumps into databases') do
65
+ opts.on('-i', '--interactive', 'Interactive mode, for importing dumps') do
33
66
  interactive = true
34
67
  end
35
68
 
69
+ opts.on('-v', '--version', 'Show version') do
70
+ puts PgExport::VERSION
71
+ exit
72
+ end
73
+
36
74
  opts.on('-h', '--help', 'Show this message') do
37
75
  puts opts
38
76
  exit
39
77
  end
40
78
 
41
- opts.separator "\nSetting can be verified by running following commands:"
79
+ opts.separator <<~TXT
80
+
81
+ ENV
82
+ PG_EXPORT_GATEWAY_HOST required
83
+ PG_EXPORT_GATEWAY_USER required
84
+ PG_EXPORT_GATEWAY_PASSWORD optional when eg. authorized key is added
85
+ PG_EXPORT_ENCRYPTION_KEY required or set by --encryption_key)
86
+ TXT
87
+
88
+ opts.separator "\nTEST RUN"
42
89
 
43
- opts.on('-c', '--configuration', 'Prints the configuration') do
90
+ opts.on('-c', '--configuration', 'Print the configuration') do
91
+ require 'pg_export/container'
44
92
  PgExport::Container.start(:config)
45
93
  puts PgExport::Container['config'].to_h
46
94
  exit
47
95
  end
48
96
 
49
- opts.on('-f', '--ftp', 'Tries connecting to FTP to verify the connection') do
50
- PgExport::Container.start(:ftp)
51
- ftp_adapter = PgExport::Container['factories.ftp_adapter_factory'].ftp_adapter
52
- ftp = ftp_adapter.open_ftp
53
- puts ftp.welcome
97
+ opts.on('-w', '--welcome', 'Try connecting to the gateway (FTP or SSH) to verify the connection') do
98
+ require 'pg_export/container'
99
+ PgExport::Container.start(ENV['GATEWAY'].to_sym)
100
+ gateway = PgExport::Container['factories.gateway_factory'].gateway
101
+ puts gateway.welcome
102
+ exit
103
+ end
104
+
105
+ if ARGV.empty?
106
+ puts opts
54
107
  exit
55
108
  end
56
109
  end
57
110
 
58
111
  begin
59
112
  option_parser.parse!
113
+ database = ARGV.first unless ARGV.empty?
60
114
  rescue OptionParser::ParseError => e
61
115
  warn e.message.capitalize
62
- warn 'Type "pg_export -h" for available options'
116
+ warn 'Type "pg_export" for available options'
63
117
  exit
64
118
  end
65
119
 
120
+ require 'pg_export/container'
121
+
66
122
  begin
67
123
  pg_export =
68
124
  if interactive
@@ -78,5 +134,5 @@ end
78
134
 
79
135
  pg_export.call(database) do |result|
80
136
  result.success { puts 'Success' }
81
- result.failure { |message:| warn message }
137
+ result.failure { |outcome| warn outcome[:message] }
82
138
  end
@@ -5,21 +5,21 @@ require 'dry-struct'
5
5
 
6
6
  class PgExport
7
7
  class Configuration < Dry::Struct
8
- include Dry::Types.module
8
+ include Dry::Types()
9
9
 
10
10
  attribute :dump_encryption_key, Strict::String.constrained(size: 16)
11
- attribute :ftp_host, Strict::String
12
- attribute :ftp_user, Strict::String
13
- attribute :ftp_password, Strict::String
11
+ attribute :gateway_host, Strict::String
12
+ attribute :gateway_user, Strict::String
13
+ attribute :gateway_password, Strict::String.optional
14
14
  attribute :logger_format, Coercible::String.enum('plain', 'timestamped', 'muted')
15
15
  attribute :keep_dumps, Coercible::Integer.constrained(gteq: 0)
16
16
 
17
17
  def self.build(env)
18
18
  new(
19
- dump_encryption_key: env['DUMP_ENCRYPTION_KEY'],
20
- ftp_host: env['BACKUP_FTP_HOST'],
21
- ftp_user: env['BACKUP_FTP_USER'],
22
- ftp_password: env['BACKUP_FTP_PASSWORD'],
19
+ dump_encryption_key: env['PG_EXPORT_ENCRYPTION_KEY'],
20
+ gateway_host: env['PG_EXPORT_GATEWAY_HOST'],
21
+ gateway_user: env['PG_EXPORT_GATEWAY_USER'],
22
+ gateway_password: env['PG_EXPORT_GATEWAY_PASSWORD'] == '' ? nil : env['PG_EXPORT_GATEWAY_PASSWORD'],
23
23
  logger_format: env['LOGGER_FORMAT'] || 'plain',
24
24
  keep_dumps: env['KEEP_DUMPS'] || 10
25
25
  )
@@ -27,6 +27,10 @@ class PgExport
27
27
  raise PgExport::InitializationError, e.message.gsub('[PgExport::Configuration.new] ', '')
28
28
  end
29
29
 
30
+ def gateway
31
+ ENV['GATEWAY'].to_sym
32
+ end
33
+
30
34
  def logger_muted?
31
35
  logger_format == 'muted'
32
36
  end
@@ -16,32 +16,41 @@ class PgExport
16
16
 
17
17
  boot(:ftp) do
18
18
  init do
19
- require 'pg_export/lib/pg_export/factories/ftp_adapter_factory'
19
+ require 'pg_export/lib/pg_export/factories/ftp_gateway_factory'
20
20
  end
21
21
 
22
22
  start do
23
23
  use :config
24
+ register('factories.gateway_factory') { ::PgExport::Factories::FtpGatewayFactory.new }
25
+ end
26
+ end
27
+
28
+ boot(:ssh) do
29
+ init do
30
+ require 'pg_export/lib/pg_export/factories/ssh_gateway_factory'
31
+ end
24
32
 
25
- register('factories.ftp_adapter_factory') do
26
- ::PgExport::Factories::FtpAdapterFactory.new
27
- end
33
+ start do
34
+ use :config
35
+ register('factories.gateway_factory') { ::PgExport::Factories::SshGatewayFactory.new }
28
36
  end
29
37
  end
30
38
 
31
- boot(:main) do
39
+ boot(:main) do |system|
32
40
  init do
33
41
  require 'pg_export/lib/pg_export/operations/encrypt_dump'
34
42
  require 'pg_export/lib/pg_export/operations/decrypt_dump'
35
43
  require 'pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp'
36
- require 'pg_export/lib/pg_export/operations/open_ftp_connection'
44
+ require 'pg_export/lib/pg_export/operations/open_connection'
37
45
  end
38
46
 
39
47
  start do
40
- use :ftp
48
+ use(system[:config].gateway)
49
+
41
50
  register('operations.encrypt_dump') { ::PgExport::Operations::EncryptDump.new }
42
51
  register('operations.decrypt_dump') { ::PgExport::Operations::DecryptDump.new }
43
52
  register('operations.remove_old_dumps_from_ftp') { ::PgExport::Operations::RemoveOldDumpsFromFtp.new }
44
- register('operations.open_ftp_connection') { ::PgExport::Operations::OpenFtpConnection.new }
53
+ register('operations.open_connection') { ::PgExport::Operations::OpenConnection.new }
45
54
  end
46
55
  end
47
56
  end
@@ -3,5 +3,5 @@
3
3
  require_relative 'container'
4
4
 
5
5
  class PgExport
6
- Import = PgExport::Container.injector.hash
6
+ Import = PgExport::Container.injector
7
7
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # auto_register: false
4
+
5
+ require 'pg_export/lib/pg_export/gateways/ftp'
6
+ require 'pg_export/import'
7
+
8
+ class PgExport
9
+ module Factories
10
+ class FtpGatewayFactory
11
+ include Import['config']
12
+
13
+ def gateway
14
+ ::PgExport::Gateways::Ftp.new(
15
+ host: config.gateway_host,
16
+ user: config.gateway_user,
17
+ password: config.gateway_password
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # auto_register: false
4
+
5
+ require 'pg_export/lib/pg_export/gateways/ssh'
6
+ require 'pg_export/import'
7
+
8
+ class PgExport
9
+ module Factories
10
+ class SshGatewayFactory
11
+ include Import['config']
12
+
13
+ def gateway
14
+ ::PgExport::Gateways::Ssh.new(
15
+ host: config.gateway_host,
16
+ user: config.gateway_user,
17
+ password: config.gateway_password
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,28 +5,31 @@
5
5
  require 'net/ftp'
6
6
 
7
7
  class PgExport
8
- module Adapters
9
- class FtpAdapter
8
+ module Gateways
9
+ class Ftp
10
10
  CHUNK_SIZE = (2**16).freeze
11
11
 
12
12
  def initialize(host:, user:, password:)
13
13
  @host, @user, @password, @logger = host, user, password
14
- ObjectSpace.define_finalizer(self, proc { ftp.close if @ftp })
15
14
  end
16
15
 
17
- def open_ftp
16
+ def open
18
17
  @ftp = Net::FTP.new(host, user, password)
19
18
  @ftp.passive = true
20
19
  @ftp
21
20
  end
22
21
 
23
- def close_ftp
22
+ def welcome
23
+ open.welcome
24
+ end
25
+
26
+ def close
24
27
  @ftp&.close
25
28
  end
26
29
 
27
- def list(regex_string)
30
+ def list(name)
28
31
  ftp
29
- .list(regex_string)
32
+ .list([name, '*'].join('_'))
30
33
  .map { |row| extracted_meaningful_attributes(row) }
31
34
  .sort_by { |item| item[:name] }
32
35
  .reverse
@@ -49,7 +52,7 @@ class PgExport
49
52
  end
50
53
 
51
54
  def ftp
52
- @ftp ||= open_ftp
55
+ @ftp ||= open
53
56
  end
54
57
 
55
58
  private