ftp_paradise 1.4.5 → 1.5.3
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.
Potentially problematic release.
This version of ftp_paradise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +152 -28
- data/bin/{iftp → ftp_paradise_shell} +1 -1
- data/doc/README.gen +97 -15
- data/doc/todo/{TODO_FOR_FTP_PARADISE_PROJECT.md → todo_for_the_ftp_paradise_project.md} +0 -0
- data/ftp_paradise.gemspec +30 -39
- data/lib/ftp_paradise/base/base.rb +375 -0
- data/lib/ftp_paradise/colours/colours.rb +27 -27
- data/lib/ftp_paradise/colours/use_colours.rb +6 -1
- data/lib/ftp_paradise/configuration/configuration.rb +7 -4
- data/lib/ftp_paradise/connection/README.md +0 -0
- data/lib/ftp_paradise/connection/connection.rb +2782 -15
- data/lib/ftp_paradise/constants/constants.rb +91 -5
- data/lib/ftp_paradise/entry/entry.rb +42 -5
- data/lib/ftp_paradise/{connection → gui/gtk3/ftp_client}/constants.rb +33 -21
- data/lib/ftp_paradise/gui/{shared_code/ftp_paradise/ftp_paradise_module.rb → gtk3/ftp_client/ftp_client.rb} +658 -170
- data/lib/ftp_paradise/gui/gtk3/ftp_client/misc.rb +27 -0
- data/lib/ftp_paradise/project/project.rb +11 -15
- data/lib/ftp_paradise/requires/require_class_connection.rb +7 -0
- data/lib/ftp_paradise/requires/require_net_ftp.rb +7 -0
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +4 -3
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +1 -1
- data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +1 -0
- data/lib/ftp_paradise/{interactive_ftp → shell}/menu.rb +554 -448
- data/lib/ftp_paradise/shell/shell.rb +2321 -0
- data/lib/ftp_paradise/toplevel_methods/connect.rb +3 -0
- data/lib/ftp_paradise/toplevel_methods/dataset.rb +111 -0
- data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +4 -3
- data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +6 -5
- data/lib/ftp_paradise/toplevel_methods/login_name.rb +6 -4
- data/lib/ftp_paradise/toplevel_methods/misc.rb +19 -0
- data/lib/ftp_paradise/toplevel_methods/opn.rb +1 -1
- data/lib/ftp_paradise/toplevel_methods/password.rb +4 -2
- data/lib/ftp_paradise/toplevel_methods/port.rb +4 -1
- data/lib/ftp_paradise/toplevel_methods/remote_url.rb +11 -5
- data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +1 -0
- data/lib/ftp_paradise/version/version.rb +6 -1
- data/lib/ftp_paradise/www/web_interface.cgi +1 -1
- data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +0 -0
- data/lib/ftp_paradise/yaml/debug.yml +0 -0
- data/lib/ftp_paradise/yaml/open_in_default_editor.yml +0 -0
- data/lib/ftp_paradise/yaml/show_full_names.yml +0 -0
- data/lib/ftp_paradise/yaml/use_colours.yml +0 -0
- data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +13 -3
- metadata +52 -126
- data/lib/ftp_paradise/base/cliner.rb +0 -23
- data/lib/ftp_paradise/base/colours.rb +0 -83
- data/lib/ftp_paradise/base/prototype.rb +0 -171
- data/lib/ftp_paradise/base/reset.rb +0 -29
- data/lib/ftp_paradise/connection/data.rb +0 -164
- data/lib/ftp_paradise/connection/debug.rb +0 -78
- data/lib/ftp_paradise/connection/directory_handling.rb +0 -271
- data/lib/ftp_paradise/connection/do_login.rb +0 -108
- data/lib/ftp_paradise/connection/download.rb +0 -86
- data/lib/ftp_paradise/connection/file_handling.rb +0 -174
- data/lib/ftp_paradise/connection/ftp_object.rb +0 -21
- data/lib/ftp_paradise/connection/initialize.rb +0 -88
- data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +0 -20
- data/lib/ftp_paradise/connection/is_connected.rb +0 -46
- data/lib/ftp_paradise/connection/misc.rb +0 -474
- data/lib/ftp_paradise/connection/notify.rb +0 -71
- data/lib/ftp_paradise/connection/password.rb +0 -47
- data/lib/ftp_paradise/connection/port.rb +0 -33
- data/lib/ftp_paradise/connection/remote_pwd.rb +0 -72
- data/lib/ftp_paradise/connection/remote_url.rb +0 -164
- data/lib/ftp_paradise/connection/remove.rb +0 -143
- data/lib/ftp_paradise/connection/reset.rb +0 -78
- data/lib/ftp_paradise/connection/run.rb +0 -18
- data/lib/ftp_paradise/connection/set_array_available_hosts.rb +0 -27
- data/lib/ftp_paradise/connection/set_input.rb +0 -18
- data/lib/ftp_paradise/connection/show.rb +0 -153
- data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +0 -24
- data/lib/ftp_paradise/connection/transfer_mode.rb +0 -163
- data/lib/ftp_paradise/connection/upload.rb +0 -253
- data/lib/ftp_paradise/connection/use_default_dataset.rb +0 -40
- data/lib/ftp_paradise/connection/username.rb +0 -42
- data/lib/ftp_paradise/constants/misc.rb +0 -57
- data/lib/ftp_paradise/constants/namespace.rb +0 -14
- data/lib/ftp_paradise/constants/newline.rb +0 -14
- data/lib/ftp_paradise/constants/roebe.rb +0 -31
- data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +0 -233
- data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +0 -34
- data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +0 -34
- data/lib/ftp_paradise/interactive_ftp/constants.rb +0 -103
- data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +0 -216
- data/lib/ftp_paradise/interactive_ftp/help.rb +0 -50
- data/lib/ftp_paradise/interactive_ftp/initialize.rb +0 -27
- data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +0 -998
- data/lib/ftp_paradise/interactive_ftp/main_loop.rb +0 -51
- data/lib/ftp_paradise/interactive_ftp/misc.rb +0 -208
- data/lib/ftp_paradise/interactive_ftp/mode.rb +0 -124
- data/lib/ftp_paradise/interactive_ftp/readline.rb +0 -113
- data/lib/ftp_paradise/interactive_ftp/remove.rb +0 -97
- data/lib/ftp_paradise/interactive_ftp/reset.rb +0 -90
- data/lib/ftp_paradise/interactive_ftp/run.rb +0 -22
- data/lib/ftp_paradise/interactive_ftp/show.rb +0 -184
- data/lib/ftp_paradise/interactive_ftp/upload.rb +0 -90
- data/lib/ftp_paradise/interactive_ftp/user_input.rb +0 -53
- data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +0 -28
- data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +0 -28
- data/lib/ftp_paradise/toplevel_methods/data.rb +0 -31
- data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +0 -37
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/interactive_ftp/run.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class InteractiveFtp # === FtpParadise::InteractiveFtp
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === run
|
13
|
-
# ========================================================================= #
|
14
|
-
def run
|
15
|
-
set_passive :be_verbose
|
16
|
-
pass_commandline_arguments_into_the_menu # <- Must come before startup_actions().
|
17
|
-
startup_actions
|
18
|
-
do_login # Next, login.
|
19
|
-
enter_main_loop
|
20
|
-
end
|
21
|
-
|
22
|
-
end; end
|
@@ -1,184 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/interactive_ftp/show.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class InteractiveFtp
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === show_remote_directories
|
13
|
-
# ========================================================================= #
|
14
|
-
def show_remote_directories
|
15
|
-
e "The remote directories at #{sdir(return_remote_pwd)} are:"
|
16
|
-
e
|
17
|
-
ftp?.return_remote_directories.each_with_index {|dir, index|
|
18
|
-
index += 1
|
19
|
-
e index.to_s.rjust(3)+') '+sdir(dir)
|
20
|
-
}
|
21
|
-
e
|
22
|
-
end
|
23
|
-
|
24
|
-
# ========================================================================= #
|
25
|
-
# === show_remote_files
|
26
|
-
#
|
27
|
-
# Use this method to show all remote files on a FTP site.
|
28
|
-
# ========================================================================= #
|
29
|
-
def show_remote_files(
|
30
|
-
mode = nil
|
31
|
-
) # Show the content of the remote host.
|
32
|
-
ftp?.show_remote_files
|
33
|
-
end
|
34
|
-
|
35
|
-
# ========================================================================= #
|
36
|
-
# === show_hosts
|
37
|
-
# ========================================================================= #
|
38
|
-
def show_hosts
|
39
|
-
e "The available hosts are:#{N}#{N}"
|
40
|
-
ftp?.array_available_hosts.each {|host|
|
41
|
-
e simp(" #{host}")
|
42
|
-
}; e
|
43
|
-
end
|
44
|
-
|
45
|
-
# ========================================================================= #
|
46
|
-
# === show_remote_listing
|
47
|
-
#
|
48
|
-
# This will display the remote file listing.
|
49
|
-
# ========================================================================= #
|
50
|
-
def show_remote_listing
|
51
|
-
ftp?.show_remote_listing
|
52
|
-
end
|
53
|
-
|
54
|
-
# ========================================================================= #
|
55
|
-
# === show_status
|
56
|
-
# ========================================================================= #
|
57
|
-
def show_status
|
58
|
-
cliner {
|
59
|
-
# e
|
60
|
-
# show_help # <- Disabled as of May 2017.
|
61
|
-
e
|
62
|
-
report_where_we_are_connected_to
|
63
|
-
report_remote_directory # Added Dec 2011.
|
64
|
-
report_local_dir
|
65
|
-
# debug_it
|
66
|
-
e
|
67
|
-
}
|
68
|
-
end
|
69
|
-
|
70
|
-
# ========================================================================= #
|
71
|
-
# === show_title
|
72
|
-
#
|
73
|
-
# Use this method to give us the title
|
74
|
-
# ========================================================================= #
|
75
|
-
def show_title
|
76
|
-
e return_title
|
77
|
-
end
|
78
|
-
|
79
|
-
# ========================================================================= #
|
80
|
-
# === show_history
|
81
|
-
#
|
82
|
-
# This method can be used to display the input-history of the user.
|
83
|
-
# ========================================================================= #
|
84
|
-
def show_history # History tag.
|
85
|
-
e "The history for #{sfancy(return_title)} is:"
|
86
|
-
@history.each_with_index { |key, index|
|
87
|
-
e '%3s' % (index+1).to_s+' '+key
|
88
|
-
}
|
89
|
-
end
|
90
|
-
|
91
|
-
# ========================================================================= #
|
92
|
-
# === show_which_files_we_did_download_so_far
|
93
|
-
# ========================================================================= #
|
94
|
-
def show_which_files_we_did_download_so_far
|
95
|
-
if @array_downloaded_files.empty?
|
96
|
-
e 'We did not yet download any file.'
|
97
|
-
else
|
98
|
-
e 'We downloaded these files so far:'
|
99
|
-
pp @array_downloaded_files
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
# ========================================================================= #
|
104
|
-
# === show_ftp_docu
|
105
|
-
#
|
106
|
-
# This method will show where to find ruby's ftp docu.
|
107
|
-
# ========================================================================= #
|
108
|
-
def show_ftp_docu
|
109
|
-
e
|
110
|
-
e ' https://www.ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/Net/FTP.html'
|
111
|
-
e
|
112
|
-
end
|
113
|
-
|
114
|
-
# ========================================================================= #
|
115
|
-
# === show_ftp_yaml_file
|
116
|
-
# ========================================================================= #
|
117
|
-
def show_ftp_yaml_file
|
118
|
-
e 'The yaml file in question can be found at:'
|
119
|
-
e
|
120
|
-
e " #{sfile(FILE_ROEBE_FTP)}"
|
121
|
-
e
|
122
|
-
end
|
123
|
-
|
124
|
-
# ========================================================================= #
|
125
|
-
# === show_modtime_of
|
126
|
-
# ========================================================================= #
|
127
|
-
def show_modtime_of(i)
|
128
|
-
e "The modification time of #{sfile(i)} is:"
|
129
|
-
e
|
130
|
-
e ' '+sfancy(ftp?.modification_time_of?(i))
|
131
|
-
e
|
132
|
-
end
|
133
|
-
|
134
|
-
# ========================================================================= #
|
135
|
-
# === display_configuration_options (show config tag)
|
136
|
-
#
|
137
|
-
# This method will show the configuration settings.
|
138
|
-
#
|
139
|
-
# You can invoke this in an interactive FTP session by doing this:
|
140
|
-
#
|
141
|
-
# config?
|
142
|
-
#
|
143
|
-
# ========================================================================= #
|
144
|
-
def display_configuration_options # Config tag.
|
145
|
-
cliner {
|
146
|
-
if @file.to_s.empty?
|
147
|
-
e '@file is: unassigned as of yet'
|
148
|
-
else
|
149
|
-
e '@file is: '+sfancy(@file.to_s)
|
150
|
-
end
|
151
|
-
e '@local_directory is: '+sfancy(@local_directory.to_s)
|
152
|
-
e '@splitted is: '+sfancy(@splitted.to_s)
|
153
|
-
e 'Will we use the Readline module? '+
|
154
|
-
sfancy(verbose_truth(use_readline?))
|
155
|
-
e 'Will we show full names (with full path)? '+
|
156
|
-
sfancy(verbose_truth(show_full_names?))
|
157
|
-
e 'What is the base directory? '+
|
158
|
-
sfancy(@config.base_directory.to_s)
|
159
|
-
}
|
160
|
-
end
|
161
|
-
|
162
|
-
# ========================================================================= #
|
163
|
-
# === show_available_connections
|
164
|
-
# ========================================================================= #
|
165
|
-
def show_available_connections(
|
166
|
-
i = ARRAY_AVAILABLE_HOSTS
|
167
|
-
)
|
168
|
-
i.each_with_index {|entry, index|
|
169
|
-
e "#{index} #{entry}"
|
170
|
-
} if Object.const_defined? :RoebeFtpConstants
|
171
|
-
end
|
172
|
-
|
173
|
-
# ========================================================================= #
|
174
|
-
# === show_www_component
|
175
|
-
# ========================================================================= #
|
176
|
-
def show_www_component
|
177
|
-
e 'Make sure to visit:'
|
178
|
-
path = '$RSRC/ftp_paradise/lib/ftp_paradise/www/sinatra_web_interface.rb'
|
179
|
-
e " #{sfancy(path)}"
|
180
|
-
_ = get_env_of("ruby #{path}")
|
181
|
-
esystem _
|
182
|
-
end
|
183
|
-
|
184
|
-
end; end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/interactive_ftp/upload.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class InteractiveFtp # === FtpParadise::Interactive
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === upload (upload tag)
|
13
|
-
#
|
14
|
-
# Use this method to upload something locally to the remote site.
|
15
|
-
#
|
16
|
-
# You can also upload several files in one go - to do this, try
|
17
|
-
# one of these ways:
|
18
|
-
#
|
19
|
-
# upload 7,8 # This would upload file position 7 and 8.
|
20
|
-
# upload 1..293
|
21
|
-
#
|
22
|
-
# ========================================================================= #
|
23
|
-
def upload(
|
24
|
-
i = Dir['*']
|
25
|
-
)
|
26
|
-
# ======================================================================= #
|
27
|
-
# We will always work with an Array past the following point.
|
28
|
-
# ======================================================================= #
|
29
|
-
i = [i].flatten.compact # Safeguard against nil.
|
30
|
-
if i.empty?
|
31
|
-
i << @file if @file
|
32
|
-
end
|
33
|
-
i.map! {|entry|
|
34
|
-
if entry.include?('-') and !entry.include?('.') # Assume a range was given like 1-20.
|
35
|
-
splitted = entry.split('-')
|
36
|
-
entry = (splitted[0] .. splitted[1]).to_a
|
37
|
-
elsif entry.include?('..') # Assume a range such as: upload 1..25
|
38
|
-
entry =~ /(\d+)\.\.(\d+)/
|
39
|
-
start_position = $1.to_s.dup.to_i
|
40
|
-
end_position = $2.to_s.dup.to_i
|
41
|
-
entry = return_local_files[start_position, end_position]
|
42
|
-
elsif entry.include?(',')
|
43
|
-
splitted = i.split(',')
|
44
|
-
entry = (splitted[0] .. splitted[1]).to_a
|
45
|
-
elsif (entry == 'ALL') or (entry == '*')
|
46
|
-
entry = Dir['*']
|
47
|
-
elsif entry.include?('*.') or entry.include?('*')
|
48
|
-
entry = Dir[entry]
|
49
|
-
end
|
50
|
-
entry
|
51
|
-
}
|
52
|
-
i.flatten!
|
53
|
-
i.compact!
|
54
|
-
if on_roebe? and !is_connected?
|
55
|
-
connect_to :shevy
|
56
|
-
end
|
57
|
-
i.each {|this_file|
|
58
|
-
if this_file =~ /^\d+$/ # upload only a specific number.
|
59
|
-
sorted = Dir['*'].sort
|
60
|
-
if i.is_a? Array
|
61
|
-
i = i.first
|
62
|
-
end
|
63
|
-
this_file = sorted[i.to_i - 1]
|
64
|
-
end
|
65
|
-
_ = this_file # default to upload to 'all'
|
66
|
-
if File.exist?(_)
|
67
|
-
# =================================================================== #
|
68
|
-
# Next, some files will always be in binary mode. These are
|
69
|
-
# defined in the Array ARRAY_BINARY_FILES.
|
70
|
-
# =================================================================== #
|
71
|
-
if ARRAY_BINARY_FILES.include?(File.extname(_).delete('.')) and
|
72
|
-
(@mode != :binary)
|
73
|
-
use_binary_mode
|
74
|
-
end
|
75
|
-
case @mode
|
76
|
-
when :ascii
|
77
|
-
set_file(_)
|
78
|
-
ftp?.upload(_) # And now, call the functionality in the FTP lib.
|
79
|
-
else
|
80
|
-
ftp?.upload_binary(_)
|
81
|
-
end
|
82
|
-
else
|
83
|
-
opne swarn('But the file `')+
|
84
|
-
sfile(i)+
|
85
|
-
swarn('` does not exist.')
|
86
|
-
end
|
87
|
-
}
|
88
|
-
end
|
89
|
-
|
90
|
-
end; end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/interactive_ftp/user_input.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class InteractiveFtp # === FtpParadise::InteractiveFtp
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === obtain_user_input
|
13
|
-
#
|
14
|
-
# This method will obtain user input, and assign it to the variable
|
15
|
-
# @user_input.
|
16
|
-
# ========================================================================= #
|
17
|
-
def obtain_user_input
|
18
|
-
if @use_readline
|
19
|
-
user_input = Readline.readline('', true)
|
20
|
-
Readline::HISTORY.pop if user_input.strip.empty?
|
21
|
-
else
|
22
|
-
user_input = $stdin.gets.chomp
|
23
|
-
end
|
24
|
-
# ======================================================================= #
|
25
|
-
# Get rid of potential '#' comments in the input.
|
26
|
-
# ======================================================================= #
|
27
|
-
if user_input.include? '#'
|
28
|
-
user_input = user_input[0 .. user_input.index('#')-1]
|
29
|
-
end
|
30
|
-
user_input.strip! # Get rid of ' ' empty characters.
|
31
|
-
_ = user_input
|
32
|
-
unless _.empty? # append to history.
|
33
|
-
try_to_append_this_to_the_history(_)
|
34
|
-
end
|
35
|
-
# ======================================================================= #
|
36
|
-
# If the user did input a ';' character then we will assume that he
|
37
|
-
# wants to send multiple commands. We will however NOT assume so
|
38
|
-
# if the string also includes a 'http://' - in that case, we assume
|
39
|
-
# a HTTP URL instead.
|
40
|
-
# ======================================================================= #
|
41
|
-
if user_input.include? ';' and !user_input.include?('http://')
|
42
|
-
user_input = user_input.split(';')
|
43
|
-
else
|
44
|
-
user_input = [user_input] # In this case simply turn it into an Array.
|
45
|
-
end
|
46
|
-
# ======================================================================= #
|
47
|
-
# The @user_input variable should always be an Array.
|
48
|
-
# ======================================================================= #
|
49
|
-
@user_input = user_input
|
50
|
-
end; alias get_user_input obtain_user_input # === get_user_input
|
51
|
-
alias fetch_user_input obtain_user_input # === fetch_user_input
|
52
|
-
|
53
|
-
end; end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
# ========================================================================= #
|
10
|
-
# === FtpParadise.can_connect_to_remote_site?
|
11
|
-
#
|
12
|
-
# This method can be used to query whether we can connect to a remote
|
13
|
-
# website via the FtpParadise project.
|
14
|
-
#
|
15
|
-
# The method will return a boolean: either true or false.
|
16
|
-
# ========================================================================= #
|
17
|
-
def self.can_connect_to_remote_site?
|
18
|
-
require 'ftp_paradise/connection/connection.rb'
|
19
|
-
ftp = FtpParadise::Connection.new(:dont_run_yet) { :use_default_dataset }
|
20
|
-
ftp.be_quiet
|
21
|
-
return ftp.is_connected?
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
if __FILE__ == $PROGRAM_NAME
|
27
|
-
p FtpParadise.can_connect_to_remote_site?
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/toplevel_methods/clear_user_dataset.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
require 'ftp_paradise/toplevel_methods/login_name.rb'
|
10
|
-
require 'ftp_paradise/toplevel_methods/password.rb'
|
11
|
-
require 'ftp_paradise/toplevel_methods/remote_url.rb'
|
12
|
-
|
13
|
-
# ========================================================================= #
|
14
|
-
# === FtpParadise.clear_user_dataset
|
15
|
-
#
|
16
|
-
# This method will reset the user-dataset to nil again, that is,
|
17
|
-
# user name, password and remote url.
|
18
|
-
#
|
19
|
-
# This method had to be added so that we can easily clean-up on
|
20
|
-
# a disconnect-action.
|
21
|
-
# ========================================================================= #
|
22
|
-
def self.clear_user_dataset
|
23
|
-
FtpParadise.set_remote_url(nil)
|
24
|
-
FtpParadise.set_user_name(nil)
|
25
|
-
FtpParadise.set_password(nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/toplevel_methods/data.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
require 'ftp_paradise/toplevel_methods/login_name.rb'
|
10
|
-
require 'ftp_paradise/toplevel_methods/password.rb'
|
11
|
-
require 'ftp_paradise/toplevel_methods/remote_url.rb'
|
12
|
-
|
13
|
-
# ========================================================================= #
|
14
|
-
# === FtpParadise.data?
|
15
|
-
#
|
16
|
-
# This method will return the name of the user; the password; and the
|
17
|
-
# remote URL. It is mostly just a convenience method.
|
18
|
-
# ========================================================================= #
|
19
|
-
def self.data?
|
20
|
-
{
|
21
|
-
user_name: FtpParadise.username?,
|
22
|
-
password: FtpParadise.password?,
|
23
|
-
remote_url: FtpParadise.remote_url?
|
24
|
-
}
|
25
|
-
end; self.instance_eval { alias dataset? data? } # === FtpParadise.dataset?
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
if __FILE__ == $PROGRAM_NAME
|
30
|
-
pp FtpParadise.data?
|
31
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
require 'ftp_paradise/toplevel_methods/login_name.rb'
|
10
|
-
require 'ftp_paradise/toplevel_methods/remote_url.rb'
|
11
|
-
require 'ftp_paradise/toplevel_methods/password.rb'
|
12
|
-
|
13
|
-
# ========================================================================= #
|
14
|
-
# === FtpParadise.determine_user_dataset_from_this_hash
|
15
|
-
#
|
16
|
-
# This method can set relevant entries from an input Hash.
|
17
|
-
#
|
18
|
-
# The IDs should be 'url', 'user_name' and 'password'.
|
19
|
-
# ========================================================================= #
|
20
|
-
def self.determine_user_dataset_from_this_hash(i)
|
21
|
-
if i.is_a? Hash
|
22
|
-
if i.has_key? 'url'
|
23
|
-
_ = i.fetch('url')
|
24
|
-
FtpParadise.set_remote_url(_)
|
25
|
-
end
|
26
|
-
if i.has_key? 'user_name'
|
27
|
-
_ = i.fetch('user_name')
|
28
|
-
FtpParadise.set_user_name(_)
|
29
|
-
end
|
30
|
-
if i.has_key? 'password'
|
31
|
-
_ = i.fetch('password')
|
32
|
-
FtpParadise.set_password(_)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|