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,86 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/download.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === download_binary_file
|
13
|
-
#
|
14
|
-
# Use this method to download a binary file, by calling the method
|
15
|
-
# getbinaryfile(). You can download as many files as you want to
|
16
|
-
# through this method, but we expect this method to be a binary
|
17
|
-
# file.
|
18
|
-
#
|
19
|
-
# Specific usage example:
|
20
|
-
#
|
21
|
-
# ftp?.download_binary_file('photos_2009-03-29.zip', 'ftp_photos/photos.zip')
|
22
|
-
#
|
23
|
-
# ========================================================================= #
|
24
|
-
def download_binary_file(
|
25
|
-
i,
|
26
|
-
be_verbose = be_verbose?
|
27
|
-
)
|
28
|
-
if i.is_a? Array
|
29
|
-
i.each {|entry| download_binary_file(entry) }
|
30
|
-
else
|
31
|
-
ftp?.getbinaryfile(i) # Delegate towards .getbinaryfile()
|
32
|
-
if be_verbose
|
33
|
-
e "Downloaded file #{sfile(i)}."
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end; alias getbinaryfile download_binary_file # === getbinaryfile
|
37
|
-
|
38
|
-
# ========================================================================= #
|
39
|
-
# === download_remote_file (download tag)
|
40
|
-
#
|
41
|
-
# Use this method to download a remote file. If you are sure to have
|
42
|
-
# a binary file, the method download_binary_file() could be used
|
43
|
-
# instead.
|
44
|
-
#
|
45
|
-
# gettextfile(remotefile, localfile = File.basename(remotefile)) {|line| ...}
|
46
|
-
# ========================================================================= #
|
47
|
-
def download_remote_file(
|
48
|
-
i, be_verbose = be_verbose?
|
49
|
-
)
|
50
|
-
if i.is_a? Array # Handle arrays first.
|
51
|
-
i.each {|entry| download_remote_file(entry, be_verbose) }
|
52
|
-
else
|
53
|
-
if i =~ /^\d+$/ # if is a number
|
54
|
-
update_file_listing
|
55
|
-
i = return_remote_files[i.to_i - 1].first
|
56
|
-
end
|
57
|
-
if i == '*' # Here we want to download all files, as we passed in '*'.
|
58
|
-
i = []
|
59
|
-
update_file_listing
|
60
|
-
return_remote_files.each { |a,b| i << FtpParadise.rds(a) }
|
61
|
-
end
|
62
|
-
if be_verbose
|
63
|
-
notify_the_user_about(i, __method__)
|
64
|
-
end
|
65
|
-
set_file(i) # This assigns to @internal_hash[:file].
|
66
|
-
begin # We can use @file because we called set_file() before.
|
67
|
-
ftp_object?.gettextfile(file?)
|
68
|
-
basename = File.basename(file?)
|
69
|
-
e "Finished downloading `#{sandybrown(file?)}`"
|
70
|
-
e 'into `'+sdir(rds(Dir.pwd+'/'+basename))+'`.'
|
71
|
-
return file?
|
72
|
-
rescue Net::FTPPermError => error
|
73
|
-
pp error
|
74
|
-
e 'An exception occurred in the method '+sfancy('download()')+'.'
|
75
|
-
e 'The error was a '+sfancy('Permission Error')+', the input '\
|
76
|
-
'to the method was: `'+simp(i)+'`.'
|
77
|
-
e 'Is the file that you are trying to download really '\
|
78
|
-
'existing on the remote server?'
|
79
|
-
return false
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end; alias download download_remote_file # === download
|
83
|
-
alias download_this_remote_file download_remote_file # === download_this_remote_file
|
84
|
-
alias download_this_file download_remote_file # === download_this_file
|
85
|
-
|
86
|
-
end; end
|
@@ -1,174 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/file_handling.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === create_remote_file (touch tag)
|
13
|
-
#
|
14
|
-
# This "touches" a remote file.
|
15
|
-
# ========================================================================= #
|
16
|
-
def create_remote_file(
|
17
|
-
i,
|
18
|
-
be_verbose = be_verbose?
|
19
|
-
)
|
20
|
-
if i.is_a? Array
|
21
|
-
i.each {|entry| create_remote_file(entry, be_verbose) }
|
22
|
-
else
|
23
|
-
FileUtils.touch(i)
|
24
|
-
if be_verbose
|
25
|
-
notify_the_user_about(i, __method__)
|
26
|
-
end
|
27
|
-
upload_this_text_file(i, :be_quiet)
|
28
|
-
File.delete(i) if File.zero? i # And get rid of that file too.
|
29
|
-
end
|
30
|
-
end; alias touch create_remote_file # === touch
|
31
|
-
|
32
|
-
# ========================================================================= #
|
33
|
-
# === fancy_remote_listing
|
34
|
-
#
|
35
|
-
# This method will obtain the (remote) directory listing and then
|
36
|
-
# display it.
|
37
|
-
# ========================================================================= #
|
38
|
-
def fancy_remote_listing(
|
39
|
-
be_verbose = be_verbose?
|
40
|
-
)
|
41
|
-
update_file_listing
|
42
|
-
case be_verbose
|
43
|
-
when :be_silent,
|
44
|
-
:be_quiet
|
45
|
-
be_verbose = false
|
46
|
-
when :also_show_filesize
|
47
|
-
be_verbose = true
|
48
|
-
end
|
49
|
-
if be_verbose
|
50
|
-
e ('=' * 55)+' '+
|
51
|
-
FtpParadise.yellow('REMOTE FILES')+' '+('=' * 12)
|
52
|
-
if remote_directory_is_empty?
|
53
|
-
e "Remote `#{sdir(remote_path?)}` is empty."
|
54
|
-
e 'No files or directories can be found therein.'
|
55
|
-
else
|
56
|
-
e 'Remote content of `'+sdir(remote_path?)+'` is:'+N+N
|
57
|
-
e 'Index Filename '\
|
58
|
-
' Filesize'
|
59
|
-
show_remote_file_listing
|
60
|
-
end
|
61
|
-
cliner
|
62
|
-
end
|
63
|
-
return remote_directory_content
|
64
|
-
end
|
65
|
-
|
66
|
-
# ========================================================================= #
|
67
|
-
# === rename
|
68
|
-
#
|
69
|
-
# This method will attempt to rename a file on the remote server.
|
70
|
-
#
|
71
|
-
# Note that this is equivalent to moving a file, which is why the alias
|
72
|
-
# move_file can also be used. Any move-file actioni s simply a rename()
|
73
|
-
# action.
|
74
|
-
#
|
75
|
-
# The first argument passed to this method should be the name of an
|
76
|
-
# existing (remote) file. The second second argument should be the
|
77
|
-
# new name of that file, or its full (remote) path.
|
78
|
-
#
|
79
|
-
# Also note that it seems as if the FTP protocol requires the full
|
80
|
-
# target location, otherwise errors such as the following might
|
81
|
-
# happen:
|
82
|
-
#
|
83
|
-
# ftp.rb in `getresp': 451 Rename/move failure: Is a directory (Net::FTPTempError)
|
84
|
-
#
|
85
|
-
# The command used by .rename() command should be equivalent to this code:
|
86
|
-
#
|
87
|
-
# SITE mv oldpath newpath
|
88
|
-
#
|
89
|
-
# Documentation for the functionality can be found here:
|
90
|
-
#
|
91
|
-
# http://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/Net/FTP.html#method-i-rename
|
92
|
-
#
|
93
|
-
# ========================================================================= #
|
94
|
-
def rename(
|
95
|
-
from,
|
96
|
-
to,
|
97
|
-
be_verbose = be_verbose?
|
98
|
-
)
|
99
|
-
to = to.first if to.is_a? Array
|
100
|
-
if from.is_a? Array # Support batch-transfer.
|
101
|
-
from.each {|entry| rename(entry, to) }
|
102
|
-
else
|
103
|
-
from = rds(from)
|
104
|
-
to = rds(to)
|
105
|
-
begin
|
106
|
-
ftp_object?.rename(from, to)
|
107
|
-
if be_verbose
|
108
|
-
opnn; e "Renamed the remote entry `#{sfancy(from)}"\
|
109
|
-
"` to `#{sfancy(to)}`."
|
110
|
-
end
|
111
|
-
rescue Net::FTPTempError => error
|
112
|
-
e "An error (#{simp('Net::FTPTempError')}) occurred "\
|
113
|
-
"in the method #{simp('rename()')}:"
|
114
|
-
pp error
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end; alias rename_file rename # === rename_file
|
118
|
-
alias move_file rename # === move_file
|
119
|
-
alias rename_remote_file rename # === rename_remote_file
|
120
|
-
|
121
|
-
# ========================================================================= #
|
122
|
-
# === update_remote_file_listing
|
123
|
-
# ========================================================================= #
|
124
|
-
def update_remote_file_listing(
|
125
|
-
be_verbose = be_verbose?
|
126
|
-
)
|
127
|
-
case be_verbose
|
128
|
-
when :be_quiet
|
129
|
-
be_verbose = false
|
130
|
-
end
|
131
|
-
if is_connected?
|
132
|
-
begin
|
133
|
-
# =================================================================== #
|
134
|
-
# Make use of a method that will skip a few entries, such as
|
135
|
-
# "." or "..".
|
136
|
-
# =================================================================== #
|
137
|
-
@internal_hash[:raw_entries] = return_slightly_sanitized_entries_ignoring_a_few
|
138
|
-
rescue Exception => error
|
139
|
-
opnn; e swarn('An error happened in the method '\
|
140
|
-
'update_remote_file_listing(), at '\
|
141
|
-
'line: '+__LINE__.to_s+'.')
|
142
|
-
pp error.class
|
143
|
-
pp error
|
144
|
-
end
|
145
|
-
else
|
146
|
-
if be_verbose
|
147
|
-
opnn; e 'Can not update the remote file listing '\
|
148
|
-
'because we are not connected.'
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end; alias update_file_listing update_remote_file_listing # === update_file_listing
|
152
|
-
alias update_raw_listing update_remote_file_listing # === update_raw_listing
|
153
|
-
alias get_listing update_remote_file_listing # === get_listing
|
154
|
-
alias get_remote_listing update_remote_file_listing # === get_remote_listing
|
155
|
-
alias update update_remote_file_listing # === update
|
156
|
-
|
157
|
-
# ========================================================================= #
|
158
|
-
# === does_this_remote_file_exist?
|
159
|
-
# ========================================================================= #
|
160
|
-
def does_this_remote_file_exist?(i)
|
161
|
-
i = File.basename(i).strip
|
162
|
-
array = return_all_remote_files
|
163
|
-
if array.is_a?(Array) and
|
164
|
-
array.first.is_a?(String)
|
165
|
-
array.map! {|entry|
|
166
|
-
entry = FtpParadise::Entry.new(entry)
|
167
|
-
}
|
168
|
-
array.select! {|entry| entry.is_a_file? }
|
169
|
-
array.map! {|entry| entry.filename? }
|
170
|
-
end
|
171
|
-
return array.include?(i)
|
172
|
-
end
|
173
|
-
|
174
|
-
end; end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/ftp_object.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === ftp_object?
|
13
|
-
# ========================================================================= #
|
14
|
-
def ftp_object?
|
15
|
-
@ftp_object
|
16
|
-
end; alias net_ftp? ftp_object? # === net_ftp?
|
17
|
-
alias ftp? ftp_object? # === ftp?
|
18
|
-
alias ftp ftp_object? # === ftp?
|
19
|
-
alias ftp_object ftp_object? # === ftp_object
|
20
|
-
|
21
|
-
end; end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/initialize.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
require 'ftp_paradise/base/prototype.rb'
|
12
|
-
include ::FtpParadise::Base
|
13
|
-
|
14
|
-
require 'ftp_paradise/connection/constants.rb' # ← For the constant RUN_ALREADY
|
15
|
-
require 'ftp_paradise/connection/ftp_object.rb'
|
16
|
-
require 'ftp_paradise/connection/reset.rb'
|
17
|
-
require 'ftp_paradise/connection/run.rb'
|
18
|
-
require 'ftp_paradise/connection/set_input.rb'
|
19
|
-
require 'ftp_paradise/connection/remote_url.rb'
|
20
|
-
require 'ftp_paradise/connection/use_default_dataset.rb'
|
21
|
-
|
22
|
-
# ========================================================================= #
|
23
|
-
# === initialize
|
24
|
-
#
|
25
|
-
# The first argument to this method should be the remote host's URL.
|
26
|
-
# ========================================================================= #
|
27
|
-
def initialize(
|
28
|
-
i = ARGV,
|
29
|
-
run_already = RUN_ALREADY
|
30
|
-
)
|
31
|
-
reset
|
32
|
-
# ======================================================================= #
|
33
|
-
# - If we pass in a Hash as the first argument, then we will use
|
34
|
-
# set_data(), otherwise we will set individually it all individually.
|
35
|
-
# ======================================================================= #
|
36
|
-
if i.is_a? Hash
|
37
|
-
set_data(i)
|
38
|
-
else
|
39
|
-
set_input(i)
|
40
|
-
end
|
41
|
-
case i
|
42
|
-
when :dont_run_yet,
|
43
|
-
:do_not_run_yet
|
44
|
-
run_already = false
|
45
|
-
end
|
46
|
-
case run_already
|
47
|
-
when :dont_run_yet
|
48
|
-
run_already = false
|
49
|
-
end
|
50
|
-
if run_already.is_a? Hash
|
51
|
-
_ = run_already
|
52
|
-
if _.has_key? :connect_to_this_host
|
53
|
-
set_this_host(
|
54
|
-
_.delete(:connect_to_this_host)
|
55
|
-
)
|
56
|
-
end
|
57
|
-
run_already = RUN_ALREADY # Restore to the default in this case.
|
58
|
-
end
|
59
|
-
if block_given?
|
60
|
-
yielded = yield
|
61
|
-
case yielded
|
62
|
-
# ===================================================================== #
|
63
|
-
# === :do_not_run_yet
|
64
|
-
# ===================================================================== #
|
65
|
-
when :do_not_run_yet
|
66
|
-
run_already = false
|
67
|
-
# ===================================================================== #
|
68
|
-
# The "default" dataset defaults to my personal FTP login dataset.
|
69
|
-
# ===================================================================== #
|
70
|
-
when :use_default_dataset,
|
71
|
-
:default_dataset,
|
72
|
-
:default
|
73
|
-
use_default_dataset
|
74
|
-
end
|
75
|
-
end
|
76
|
-
run if run_already
|
77
|
-
end
|
78
|
-
|
79
|
-
# ========================================================================= #
|
80
|
-
# === initialize_a_new_net_ftp_object_with_this_remote_url
|
81
|
-
#
|
82
|
-
# This method is the only one allowed to create a new Net::FTP instance.
|
83
|
-
# ========================================================================= #
|
84
|
-
def initialize_a_new_net_ftp_object_with_this_remote_url(i)
|
85
|
-
@ftp_object = Net::FTP.new(i) # ftp = Net::FTP.new(YAML.load_file(ENV['FTP_YAML_FILE'])['freehosting']['url'])
|
86
|
-
end; alias initialize_a_new_net_ftp_object initialize_a_new_net_ftp_object_with_this_remote_url # === initialize_a_new_net_ftp_object
|
87
|
-
|
88
|
-
end; end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
require 'net/ftp'
|
12
|
-
|
13
|
-
# ========================================================================= #
|
14
|
-
# === initialize_a_new_net_ftp_object_with_this_url
|
15
|
-
# ========================================================================= #
|
16
|
-
def initialize_a_new_net_ftp_object_with_this_url(this_url)
|
17
|
-
@ftp_object = Net::FTP.new(this_url)
|
18
|
-
end
|
19
|
-
|
20
|
-
end; end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'ftp_paradise/connection/is_connected.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module FtpParadise
|
8
|
-
|
9
|
-
class Connection
|
10
|
-
|
11
|
-
require 'ftp_paradise/connection/ftp_object.rb'
|
12
|
-
|
13
|
-
# ========================================================================= #
|
14
|
-
# === closed?
|
15
|
-
#
|
16
|
-
# Returns true if the connection to our remote host is closed.
|
17
|
-
# ========================================================================= #
|
18
|
-
def closed?
|
19
|
-
begin
|
20
|
-
ftp_object?.closed? if ftp_object?
|
21
|
-
rescue Net::FTPConnectionError
|
22
|
-
true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# ========================================================================= #
|
27
|
-
# === open?
|
28
|
-
#
|
29
|
-
# This method can also be used to determine whether we are still
|
30
|
-
# connected to the remote site.
|
31
|
-
#
|
32
|
-
# This method will return true if the connection is open.
|
33
|
-
#
|
34
|
-
# If you want to determine whether you are still connected to the
|
35
|
-
# remote host, you can alias use the alias are_we_connected? - it
|
36
|
-
# may read nicer.
|
37
|
-
# ========================================================================= #
|
38
|
-
def open?
|
39
|
-
!closed?
|
40
|
-
end; alias are_we_connected? open? # === are_we_connected?
|
41
|
-
alias is_connected? open? # === is_connected?
|
42
|
-
alias is_connected open? # === is_connected
|
43
|
-
alias connected? open? # === connected?
|
44
|
-
alias did_we_connect? open? # === did_we_connect?
|
45
|
-
|
46
|
-
end; end
|