ftp_paradise 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ftp_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +309 -0
- data/bin/create_remote_directory +9 -0
- data/bin/ftp_get +17 -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 +292 -0
- data/doc/TODO_FOR_FTP_PARADISE_PROJECT.md +79 -0
- data/ftp_paradise.gemspec +114 -0
- data/lib/ftp_paradise.rb +5 -0
- data/lib/ftp_paradise/base/cliner.rb +21 -0
- data/lib/ftp_paradise/base/colours.rb +83 -0
- data/lib/ftp_paradise/base/prototype.rb +169 -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 +74 -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 +148 -0
- data/lib/ftp_paradise/connection/debug.rb +80 -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 +172 -0
- data/lib/ftp_paradise/connection/ftp_object.rb +21 -0
- data/lib/ftp_paradise/connection/initialize.rb +86 -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 +472 -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 +163 -0
- data/lib/ftp_paradise/connection/remove.rb +143 -0
- data/lib/ftp_paradise/connection/reset.rb +75 -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 +162 -0
- data/lib/ftp_paradise/connection/upload.rb +253 -0
- data/lib/ftp_paradise/connection/use_default_dataset.rb +41 -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 +27 -0
- data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +219 -0
- data/lib/ftp_paradise/entry/entry.rb +293 -0
- data/lib/ftp_paradise/gui/gtk/constants.rb +58 -0
- data/lib/ftp_paradise/gui/gtk/ftp_bindings.rb +1149 -0
- data/lib/ftp_paradise/interactive_ftp/constants.rb +103 -0
- data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +215 -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 +995 -0
- data/lib/ftp_paradise/interactive_ftp/main_loop.rb +50 -0
- data/lib/ftp_paradise/interactive_ftp/menu.rb +788 -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 +115 -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 +62 -0
- data/lib/ftp_paradise/requires/common_basic_requires.rb +13 -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 +29 -0
- data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +28 -0
- data/lib/ftp_paradise/toplevel_methods/connect.rb +49 -0
- data/lib/ftp_paradise/toplevel_methods/create_file.rb +18 -0
- data/lib/ftp_paradise/toplevel_methods/data.rb +31 -0
- data/lib/ftp_paradise/toplevel_methods/delete.rb +23 -0
- data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +37 -0
- data/lib/ftp_paradise/toplevel_methods/e.rb +16 -0
- data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +270 -0
- data/lib/ftp_paradise/toplevel_methods/get_files.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/is_directory.rb +33 -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/opn.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/password.rb +48 -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.rb +29 -0
- data/lib/ftp_paradise/toplevel_methods/upload_this_binary_file.rb +58 -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 +35 -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 +315 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/get_files.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === FtpParadise.get_files
|
11
|
+
#
|
12
|
+
# Use this method whenever you want to get all (local) files.
|
13
|
+
#
|
14
|
+
# By default, this method will return all files from the current directory.
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.get_files(
|
17
|
+
from = '*'
|
18
|
+
)
|
19
|
+
entries = Dir[from]
|
20
|
+
entries.select! {|entry| File.file?(entry) }
|
21
|
+
entries
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/is_directory.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'ftp_paradise/connection/connection.rb'
|
10
|
+
# ========================================================================= #
|
11
|
+
# === FtpParadise.is_directory?
|
12
|
+
#
|
13
|
+
# This will return a boolean - true if the remote target is a directory
|
14
|
+
# and false otherwise.
|
15
|
+
#
|
16
|
+
# By default this method will connect to the :shevy host.
|
17
|
+
# ========================================================================= #
|
18
|
+
def self.is_directory?(
|
19
|
+
i,
|
20
|
+
connect_to_this_host = :shevy
|
21
|
+
)
|
22
|
+
FtpParadise::Connection.new(
|
23
|
+
i,
|
24
|
+
connect_to_this_host: connect_to_this_host
|
25
|
+
).is_a_directory?(i)
|
26
|
+
end; self.instance_eval { alias directory? is_directory? } # === FtpParadise.directory?
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
if __FILE__ == $PROGRAM_NAME
|
31
|
+
p FtpParadise.is_directory?('AUSARBEITUNGEN')
|
32
|
+
p FtpParadise.is_directory?('AUSARBEITUNGE')
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/is_on_roebe.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === FtpParadise.is_on_roebe?
|
11
|
+
# ========================================================================= #
|
12
|
+
def self.is_on_roebe?
|
13
|
+
ENV['IS_ROEBE'].to_s == '1'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
if __FILE__ == $PROGRAM_NAME
|
19
|
+
puts FtpParadise.is_on_roebe?
|
20
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/login_name.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'yaml'
|
10
|
+
require 'ftp_paradise/constants/roebe.rb'
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === @login_name
|
14
|
+
# ========================================================================= #
|
15
|
+
@login_name = nil
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === FtpParadise.login_name?
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.login_name?
|
21
|
+
@login_name
|
22
|
+
end; self.instance_eval { alias username? login_name? } # === FtpParadise.username?
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# === FtpParadise.set_login_name
|
26
|
+
# ========================================================================= #
|
27
|
+
def self.set_login_name(
|
28
|
+
i = :try_to_infer_automatically
|
29
|
+
)
|
30
|
+
case i
|
31
|
+
# ======================================================================= #
|
32
|
+
# === :try_to_infer_automatically
|
33
|
+
# ======================================================================= #
|
34
|
+
when :try_to_infer_automatically,
|
35
|
+
:infer
|
36
|
+
if File.exist? FILE_ROEBE_FTP
|
37
|
+
i = YAML.load_file(FILE_ROEBE_FTP)['bplaced']['user_name']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@login_name = i
|
41
|
+
end; self.instance_eval { alias set_user_name set_login_name } # === FtpParadise.set_user_name
|
42
|
+
self.instance_eval { alias set_username set_login_name } # === FtpParadise.set_username
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
if __FILE__ == $PROGRAM_NAME
|
47
|
+
FtpParadise.set_login_name
|
48
|
+
puts FtpParadise.login_name?
|
49
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/opn.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'ftp_paradise/constants/namespace.rb'
|
8
|
+
|
9
|
+
module FtpParadise
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'opn'
|
13
|
+
rescue LoadError; end
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === FtpParadise.opn
|
17
|
+
# ========================================================================= #
|
18
|
+
def self.opn(
|
19
|
+
i = { namespace: NAMESPACE }
|
20
|
+
)
|
21
|
+
Opn.opn(i) if Object.const_defined? :Opn
|
22
|
+
end; self.instance_eval { alias opnn opn } # === FtpParadise.opnn
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/password.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'yaml'
|
10
|
+
require 'ftp_paradise/constants/roebe.rb'
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === @password
|
14
|
+
#
|
15
|
+
# This variable will keep track of the password to the remote FTP
|
16
|
+
# host.
|
17
|
+
# ========================================================================= #
|
18
|
+
@password = nil
|
19
|
+
|
20
|
+
# ========================================================================= #
|
21
|
+
# === FtpParadise.password?
|
22
|
+
# ========================================================================= #
|
23
|
+
def self.password?
|
24
|
+
@password
|
25
|
+
end
|
26
|
+
|
27
|
+
# ========================================================================= #
|
28
|
+
# === FtpParadise.set_password
|
29
|
+
# ========================================================================= #
|
30
|
+
def self.set_password(
|
31
|
+
i = :try_to_infer_automatically
|
32
|
+
)
|
33
|
+
case i
|
34
|
+
when :try_to_infer_automatically,
|
35
|
+
:infer
|
36
|
+
if File.exist? FILE_ROEBE_FTP
|
37
|
+
i = YAML.load_file(FILE_ROEBE_FTP)['bytehost']['password']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@password = i
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
if __FILE__ == $PROGRAM_NAME
|
46
|
+
FtpParadise.set_password
|
47
|
+
puts FtpParadise.password?
|
48
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/port.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === @port
|
11
|
+
# ========================================================================= #
|
12
|
+
@port = 21
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === FtpParadise.set_port
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_port(
|
18
|
+
i = :try_to_infer_automatically
|
19
|
+
)
|
20
|
+
case i
|
21
|
+
when :try_to_infer_automatically
|
22
|
+
if File.exist? FILE_ROEBE_FTP
|
23
|
+
i = YAML.load_file(FILE_ROEBE_FTP)['bytehost']['port']
|
24
|
+
end
|
25
|
+
end
|
26
|
+
@port = i
|
27
|
+
end
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === FtpParadise.port?
|
31
|
+
# ========================================================================= #
|
32
|
+
def self.port?
|
33
|
+
@port
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
if __FILE__ == $PROGRAM_NAME
|
39
|
+
FtpParadise.set_port
|
40
|
+
puts FtpParadise.port?
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/rds.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === FtpParadise.rds
|
11
|
+
#
|
12
|
+
# Use this method to remove double '//' entry.
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.rds(i)
|
15
|
+
i.squeeze '/'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/remote_url.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === @remote_url
|
11
|
+
#
|
12
|
+
# This variable will keep track of the remote url.
|
13
|
+
# ========================================================================= #
|
14
|
+
@remote_url = nil
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === FtpParadise.remote_url?
|
18
|
+
#
|
19
|
+
# Return the @remote_url variable.
|
20
|
+
# ========================================================================= #
|
21
|
+
def self.remote_url?
|
22
|
+
@remote_url
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'yaml'
|
26
|
+
require 'ftp_paradise/toplevel_methods/is_on_roebe.rb'
|
27
|
+
require 'ftp_paradise/constants/roebe.rb'
|
28
|
+
# ========================================================================= #
|
29
|
+
# === FtpParadise.set_remote_url
|
30
|
+
#
|
31
|
+
# Setter-method for @remote_url. Will be nil initially.
|
32
|
+
# ========================================================================= #
|
33
|
+
def self.set_remote_url(
|
34
|
+
i = :try_to_infer
|
35
|
+
)
|
36
|
+
case i
|
37
|
+
when nil, :infer, :try_to_infer
|
38
|
+
if is_on_roebe?
|
39
|
+
if File.exist? FILE_ROEBE_FTP
|
40
|
+
i = YAML.load_file(FILE_ROEBE_FTP)['bytehost']['url']
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
@remote_url = i
|
45
|
+
end; self.instance_eval { alias set_remote_host set_remote_url } # === FtpParadise.set_remote_host
|
46
|
+
|
47
|
+
# ========================================================================= #
|
48
|
+
# Initialize it to the default value.
|
49
|
+
# ========================================================================= #
|
50
|
+
set_remote_url
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
if __FILE__ == $PROGRAM_NAME
|
55
|
+
FtpParadise.set_remote_url
|
56
|
+
puts FtpParadise.remote_url?
|
57
|
+
end # ftp_remote_url
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/time.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === FtpParadise.return_date
|
11
|
+
#
|
12
|
+
# This method will return a String such as "03.12.2014".
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.return_date
|
15
|
+
Time.now.strftime('%d.%m.%Y')
|
16
|
+
end
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === return_date
|
20
|
+
# ========================================================================= #
|
21
|
+
def return_date
|
22
|
+
FtpParadise.return_date
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === FtpParadise.return_time
|
27
|
+
#
|
28
|
+
# This method will return a String such as "15:55:30".
|
29
|
+
# ========================================================================= #
|
30
|
+
def self.return_time
|
31
|
+
Time.now.strftime('%H:%M:%S')
|
32
|
+
end
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === return_time
|
36
|
+
# ========================================================================= #
|
37
|
+
def return_time
|
38
|
+
FtpParadise.return_time
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
if __FILE__ == $PROGRAM_NAME
|
44
|
+
puts FtpParadise.return_time
|
45
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'ftp_paradise/toplevel_methods/create_directory.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module FtpParadise
|
8
|
+
|
9
|
+
require 'ftp_paradise/connection/connection.rb'
|
10
|
+
require 'ftp_paradise/toplevel_methods/e.rb'
|
11
|
+
require 'ftp_paradise/toplevel_methods/opn.rb'
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === FtpParadise.upload
|
15
|
+
#
|
16
|
+
# This class-method can be used to upload something to a remote
|
17
|
+
# target. The second argument called `to` will tell us where to
|
18
|
+
# upload to.
|
19
|
+
# ========================================================================= #
|
20
|
+
def self.upload(
|
21
|
+
this, to = :shevy
|
22
|
+
)
|
23
|
+
_ = FtpParadise::Connection.new(:dont_run_yet)
|
24
|
+
opn; e "We will now connect to #{sfancy(to.to_s)}."
|
25
|
+
_.connect_to(to)
|
26
|
+
_.upload(this)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
module FtpParadise
|
6
|
+
|
7
|
+
require 'ftp_paradise/connection/connection.rb'
|
8
|
+
# ========================================================================= #
|
9
|
+
# === FtpParadise.upload_this_binary_file
|
10
|
+
#
|
11
|
+
# This method shall allow you to upload a binary file to a remote host.
|
12
|
+
#
|
13
|
+
# For now, this has my FTP information hardcoded.
|
14
|
+
#
|
15
|
+
# Usage examples:
|
16
|
+
#
|
17
|
+
# FtpParadise.upload_this_binary_file("/home/x/src/htop/htop-2.0.2.tar.xz")
|
18
|
+
# FtpParadise.upload_this_binary_file("/home/x/src/htop/htop-2.0.2.tar.xz") {{ cd_into_this_directory: 'htdocs/' }}
|
19
|
+
# FtpParadise.upload_this_binary_file("/home/x/src/htop/htop-2.0.2.tar.xz") {{ cd_into_this_directory: 'www/' }}
|
20
|
+
# upload_this_binary_file /home/x/src/htop/htop-2.0.2.tar.xz
|
21
|
+
# upload_this_binary_file /home/x/src/htop/htop-2.0.2.tar.xz
|
22
|
+
#
|
23
|
+
# ========================================================================= #
|
24
|
+
def self.upload_this_binary_file(
|
25
|
+
file,
|
26
|
+
be_verbose = :be_silent,
|
27
|
+
use_this_as_ftp_object = nil
|
28
|
+
)
|
29
|
+
yielded = nil
|
30
|
+
yielded = yield if block_given?
|
31
|
+
case yielded
|
32
|
+
when :be_quiet
|
33
|
+
be_verbose = false
|
34
|
+
end
|
35
|
+
case be_verbose
|
36
|
+
when :be_silent
|
37
|
+
be_verbose = false
|
38
|
+
end
|
39
|
+
unless use_this_as_ftp_object
|
40
|
+
use_this_as_ftp_object = ::FtpParadise::Connection.new(:dont_run_yet) { :default_dataset }
|
41
|
+
if be_verbose
|
42
|
+
use_this_as_ftp_object.be_verbose
|
43
|
+
else
|
44
|
+
use_this_as_ftp_object.be_quiet
|
45
|
+
end
|
46
|
+
use_this_as_ftp_object.set_binary_mode
|
47
|
+
end
|
48
|
+
if yielded
|
49
|
+
if yielded.is_a? Hash
|
50
|
+
if yielded.has_key? :cd_into_this_directory
|
51
|
+
use_this_as_ftp_object.remote_cd(yielded[:cd_into_this_directory])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
use_this_as_ftp_object.upload(file, be_verbose) # Here, do the FTP upload finally.
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|