ftp_paradise 1.4.5
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 +7 -0
- data/README.md +319 -0
- data/bin/create_remote_directory +9 -0
- data/bin/ftp_get +17 -0
- data/bin/ftp_gtk3 +7 -0
- data/bin/ftp_upload +42 -0
- data/bin/ftp_upload_binary +18 -0
- data/bin/iftp +7 -0
- data/bin/remote_remove +28 -0
- data/doc/README.gen +302 -0
- data/doc/todo/TODO_FOR_FTP_PARADISE_PROJECT.md +79 -0
- data/ftp_paradise.gemspec +122 -0
- data/lib/ftp_paradise.rb +5 -0
- data/lib/ftp_paradise/base/cliner.rb +23 -0
- data/lib/ftp_paradise/base/colours.rb +83 -0
- data/lib/ftp_paradise/base/prototype.rb +171 -0
- data/lib/ftp_paradise/base/reset.rb +29 -0
- data/lib/ftp_paradise/colours/colours.rb +141 -0
- data/lib/ftp_paradise/colours/use_colours.rb +76 -0
- data/lib/ftp_paradise/configuration/configuration.rb +49 -0
- data/lib/ftp_paradise/connection/README.md +1 -0
- data/lib/ftp_paradise/connection/connection.rb +35 -0
- data/lib/ftp_paradise/connection/constants.rb +46 -0
- data/lib/ftp_paradise/connection/data.rb +164 -0
- data/lib/ftp_paradise/connection/debug.rb +78 -0
- data/lib/ftp_paradise/connection/directory_handling.rb +271 -0
- data/lib/ftp_paradise/connection/do_login.rb +108 -0
- data/lib/ftp_paradise/connection/download.rb +86 -0
- data/lib/ftp_paradise/connection/file_handling.rb +174 -0
- data/lib/ftp_paradise/connection/ftp_object.rb +21 -0
- data/lib/ftp_paradise/connection/initialize.rb +88 -0
- data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +20 -0
- data/lib/ftp_paradise/connection/is_connected.rb +46 -0
- data/lib/ftp_paradise/connection/misc.rb +474 -0
- data/lib/ftp_paradise/connection/notify.rb +71 -0
- data/lib/ftp_paradise/connection/password.rb +47 -0
- data/lib/ftp_paradise/connection/port.rb +33 -0
- data/lib/ftp_paradise/connection/remote_pwd.rb +72 -0
- data/lib/ftp_paradise/connection/remote_url.rb +164 -0
- data/lib/ftp_paradise/connection/remove.rb +143 -0
- data/lib/ftp_paradise/connection/reset.rb +78 -0
- data/lib/ftp_paradise/connection/run.rb +18 -0
- data/lib/ftp_paradise/connection/set_array_available_hosts.rb +27 -0
- data/lib/ftp_paradise/connection/set_input.rb +18 -0
- data/lib/ftp_paradise/connection/show.rb +153 -0
- data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +24 -0
- data/lib/ftp_paradise/connection/transfer_mode.rb +163 -0
- data/lib/ftp_paradise/connection/upload.rb +253 -0
- data/lib/ftp_paradise/connection/use_default_dataset.rb +40 -0
- data/lib/ftp_paradise/connection/username.rb +42 -0
- data/lib/ftp_paradise/constants/constants.rb +19 -0
- data/lib/ftp_paradise/constants/misc.rb +57 -0
- data/lib/ftp_paradise/constants/namespace.rb +14 -0
- data/lib/ftp_paradise/constants/newline.rb +14 -0
- data/lib/ftp_paradise/constants/roebe.rb +31 -0
- data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +233 -0
- data/lib/ftp_paradise/entry/entry.rb +300 -0
- data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +34 -0
- data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +34 -0
- data/lib/ftp_paradise/gui/shared_code/ftp_paradise/ftp_paradise_module.rb +709 -0
- data/lib/ftp_paradise/images/connection_image.png +0 -0
- data/lib/ftp_paradise/interactive_ftp/constants.rb +103 -0
- data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +216 -0
- data/lib/ftp_paradise/interactive_ftp/help.rb +50 -0
- data/lib/ftp_paradise/interactive_ftp/initialize.rb +27 -0
- data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +998 -0
- data/lib/ftp_paradise/interactive_ftp/main_loop.rb +51 -0
- data/lib/ftp_paradise/interactive_ftp/menu.rb +786 -0
- data/lib/ftp_paradise/interactive_ftp/misc.rb +208 -0
- data/lib/ftp_paradise/interactive_ftp/mode.rb +124 -0
- data/lib/ftp_paradise/interactive_ftp/readline.rb +113 -0
- data/lib/ftp_paradise/interactive_ftp/remove.rb +97 -0
- data/lib/ftp_paradise/interactive_ftp/reset.rb +90 -0
- data/lib/ftp_paradise/interactive_ftp/run.rb +22 -0
- data/lib/ftp_paradise/interactive_ftp/show.rb +184 -0
- data/lib/ftp_paradise/interactive_ftp/upload.rb +90 -0
- data/lib/ftp_paradise/interactive_ftp/user_input.rb +53 -0
- data/lib/ftp_paradise/project/project.rb +64 -0
- data/lib/ftp_paradise/requires/common_basic_requires.rb +14 -0
- data/lib/ftp_paradise/requires/common_external_requires.rb +9 -0
- data/lib/ftp_paradise/requires/require_the_constants.rb +7 -0
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +18 -0
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +10 -0
- data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +28 -0
- data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +28 -0
- data/lib/ftp_paradise/toplevel_methods/connect.rb +50 -0
- data/lib/ftp_paradise/toplevel_methods/data.rb +31 -0
- data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +37 -0
- data/lib/ftp_paradise/toplevel_methods/directory_related_actions.rb +33 -0
- data/lib/ftp_paradise/toplevel_methods/e.rb +16 -0
- data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +49 -0
- data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +270 -0
- data/lib/ftp_paradise/toplevel_methods/is_on_roebe.rb +20 -0
- data/lib/ftp_paradise/toplevel_methods/login_name.rb +49 -0
- data/lib/ftp_paradise/toplevel_methods/misc.rb +16 -0
- data/lib/ftp_paradise/toplevel_methods/opn.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/password.rb +50 -0
- data/lib/ftp_paradise/toplevel_methods/port.rb +41 -0
- data/lib/ftp_paradise/toplevel_methods/rds.rb +18 -0
- data/lib/ftp_paradise/toplevel_methods/remote_url.rb +57 -0
- data/lib/ftp_paradise/toplevel_methods/time.rb +45 -0
- data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +108 -0
- data/lib/ftp_paradise/version/version.rb +19 -0
- data/lib/ftp_paradise/www/public/css/style.css +3 -0
- data/lib/ftp_paradise/www/sinatra_web_interface.rb +242 -0
- data/lib/ftp_paradise/www/views/index.slim +3 -0
- data/lib/ftp_paradise/www/views/layout.slim +11 -0
- data/lib/ftp_paradise/www/web_interface.cgi +34 -0
- data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +1 -0
- data/lib/ftp_paradise/yaml/debug.yml +1 -0
- data/lib/ftp_paradise/yaml/open_in_default_editor.yml +1 -0
- data/lib/ftp_paradise/yaml/show_full_names.yml +1 -0
- data/lib/ftp_paradise/yaml/use_colours.yml +1 -0
- data/test/testing_ftp_paradise.rb +94 -0
- data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +28 -0
- data/test/testing_the_ftp_connection_component.rb +70 -0
- data/test/testing_upload_a_local_directory.rb +10 -0
- metadata +336 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/colours/use_colours.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'ftp_paradise/configuration/configuration.rb'
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'colours'
|
13
|
+
rescue LoadError; end
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === @configuration
|
17
|
+
#
|
18
|
+
# Let's initialize the configuration here, if we have not yet
|
19
|
+
# done so.
|
20
|
+
# ========================================================================= #
|
21
|
+
if @configuration.nil? and FtpParadise.respond_to?(:initialize_configuration)
|
22
|
+
FtpParadise.initialize_configuration
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === FtpParadise.use_colours?
|
27
|
+
#
|
28
|
+
# This can be delegated towards the configuration object.
|
29
|
+
# ========================================================================= #
|
30
|
+
def self.use_colours?
|
31
|
+
if FtpParadise.respond_to?(:config?) and
|
32
|
+
FtpParadise.config?.respond_to?(:use_colours)
|
33
|
+
FtpParadise.config?.use_colours
|
34
|
+
else
|
35
|
+
true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === FtpParadise.disable_colours
|
41
|
+
#
|
42
|
+
# Use this method to disable colours.
|
43
|
+
# ========================================================================= #
|
44
|
+
def self.disable_colours
|
45
|
+
FtpParadise.config?.use_colours = false
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === use_colours?
|
50
|
+
#
|
51
|
+
# Whether we will use colours or whether we will not.
|
52
|
+
# ========================================================================= #
|
53
|
+
def use_colours?
|
54
|
+
FtpParadise.use_colours?
|
55
|
+
end
|
56
|
+
|
57
|
+
# ========================================================================= #
|
58
|
+
# === If we use colours in this project
|
59
|
+
# ========================================================================= #
|
60
|
+
if use_colours?
|
61
|
+
# ======================================================================= #
|
62
|
+
# And we can also set the default-colours to use.
|
63
|
+
# ======================================================================= #
|
64
|
+
if Object.const_defined?(:Colours) and
|
65
|
+
Colours.respond_to?(:assign_new_colour_codes)
|
66
|
+
Colours.update_the_colour_codes_with({
|
67
|
+
default_colour: :green,
|
68
|
+
sfile: :brown,
|
69
|
+
sdir: :chocolate,
|
70
|
+
swarn: :red,
|
71
|
+
simportant: :bold_yellow,
|
72
|
+
})
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen-string-literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/configuration/configuration.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'ftp_paradise/project/project.rb'
|
10
|
+
|
11
|
+
begin # Try to make use of Roebe::Configuration next.
|
12
|
+
require 'roebe/configuration/configuration.rb'
|
13
|
+
rescue LoadError; end
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === @configuration
|
17
|
+
# ========================================================================= #
|
18
|
+
@configuration = nil
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === FtpParadise.initialize
|
22
|
+
#
|
23
|
+
# This method will assign to the general configuration object stored
|
24
|
+
# in the variable @configuration.
|
25
|
+
# ========================================================================= #
|
26
|
+
def self.initialize
|
27
|
+
if Object.const_defined? :Roebe
|
28
|
+
# ===================================================================== #
|
29
|
+
# Load up all .yml files from the path to the yaml directory:
|
30
|
+
# ===================================================================== #
|
31
|
+
@configuration = ::Roebe::Configuration::Configuration.new(FtpParadise.yaml_directory?)
|
32
|
+
end
|
33
|
+
end; self.instance_eval { alias initialize_configuration initialize } # === FtpParadise.initialize_configuration
|
34
|
+
|
35
|
+
# ========================================================================= #
|
36
|
+
# === Initialize the Configuration object here
|
37
|
+
# ========================================================================= #
|
38
|
+
FtpParadise.initialize_configuration if @configuration
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === FtpParadise.config?
|
42
|
+
#
|
43
|
+
# Query method towards the Configuration object.
|
44
|
+
# ========================================================================= #
|
45
|
+
def self.config?
|
46
|
+
@configuration
|
47
|
+
end; self.class { alias configuration? config? } # === FtpParadise.configuration?
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This directory contains code for an "FTP connection".
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This is the "connection class". It will have methods that can be use
|
6
|
+
# when we are connected to a remote site (via the FTP protocol).
|
7
|
+
#
|
8
|
+
# Rather than keeping FTP-related state within this class, such as remote
|
9
|
+
# URL and such, we will instead use FtpParadise module methods.
|
10
|
+
# =========================================================================== #
|
11
|
+
# Possible errors and failures when we are trying to connect:
|
12
|
+
#
|
13
|
+
# Net::FTPPermError: 530 Please login with USER and PASS.
|
14
|
+
#
|
15
|
+
# Net::FTPConnectionError is raised if we are no longer connected to
|
16
|
+
# the remote FTP site.
|
17
|
+
#
|
18
|
+
# Errno::ETIMEDOUT is raised when a timeout event occurred.
|
19
|
+
# =========================================================================== #
|
20
|
+
# The official documentation for Ruby-FTP can be found here:
|
21
|
+
#
|
22
|
+
# https://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/Net/FTP.html
|
23
|
+
#
|
24
|
+
# =========================================================================== #
|
25
|
+
require 'ftp_paradise/connection/initialize.rb'
|
26
|
+
require 'ftp_paradise/connection/data.rb'
|
27
|
+
require 'ftp_paradise/connection/debug.rb'
|
28
|
+
require 'ftp_paradise/connection/misc.rb'
|
29
|
+
require 'ftp_paradise/connection/notify.rb'
|
30
|
+
require 'ftp_paradise/connection/remote_pwd.rb'
|
31
|
+
require 'ftp_paradise/connection/remove.rb'
|
32
|
+
require 'ftp_paradise/connection/show.rb'
|
33
|
+
require 'ftp_paradise/connection/upload.rb'
|
34
|
+
require 'ftp_paradise/version/version.rb'
|
35
|
+
require 'ftp_paradise/configuration/configuration.rb'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/connection/constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
class Connection
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === NAMESPACE
|
13
|
+
# ========================================================================= #
|
14
|
+
NAMESPACE = inspect
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === BE_VERBOSE
|
18
|
+
# ========================================================================= #
|
19
|
+
BE_VERBOSE = true
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === DEFAULT_TRANSFER_MODE
|
23
|
+
# ========================================================================= #
|
24
|
+
DEFAULT_TRANSFER_MODE = :ascii # Which transfer mode to use by default.
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === DEFAULT_PORT
|
28
|
+
# ========================================================================= #
|
29
|
+
DEFAULT_PORT = 21
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === RUN_ALREADY
|
33
|
+
# ========================================================================= #
|
34
|
+
RUN_ALREADY = true
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === DEFAULT_USER_NAME
|
38
|
+
#
|
39
|
+
# In the past this was set to a String (the user name); but since as
|
40
|
+
# of October 2018, it will default to nil, so that we really initialize
|
41
|
+
# the whole project to a nil-state (as the default). This thus allows
|
42
|
+
# us to determine whether this has been changed, aka initialized.
|
43
|
+
# ========================================================================= #
|
44
|
+
DEFAULT_USER_NAME = nil
|
45
|
+
|
46
|
+
end; end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/connection/data.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
class Connection
|
10
|
+
|
11
|
+
require 'ftp_paradise/constants/roebe.rb'
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === set_data (all in one, set_data tag)
|
15
|
+
#
|
16
|
+
# This method sets:
|
17
|
+
#
|
18
|
+
# - host
|
19
|
+
# - user name
|
20
|
+
# - port and
|
21
|
+
# - password
|
22
|
+
#
|
23
|
+
# This method is thus a nifty little convenience method. You can pass
|
24
|
+
# a hash to it too, which is the recommended way to use this method.
|
25
|
+
#
|
26
|
+
# You can also use an Array (with 4 elements), in which case we will
|
27
|
+
# process it one after the other. The reason for this procedure is
|
28
|
+
# because we can also use yaml files that way, that also use the
|
29
|
+
# exact order of elements.
|
30
|
+
#
|
31
|
+
# If you add a new entry to the case menu below, also add this to
|
32
|
+
# ARRAY_AVAILABLE_HOSTS, please. That Array can be found in the
|
33
|
+
# file 'constants/roebe_ftp_constants.rb'.
|
34
|
+
# ========================================================================= #
|
35
|
+
def set_data(
|
36
|
+
i = 'default'
|
37
|
+
) # set the default here.
|
38
|
+
if debug?
|
39
|
+
opnn; e 'We will debug next, as the @debug variable was set to true.'
|
40
|
+
pp i
|
41
|
+
end
|
42
|
+
# ======================================================================= #
|
43
|
+
# === Handle Hash as input first
|
44
|
+
# ======================================================================= #
|
45
|
+
if i.is_a? Hash # Hash is treated differently.
|
46
|
+
|
47
|
+
# ===================================================================== #
|
48
|
+
# === :host
|
49
|
+
# ===================================================================== #
|
50
|
+
if i.has_key? :host
|
51
|
+
set_host i.fetch(:host)
|
52
|
+
elsif i.has_key? :remote_host
|
53
|
+
set_host i.fetch(:remote_host)
|
54
|
+
elsif i.has_key? :to # :to is an alias to :host.
|
55
|
+
set_host i.fetch(:to)
|
56
|
+
end
|
57
|
+
|
58
|
+
# ===================================================================== #
|
59
|
+
# === :user_name
|
60
|
+
# ===================================================================== #
|
61
|
+
if i.has_key? :user_name
|
62
|
+
set_user_name i.fetch(:user_name)
|
63
|
+
elsif i.has_key? :login_name
|
64
|
+
set_user_name i.fetch(:login_name)
|
65
|
+
end
|
66
|
+
|
67
|
+
# ===================================================================== #
|
68
|
+
# === :password
|
69
|
+
# ===================================================================== #
|
70
|
+
if i.has_key? :password
|
71
|
+
set_password i.fetch(:password)
|
72
|
+
elsif i.has_key? :login_password
|
73
|
+
set_password i.fetch(:login_password)
|
74
|
+
end
|
75
|
+
|
76
|
+
# ===================================================================== #
|
77
|
+
# === :port
|
78
|
+
# ===================================================================== #
|
79
|
+
if i.has_key? :port
|
80
|
+
set_port i.fetch(:port)
|
81
|
+
end
|
82
|
+
# ======================================================================= #
|
83
|
+
# === Handle Array as input next
|
84
|
+
# ======================================================================= #
|
85
|
+
elsif i.is_a? Array # Example-Array: ["ftp.byethost33.com", "b33_14144659", "1aaaaaa", 21]
|
86
|
+
set_host i.first
|
87
|
+
set_user_name i[1]
|
88
|
+
set_password i[2]
|
89
|
+
set_port i[3]
|
90
|
+
# ======================================================================= #
|
91
|
+
# === Else, use simple toggle commands, such as 1,2,3,4,5 and so forth.
|
92
|
+
# ======================================================================= #
|
93
|
+
else # In the following case menu you can toggle your FTP.
|
94
|
+
case i.to_s # Work on strings only. Assumes shortcuts.
|
95
|
+
# ===================================================================== #
|
96
|
+
# === shevy
|
97
|
+
#
|
98
|
+
# This defaults to my home system.
|
99
|
+
# ===================================================================== #
|
100
|
+
when '6',
|
101
|
+
/shevy/i,
|
102
|
+
'square',
|
103
|
+
'square7',
|
104
|
+
'bplaced',
|
105
|
+
'podserver',
|
106
|
+
'default',
|
107
|
+
'top' # Current default.
|
108
|
+
_ = FILE_ROEBE_FTP
|
109
|
+
if File.exist? _
|
110
|
+
data = YAML.load_file(_)['podserver'] # 'bplaced'
|
111
|
+
set_host data['url']
|
112
|
+
set_user_name data['user_name']
|
113
|
+
this_password = data['password']
|
114
|
+
this_password.chop! if this_password.end_with? '_'
|
115
|
+
set_password this_password
|
116
|
+
set_port data['port']
|
117
|
+
end
|
118
|
+
# ===================================================================== #
|
119
|
+
# === a1
|
120
|
+
# ===================================================================== #
|
121
|
+
when '1',
|
122
|
+
'a1',
|
123
|
+
'a1_ftp' # A1 FTP host. No longer in use but still kept.
|
124
|
+
set_host A1.first
|
125
|
+
set_user_name A1[1]
|
126
|
+
set_password A1[2]
|
127
|
+
set_port A1[3]
|
128
|
+
# ===================================================================== #
|
129
|
+
# === zymix
|
130
|
+
# ===================================================================== #
|
131
|
+
when '2',
|
132
|
+
'zymix',
|
133
|
+
'standard'
|
134
|
+
set_host ZYMIX.first
|
135
|
+
set_user_name ZYMIX[1]
|
136
|
+
set_password ZYMIX[2]
|
137
|
+
set_port ZYMIX[3]
|
138
|
+
# ===================================================================== #
|
139
|
+
# === uniwien
|
140
|
+
# ===================================================================== #
|
141
|
+
when '3',
|
142
|
+
'univie',
|
143
|
+
'uniwien' # Uni Wien FTP Account.
|
144
|
+
set_host UNIVIE.first
|
145
|
+
set_user_name UNIVIE[1]
|
146
|
+
set_password UNIVIE[2]
|
147
|
+
set_port UNIVIE[3]
|
148
|
+
# ===================================================================== #
|
149
|
+
# === byte
|
150
|
+
# ===================================================================== #
|
151
|
+
when '4',
|
152
|
+
'byte',
|
153
|
+
'bytehost'
|
154
|
+
set_host BYTEHOST.first
|
155
|
+
set_user_name BYTEHOST[1]
|
156
|
+
set_password BYTEHOST[2]
|
157
|
+
set_port BYTEHOST[3]
|
158
|
+
else
|
159
|
+
set_data(:default) # Go back to default again if not found.
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end; end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/connection/debug.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
class Connection
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === set_debug
|
13
|
+
# ========================================================================= #
|
14
|
+
def set_debug(i = SHALL_WE_DEBUG)
|
15
|
+
@internal_hash[:debug] = i
|
16
|
+
end
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === enable_debug_mode
|
20
|
+
#
|
21
|
+
# When the debug mode is set to true, then all traffic to and from
|
22
|
+
# the server is written to $stdout. By default, this will NOT
|
23
|
+
# be the case.
|
24
|
+
# ========================================================================= #
|
25
|
+
def enable_debug_mode
|
26
|
+
ftp_object?.debug_mode = true
|
27
|
+
end
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === enable_debug
|
31
|
+
#
|
32
|
+
# Set the @debug variable to true, and also invoke enable_debug_mode().
|
33
|
+
# ========================================================================= #
|
34
|
+
def enable_debug
|
35
|
+
enable_debug_mode
|
36
|
+
set_debug(true)
|
37
|
+
end
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === debug?
|
41
|
+
# ========================================================================= #
|
42
|
+
def debug?
|
43
|
+
@internal_hash[:debug]
|
44
|
+
end
|
45
|
+
|
46
|
+
# ========================================================================= #
|
47
|
+
# === disable_debug
|
48
|
+
# ========================================================================= #
|
49
|
+
def disable_debug
|
50
|
+
ftp_object?.debug_mode = false
|
51
|
+
@internal_hash[:debug] = false
|
52
|
+
end
|
53
|
+
|
54
|
+
# ========================================================================= #
|
55
|
+
# === debug (debug tag)
|
56
|
+
#
|
57
|
+
# This method can be used for some debugging output.
|
58
|
+
# ========================================================================= #
|
59
|
+
def debug(
|
60
|
+
shall_we_debug = debug?
|
61
|
+
)
|
62
|
+
cliner {
|
63
|
+
pp ftp?
|
64
|
+
show_host_user_name_port_and_password
|
65
|
+
update_file_listing
|
66
|
+
if shall_we_debug
|
67
|
+
opnn; e 'File Listing:'
|
68
|
+
show_file_listing
|
69
|
+
end
|
70
|
+
if remote_file_listing?.empty?
|
71
|
+
opnn; e 'No file could be found. The remote directory '\
|
72
|
+
'is most likely empty.'
|
73
|
+
end
|
74
|
+
} if shall_we_debug
|
75
|
+
end; alias feedback debug # === feedback
|
76
|
+
alias report debug # === report
|
77
|
+
|
78
|
+
end; end
|