ftp_paradise 1.3.8

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.

Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +309 -0
  3. data/bin/create_remote_directory +9 -0
  4. data/bin/ftp_get +17 -0
  5. data/bin/ftp_upload +42 -0
  6. data/bin/ftp_upload_binary +18 -0
  7. data/bin/iftp +7 -0
  8. data/bin/remote_remove +28 -0
  9. data/doc/README.gen +292 -0
  10. data/doc/TODO_FOR_FTP_PARADISE_PROJECT.md +79 -0
  11. data/ftp_paradise.gemspec +114 -0
  12. data/lib/ftp_paradise.rb +5 -0
  13. data/lib/ftp_paradise/base/cliner.rb +21 -0
  14. data/lib/ftp_paradise/base/colours.rb +83 -0
  15. data/lib/ftp_paradise/base/prototype.rb +169 -0
  16. data/lib/ftp_paradise/base/reset.rb +29 -0
  17. data/lib/ftp_paradise/colours/colours.rb +141 -0
  18. data/lib/ftp_paradise/colours/use_colours.rb +74 -0
  19. data/lib/ftp_paradise/configuration/configuration.rb +49 -0
  20. data/lib/ftp_paradise/connection/README.md +1 -0
  21. data/lib/ftp_paradise/connection/connection.rb +35 -0
  22. data/lib/ftp_paradise/connection/constants.rb +46 -0
  23. data/lib/ftp_paradise/connection/data.rb +148 -0
  24. data/lib/ftp_paradise/connection/debug.rb +80 -0
  25. data/lib/ftp_paradise/connection/directory_handling.rb +271 -0
  26. data/lib/ftp_paradise/connection/do_login.rb +108 -0
  27. data/lib/ftp_paradise/connection/download.rb +86 -0
  28. data/lib/ftp_paradise/connection/file_handling.rb +172 -0
  29. data/lib/ftp_paradise/connection/ftp_object.rb +21 -0
  30. data/lib/ftp_paradise/connection/initialize.rb +86 -0
  31. data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +20 -0
  32. data/lib/ftp_paradise/connection/is_connected.rb +46 -0
  33. data/lib/ftp_paradise/connection/misc.rb +472 -0
  34. data/lib/ftp_paradise/connection/notify.rb +71 -0
  35. data/lib/ftp_paradise/connection/password.rb +47 -0
  36. data/lib/ftp_paradise/connection/port.rb +33 -0
  37. data/lib/ftp_paradise/connection/remote_pwd.rb +72 -0
  38. data/lib/ftp_paradise/connection/remote_url.rb +163 -0
  39. data/lib/ftp_paradise/connection/remove.rb +143 -0
  40. data/lib/ftp_paradise/connection/reset.rb +75 -0
  41. data/lib/ftp_paradise/connection/run.rb +18 -0
  42. data/lib/ftp_paradise/connection/set_array_available_hosts.rb +27 -0
  43. data/lib/ftp_paradise/connection/set_input.rb +18 -0
  44. data/lib/ftp_paradise/connection/show.rb +153 -0
  45. data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +24 -0
  46. data/lib/ftp_paradise/connection/transfer_mode.rb +162 -0
  47. data/lib/ftp_paradise/connection/upload.rb +253 -0
  48. data/lib/ftp_paradise/connection/use_default_dataset.rb +41 -0
  49. data/lib/ftp_paradise/connection/username.rb +42 -0
  50. data/lib/ftp_paradise/constants/constants.rb +19 -0
  51. data/lib/ftp_paradise/constants/misc.rb +57 -0
  52. data/lib/ftp_paradise/constants/namespace.rb +14 -0
  53. data/lib/ftp_paradise/constants/newline.rb +14 -0
  54. data/lib/ftp_paradise/constants/roebe.rb +27 -0
  55. data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +219 -0
  56. data/lib/ftp_paradise/entry/entry.rb +293 -0
  57. data/lib/ftp_paradise/gui/gtk/constants.rb +58 -0
  58. data/lib/ftp_paradise/gui/gtk/ftp_bindings.rb +1149 -0
  59. data/lib/ftp_paradise/interactive_ftp/constants.rb +103 -0
  60. data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +215 -0
  61. data/lib/ftp_paradise/interactive_ftp/help.rb +50 -0
  62. data/lib/ftp_paradise/interactive_ftp/initialize.rb +27 -0
  63. data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +995 -0
  64. data/lib/ftp_paradise/interactive_ftp/main_loop.rb +50 -0
  65. data/lib/ftp_paradise/interactive_ftp/menu.rb +788 -0
  66. data/lib/ftp_paradise/interactive_ftp/misc.rb +208 -0
  67. data/lib/ftp_paradise/interactive_ftp/mode.rb +124 -0
  68. data/lib/ftp_paradise/interactive_ftp/readline.rb +115 -0
  69. data/lib/ftp_paradise/interactive_ftp/remove.rb +97 -0
  70. data/lib/ftp_paradise/interactive_ftp/reset.rb +90 -0
  71. data/lib/ftp_paradise/interactive_ftp/run.rb +22 -0
  72. data/lib/ftp_paradise/interactive_ftp/show.rb +184 -0
  73. data/lib/ftp_paradise/interactive_ftp/upload.rb +90 -0
  74. data/lib/ftp_paradise/interactive_ftp/user_input.rb +53 -0
  75. data/lib/ftp_paradise/project/project.rb +62 -0
  76. data/lib/ftp_paradise/requires/common_basic_requires.rb +13 -0
  77. data/lib/ftp_paradise/requires/common_external_requires.rb +9 -0
  78. data/lib/ftp_paradise/requires/require_the_constants.rb +7 -0
  79. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +18 -0
  80. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +10 -0
  81. data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +24 -0
  82. data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +29 -0
  83. data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +28 -0
  84. data/lib/ftp_paradise/toplevel_methods/connect.rb +49 -0
  85. data/lib/ftp_paradise/toplevel_methods/create_file.rb +18 -0
  86. data/lib/ftp_paradise/toplevel_methods/data.rb +31 -0
  87. data/lib/ftp_paradise/toplevel_methods/delete.rb +23 -0
  88. data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +37 -0
  89. data/lib/ftp_paradise/toplevel_methods/e.rb +16 -0
  90. data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +270 -0
  91. data/lib/ftp_paradise/toplevel_methods/get_files.rb +24 -0
  92. data/lib/ftp_paradise/toplevel_methods/is_directory.rb +33 -0
  93. data/lib/ftp_paradise/toplevel_methods/is_on_roebe.rb +20 -0
  94. data/lib/ftp_paradise/toplevel_methods/login_name.rb +49 -0
  95. data/lib/ftp_paradise/toplevel_methods/opn.rb +24 -0
  96. data/lib/ftp_paradise/toplevel_methods/password.rb +48 -0
  97. data/lib/ftp_paradise/toplevel_methods/port.rb +41 -0
  98. data/lib/ftp_paradise/toplevel_methods/rds.rb +18 -0
  99. data/lib/ftp_paradise/toplevel_methods/remote_url.rb +57 -0
  100. data/lib/ftp_paradise/toplevel_methods/time.rb +45 -0
  101. data/lib/ftp_paradise/toplevel_methods/upload.rb +29 -0
  102. data/lib/ftp_paradise/toplevel_methods/upload_this_binary_file.rb +58 -0
  103. data/lib/ftp_paradise/version/version.rb +19 -0
  104. data/lib/ftp_paradise/www/public/css/style.css +3 -0
  105. data/lib/ftp_paradise/www/sinatra_web_interface.rb +242 -0
  106. data/lib/ftp_paradise/www/views/index.slim +3 -0
  107. data/lib/ftp_paradise/www/views/layout.slim +11 -0
  108. data/lib/ftp_paradise/www/web_interface.cgi +35 -0
  109. data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +1 -0
  110. data/lib/ftp_paradise/yaml/debug.yml +1 -0
  111. data/lib/ftp_paradise/yaml/open_in_default_editor.yml +1 -0
  112. data/lib/ftp_paradise/yaml/show_full_names.yml +1 -0
  113. data/lib/ftp_paradise/yaml/use_colours.yml +1 -0
  114. data/test/testing_ftp_paradise.rb +94 -0
  115. data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +28 -0
  116. data/test/testing_the_ftp_connection_component.rb +70 -0
  117. data/test/testing_upload_a_local_directory.rb +10 -0
  118. metadata +315 -0
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/base/reset.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Base
10
+
11
+ # ========================================================================= #
12
+ # === reset
13
+ # ========================================================================= #
14
+ def reset
15
+ # ======================================================================= #
16
+ # === @internal_hash
17
+ # ======================================================================= #
18
+ @internal_hash = {}
19
+ # ======================================================================= #
20
+ # === :use_colours
21
+ # ======================================================================= #
22
+ @internal_hash[:use_colours] = true
23
+ # ======================================================================= #
24
+ # === :be_verbose
25
+ # ======================================================================= #
26
+ @internal_hash[:be_verbose] = true
27
+ end
28
+
29
+ end; end
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen-string-literal: true
4
+ # =========================================================================== #
5
+ # This file will add colour-related methods to the ftp_paradise project.
6
+ # =========================================================================== #
7
+ # require 'ftp_paradise/colours/colours.rb'
8
+ # =========================================================================== #
9
+ module FtpParadise
10
+
11
+ require 'ftp_paradise/colours/use_colours.rb'
12
+
13
+ # ========================================================================= #
14
+ # === rev
15
+ # ========================================================================= #
16
+ def rev
17
+ return Colours.rev if use_colours?
18
+ return ''
19
+ end
20
+
21
+ # ========================================================================= #
22
+ # === FtpParadise.sdir
23
+ # ========================================================================= #
24
+ def self.sdir(i)
25
+ return Colours.sdir(i) if use_colours?
26
+ i
27
+ end
28
+
29
+ # ========================================================================= #
30
+ # === FtpParadise.swarn
31
+ # ========================================================================= #
32
+ def self.swarn(i)
33
+ return Colours.swarn(i) if use_colours?
34
+ return i
35
+ end
36
+
37
+ # ========================================================================= #
38
+ # === FtpParadise.sfile
39
+ # ========================================================================= #
40
+ def self.sfile(i)
41
+ return Colours.sfile(i) if use_colours?
42
+ return i
43
+ end
44
+
45
+ # ========================================================================= #
46
+ # === FtpParadise.sfancy
47
+ # ========================================================================= #
48
+ def self.sfancy(i)
49
+ return Colours.sfancy(i) if use_colours? # Else we won't modify this at all.
50
+ return i
51
+ end
52
+
53
+ # ========================================================================= #
54
+ # === FtpParadise.simp
55
+ # ========================================================================= #
56
+ def self.simp(i)
57
+ return Colours.simp(i) if use_colours? # Else we won't modify this.
58
+ return i
59
+ end
60
+
61
+ # ========================================================================= #
62
+ # === sfancy
63
+ # ========================================================================= #
64
+ def sfancy(i)
65
+ FtpParadise.sfancy(i) # We can delegate here, because FtpParadise.sfancy() will take care of colours.
66
+ end
67
+
68
+ # ========================================================================= #
69
+ # === simp
70
+ # ========================================================================= #
71
+ def simp(i) # Link to FtpParadise.simp
72
+ FtpParadise.simp(i) # We can delegate here, because FtpParadise.sfancy will take care of colours.
73
+ end
74
+
75
+ # ========================================================================= #
76
+ # === sdir
77
+ # ========================================================================= #
78
+ def sdir(i)
79
+ FtpParadise.sdir(i)
80
+ end
81
+
82
+ # ========================================================================= #
83
+ # === sfile
84
+ # ========================================================================= #
85
+ def sfile(i)
86
+ FtpParadise.sfile(i)
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === swarn
91
+ # ========================================================================= #
92
+ def swarn(i)
93
+ FtpParadise.swarn(i)
94
+ end
95
+
96
+ # ========================================================================= #
97
+ # === FtpParadise.lightyellow
98
+ # ========================================================================= #
99
+ def self.lightyellow(i = '')
100
+ if use_colours?
101
+ return ::Colours.lightyellow(i)
102
+ end
103
+ return "#{Colours.yellow}#{i}#{Colours.rev}"
104
+ end; self.instance_eval { alias yellow lightyellow } # === FtpParadise.lightyellow
105
+
106
+ # ========================================================================= #
107
+ # === FtpParadise.royalblue
108
+ # ========================================================================= #
109
+ def self.royalblue(i = '')
110
+ if use_colours?
111
+ return ::Colours.royalblue(i)
112
+ end
113
+ return i
114
+ end
115
+
116
+ # ========================================================================= #
117
+ # === FtpParadise.slateblue
118
+ # ========================================================================= #
119
+ def self.slateblue(i = '')
120
+ if use_colours?
121
+ return ::Colours.slateblue(i)
122
+ end
123
+ return i
124
+ end
125
+
126
+ # ========================================================================= #
127
+ # === FtpParadise.testing_colours (colour test, testing colours)
128
+ #
129
+ # This just is a test whether we use colours or whether we won't.
130
+ # ========================================================================= #
131
+ def self.testing_colours
132
+ e 'We will now test some colours.'
133
+ e "Will we use colours? #{FtpParadise.use_colours?.to_s}"
134
+ e 'Testing '+sfancy('sfancy')+' next.'
135
+ end
136
+
137
+ end
138
+
139
+ if __FILE__ == $PROGRAM_NAME
140
+ puts FtpParadise.swarn('Oh noes!')
141
+ end
@@ -0,0 +1,74 @@
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
+ # Let's initialize the configuration here, if we have not yet
17
+ # done so.
18
+ # ========================================================================= #
19
+ if @configuration.nil?
20
+ FtpParadise.initialize_configuration if FtpParadise.respond_to? :initialize_configuration
21
+ end
22
+
23
+ # ========================================================================= #
24
+ # === FtpParadise.use_colours?
25
+ #
26
+ # This can be delegated towards the configuration object.
27
+ # ========================================================================= #
28
+ def self.use_colours?
29
+ if FtpParadise.respond_to?(:config?) and
30
+ FtpParadise.config?.respond_to?(:use_colours)
31
+ FtpParadise.config?.use_colours
32
+ else
33
+ true
34
+ end
35
+ end
36
+
37
+ # ========================================================================= #
38
+ # === FtpParadise.disable_colours
39
+ #
40
+ # Use this method to disable colours.
41
+ # ========================================================================= #
42
+ def self.disable_colours
43
+ FtpParadise.config?.use_colours = false
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === use_colours?
48
+ #
49
+ # Whether we will use colours or whether we will not.
50
+ # ========================================================================= #
51
+ def use_colours?
52
+ FtpParadise.use_colours?
53
+ end
54
+
55
+ # ========================================================================= #
56
+ # === If we use colours in this project
57
+ # ========================================================================= #
58
+ if use_colours?
59
+ # ======================================================================= #
60
+ # And we can also set the default-colours to use.
61
+ # ======================================================================= #
62
+ if Object.const_defined?(:Colours) and
63
+ Colours.respond_to?(:assign_new_colour_codes)
64
+ Colours.update_the_colour_codes_with({
65
+ default_colour: :green,
66
+ sfile: :brown,
67
+ sdir: :chocolate,
68
+ swarn: :red,
69
+ simportant: :bold_yellow,
70
+ })
71
+ end
72
+ end
73
+
74
+ 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
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 < Base
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,148 @@
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 < FtpParadise::Base
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
+ if i.has_key? :host
47
+ set_host i.fetch(:host)
48
+ elsif i.has_key? :remote_host
49
+ set_host i.fetch(:remote_host)
50
+ elsif i.has_key? :to # :to is an alias to :host.
51
+ set_host i.fetch(:to)
52
+ end
53
+
54
+ if i.has_key? :user_name
55
+ set_user_name i.fetch(:user_name)
56
+ elsif i.has_key? :login_name
57
+ set_user_name i.fetch(:login_name)
58
+ end
59
+
60
+ if i.has_key? :password
61
+ set_password i.fetch(:password)
62
+ elsif i.has_key? :login_password
63
+ set_password i.fetch(:login_password)
64
+ end
65
+
66
+ if i.has_key? :port
67
+ set_port i.fetch(:port)
68
+ end
69
+ # ========================================================================= #
70
+ # === Handle Array as input next
71
+ # ========================================================================= #
72
+ elsif i.is_a? Array # Example-Array: ["ftp.byethost33.com", "b33_14144659", "1aaaaaa", 21]
73
+ set_host i.first
74
+ set_user_name i[1]
75
+ set_password i[2]
76
+ set_port i[3]
77
+ # ========================================================================= #
78
+ # === Else, use simple toggle commands, such as 1,2,3,4,5 and so forth.
79
+ # ========================================================================= #
80
+ else # In the following case menu you can toggle your FTP.
81
+ case i.to_s # Work on strings only. Assumes shortcuts.
82
+ # ===================================================================== #
83
+ # === shevy
84
+ # ===================================================================== #
85
+ when '6',
86
+ /shevy/i,
87
+ 'square',
88
+ 'square7',
89
+ 'bplaced',
90
+ 'default',
91
+ 'top' # Current default.
92
+ _ = FILE_ROEBE_FTP
93
+ if File.exist? _
94
+ data = YAML.load_file(_)['bplaced'] # 'bplaced'
95
+ set_host data['url']
96
+ set_user_name data['user_name']
97
+ this_password = data['password']
98
+ this_password.chop! if this_password.end_with? '_'
99
+ set_password this_password
100
+ set_port data['port']
101
+ end
102
+ # ===================================================================== #
103
+ # === a1
104
+ # ===================================================================== #
105
+ when '1',
106
+ 'a1',
107
+ 'a1_ftp' # A1 FTP host. No longer in use but still kept.
108
+ set_host A1.first
109
+ set_user_name A1[1]
110
+ set_password A1[2]
111
+ set_port A1[3]
112
+ # ===================================================================== #
113
+ # === zymix
114
+ # ===================================================================== #
115
+ when '2',
116
+ 'zymix',
117
+ 'standard'
118
+ set_host ZYMIX.first
119
+ set_user_name ZYMIX[1]
120
+ set_password ZYMIX[2]
121
+ set_port ZYMIX[3]
122
+ # ===================================================================== #
123
+ # === uniwien
124
+ # ===================================================================== #
125
+ when '3',
126
+ 'univie',
127
+ 'uniwien' # Uni Wien FTP Account.
128
+ set_host UNIVIE.first
129
+ set_user_name UNIVIE[1]
130
+ set_password UNIVIE[2]
131
+ set_port UNIVIE[3]
132
+ # ===================================================================== #
133
+ # === byte
134
+ # ===================================================================== #
135
+ when '4',
136
+ 'byte',
137
+ 'bytehost'
138
+ set_host BYTEHOST.first
139
+ set_user_name BYTEHOST[1]
140
+ set_password BYTEHOST[2]
141
+ set_port BYTEHOST[3]
142
+ else
143
+ set_data(:default) # Go back to default again if not found.
144
+ end
145
+ end
146
+ end
147
+
148
+ end; end