ftp_paradise 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +319 -0
  3. data/bin/create_remote_directory +9 -0
  4. data/bin/ftp_get +17 -0
  5. data/bin/ftp_gtk3 +7 -0
  6. data/bin/ftp_upload +42 -0
  7. data/bin/ftp_upload_binary +18 -0
  8. data/bin/iftp +7 -0
  9. data/bin/remote_remove +28 -0
  10. data/doc/README.gen +302 -0
  11. data/doc/todo/TODO_FOR_FTP_PARADISE_PROJECT.md +79 -0
  12. data/ftp_paradise.gemspec +122 -0
  13. data/lib/ftp_paradise.rb +5 -0
  14. data/lib/ftp_paradise/base/cliner.rb +23 -0
  15. data/lib/ftp_paradise/base/colours.rb +83 -0
  16. data/lib/ftp_paradise/base/prototype.rb +171 -0
  17. data/lib/ftp_paradise/base/reset.rb +29 -0
  18. data/lib/ftp_paradise/colours/colours.rb +141 -0
  19. data/lib/ftp_paradise/colours/use_colours.rb +76 -0
  20. data/lib/ftp_paradise/configuration/configuration.rb +49 -0
  21. data/lib/ftp_paradise/connection/README.md +1 -0
  22. data/lib/ftp_paradise/connection/connection.rb +35 -0
  23. data/lib/ftp_paradise/connection/constants.rb +46 -0
  24. data/lib/ftp_paradise/connection/data.rb +164 -0
  25. data/lib/ftp_paradise/connection/debug.rb +78 -0
  26. data/lib/ftp_paradise/connection/directory_handling.rb +271 -0
  27. data/lib/ftp_paradise/connection/do_login.rb +108 -0
  28. data/lib/ftp_paradise/connection/download.rb +86 -0
  29. data/lib/ftp_paradise/connection/file_handling.rb +174 -0
  30. data/lib/ftp_paradise/connection/ftp_object.rb +21 -0
  31. data/lib/ftp_paradise/connection/initialize.rb +88 -0
  32. data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +20 -0
  33. data/lib/ftp_paradise/connection/is_connected.rb +46 -0
  34. data/lib/ftp_paradise/connection/misc.rb +474 -0
  35. data/lib/ftp_paradise/connection/notify.rb +71 -0
  36. data/lib/ftp_paradise/connection/password.rb +47 -0
  37. data/lib/ftp_paradise/connection/port.rb +33 -0
  38. data/lib/ftp_paradise/connection/remote_pwd.rb +72 -0
  39. data/lib/ftp_paradise/connection/remote_url.rb +164 -0
  40. data/lib/ftp_paradise/connection/remove.rb +143 -0
  41. data/lib/ftp_paradise/connection/reset.rb +78 -0
  42. data/lib/ftp_paradise/connection/run.rb +18 -0
  43. data/lib/ftp_paradise/connection/set_array_available_hosts.rb +27 -0
  44. data/lib/ftp_paradise/connection/set_input.rb +18 -0
  45. data/lib/ftp_paradise/connection/show.rb +153 -0
  46. data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +24 -0
  47. data/lib/ftp_paradise/connection/transfer_mode.rb +163 -0
  48. data/lib/ftp_paradise/connection/upload.rb +253 -0
  49. data/lib/ftp_paradise/connection/use_default_dataset.rb +40 -0
  50. data/lib/ftp_paradise/connection/username.rb +42 -0
  51. data/lib/ftp_paradise/constants/constants.rb +19 -0
  52. data/lib/ftp_paradise/constants/misc.rb +57 -0
  53. data/lib/ftp_paradise/constants/namespace.rb +14 -0
  54. data/lib/ftp_paradise/constants/newline.rb +14 -0
  55. data/lib/ftp_paradise/constants/roebe.rb +31 -0
  56. data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +233 -0
  57. data/lib/ftp_paradise/entry/entry.rb +300 -0
  58. data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +34 -0
  59. data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +34 -0
  60. data/lib/ftp_paradise/gui/shared_code/ftp_paradise/ftp_paradise_module.rb +709 -0
  61. data/lib/ftp_paradise/images/connection_image.png +0 -0
  62. data/lib/ftp_paradise/interactive_ftp/constants.rb +103 -0
  63. data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +216 -0
  64. data/lib/ftp_paradise/interactive_ftp/help.rb +50 -0
  65. data/lib/ftp_paradise/interactive_ftp/initialize.rb +27 -0
  66. data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +998 -0
  67. data/lib/ftp_paradise/interactive_ftp/main_loop.rb +51 -0
  68. data/lib/ftp_paradise/interactive_ftp/menu.rb +786 -0
  69. data/lib/ftp_paradise/interactive_ftp/misc.rb +208 -0
  70. data/lib/ftp_paradise/interactive_ftp/mode.rb +124 -0
  71. data/lib/ftp_paradise/interactive_ftp/readline.rb +113 -0
  72. data/lib/ftp_paradise/interactive_ftp/remove.rb +97 -0
  73. data/lib/ftp_paradise/interactive_ftp/reset.rb +90 -0
  74. data/lib/ftp_paradise/interactive_ftp/run.rb +22 -0
  75. data/lib/ftp_paradise/interactive_ftp/show.rb +184 -0
  76. data/lib/ftp_paradise/interactive_ftp/upload.rb +90 -0
  77. data/lib/ftp_paradise/interactive_ftp/user_input.rb +53 -0
  78. data/lib/ftp_paradise/project/project.rb +64 -0
  79. data/lib/ftp_paradise/requires/common_basic_requires.rb +14 -0
  80. data/lib/ftp_paradise/requires/common_external_requires.rb +9 -0
  81. data/lib/ftp_paradise/requires/require_the_constants.rb +7 -0
  82. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +18 -0
  83. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +10 -0
  84. data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +24 -0
  85. data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +28 -0
  86. data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +28 -0
  87. data/lib/ftp_paradise/toplevel_methods/connect.rb +50 -0
  88. data/lib/ftp_paradise/toplevel_methods/data.rb +31 -0
  89. data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +37 -0
  90. data/lib/ftp_paradise/toplevel_methods/directory_related_actions.rb +33 -0
  91. data/lib/ftp_paradise/toplevel_methods/e.rb +16 -0
  92. data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +49 -0
  93. data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +270 -0
  94. data/lib/ftp_paradise/toplevel_methods/is_on_roebe.rb +20 -0
  95. data/lib/ftp_paradise/toplevel_methods/login_name.rb +49 -0
  96. data/lib/ftp_paradise/toplevel_methods/misc.rb +16 -0
  97. data/lib/ftp_paradise/toplevel_methods/opn.rb +24 -0
  98. data/lib/ftp_paradise/toplevel_methods/password.rb +50 -0
  99. data/lib/ftp_paradise/toplevel_methods/port.rb +41 -0
  100. data/lib/ftp_paradise/toplevel_methods/rds.rb +18 -0
  101. data/lib/ftp_paradise/toplevel_methods/remote_url.rb +57 -0
  102. data/lib/ftp_paradise/toplevel_methods/time.rb +45 -0
  103. data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +108 -0
  104. data/lib/ftp_paradise/version/version.rb +19 -0
  105. data/lib/ftp_paradise/www/public/css/style.css +3 -0
  106. data/lib/ftp_paradise/www/sinatra_web_interface.rb +242 -0
  107. data/lib/ftp_paradise/www/views/index.slim +3 -0
  108. data/lib/ftp_paradise/www/views/layout.slim +11 -0
  109. data/lib/ftp_paradise/www/web_interface.cgi +34 -0
  110. data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +1 -0
  111. data/lib/ftp_paradise/yaml/debug.yml +1 -0
  112. data/lib/ftp_paradise/yaml/open_in_default_editor.yml +1 -0
  113. data/lib/ftp_paradise/yaml/show_full_names.yml +1 -0
  114. data/lib/ftp_paradise/yaml/use_colours.yml +1 -0
  115. data/test/testing_ftp_paradise.rb +94 -0
  116. data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +28 -0
  117. data/test/testing_the_ftp_connection_component.rb +70 -0
  118. data/test/testing_upload_a_local_directory.rb +10 -0
  119. metadata +336 -0
@@ -0,0 +1,3 @@
1
+ .red {
2
+ color: red;
3
+ }
@@ -0,0 +1,242 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === FtpWebApp
6
+ #
7
+ # This file requires these projects:
8
+ #
9
+ # sinatra
10
+ # html_tags
11
+ # colours
12
+ # ftp_paradise
13
+ #
14
+ # =========================================================================== #
15
+ require 'sinatra'
16
+ require 'html_tags'
17
+ require 'colours/autoinclude'
18
+ require 'ftp_paradise'
19
+ require 'cliner'
20
+
21
+ # =========================================================================== #
22
+ # We must remove method :body first before continuing.
23
+ # =========================================================================== #
24
+ HtmlTags.class_eval { remove_method(:body) }
25
+
26
+ class FtpWebApp < Sinatra::Base
27
+
28
+ include HtmlTags
29
+
30
+ set :port, USE_THIS_PORT
31
+ set :logging, true
32
+
33
+ USE_THIS_PORT = 81
34
+ WHERE_TO = :SHEVY
35
+
36
+ # ========================================================================= #
37
+ # Initialize the Ftp-Connection here.
38
+ # ========================================================================= #
39
+ FTP = FtpParadise::Connection.new(:dont_run)
40
+
41
+ # ========================================================================= #
42
+ # The various constants for the URL actions.
43
+ # ========================================================================= #
44
+ ROOT = '/'
45
+ ABOUT = '/about/?'
46
+ CONNECT = '/connect/?'
47
+ CONNECT_TO = '/connect_to/?'
48
+ STATUS = '/status/?'
49
+ LISTING = '/listing/?'
50
+
51
+ # ========================================================================= #
52
+ # === initialize
53
+ # ========================================================================= #
54
+ def initialize(
55
+ run_already = true
56
+ )
57
+ super
58
+ run if run_already
59
+ end
60
+
61
+ # ========================================================================= #
62
+ # === link_to_everything (everything tag, all tag)
63
+ # ========================================================================= #
64
+ def link_to_everything
65
+ div(
66
+ :id => 'intralink',
67
+ :css_style => 'margin: 0.55em;
68
+ margin-top:1.05em;
69
+ margin-left:0.45em;
70
+ margin-right:0.45em;
71
+ padding-top: 2px;
72
+ padding:5px;
73
+ border:1px dotted black;'
74
+ ) {
75
+ h2('Available actions for the www-ftp part:','','',
76
+ 'margin-top:1px; margin-bottom:1px;padding:0.2em')+
77
+ link_to(:connect,'margin-left:1em')+
78
+ link_to(:status)+
79
+ link_to(:root)+
80
+ link_to(:listing)
81
+ }
82
+ end
83
+
84
+ # ========================================================================= #
85
+ # === link_to
86
+ # ========================================================================= #
87
+ def link_to(i, optional_css = '')
88
+ case i.to_s
89
+ when 'root'
90
+ i = '/'
91
+ end
92
+ a(i.to_s, :make_newline,'','padding-left:1.2em;'+optional_css)
93
+ end
94
+
95
+ # ========================================================================= #
96
+ # === do_connect
97
+ # ========================================================================= #
98
+ def do_connect(
99
+ where_to = WHERE_TO
100
+ )
101
+ FTP.connect :to => where_to
102
+ end
103
+
104
+ # ========================================================================= #
105
+ # localhost:81/halt
106
+ # ========================================================================= #
107
+ get '/halt' do
108
+ halt 403, 'Halting everything.'
109
+ end
110
+
111
+ # ========================================================================= #
112
+ # === /about
113
+ #
114
+ # localhost:81/about
115
+ # About tag
116
+ # ========================================================================= #
117
+ get ABOUT do
118
+ _ = h2 'This is the Web Interface for the FtpParadise project.'
119
+ _ << 'If you wish to connect to a remote site, try:'+br
120
+ _ << h4(' connect SERVER_URL_HERE','','',
121
+ 'color:slateblue; margin-left:1em')
122
+ return _
123
+ end
124
+
125
+ # ========================================================================= #
126
+ # /listing (listing tag)
127
+ # ========================================================================= #
128
+ get LISTING do
129
+ do_connect
130
+ _ = h2('Remote File listing (of <b>'+WHERE_TO.to_s+'</b>):','','',
131
+ 'text-decoration: underline')
132
+ FTP.array_remote_files.
133
+ reject {|entry| entry[0,1] == '.'}.
134
+ each_with_index {|entry, index|
135
+ _ << (index+1).to_s+' <b>'+link(
136
+ 'http://'+FTP.connected_to?+'/'+entry.to_s
137
+ )+'</b>'+br+"\n"
138
+ }
139
+ _+link_to_everything
140
+ end
141
+
142
+ # ========================================================================= #
143
+ # === status tag
144
+ #
145
+ # localhost:81/status
146
+ # ========================================================================= #
147
+ get STATUS do
148
+ do_connect
149
+ show_status
150
+ end
151
+
152
+ # ========================================================================= #
153
+ # localhost:81/status
154
+ # ========================================================================= #
155
+ get CONNECT do
156
+ h2('Please give us an argument to use.','red')+
157
+ h3('If you are unsure what kind of argument, simply append the login '+
158
+ 'host you wish to connect to, such as /SHEVY.')+br+
159
+ 'Example: /connect_to/SHEVY'+
160
+ a('connect/SHEVY', :make_newline)
161
+ end
162
+
163
+ # ========================================================================= #
164
+ # === show_status
165
+ # ========================================================================= #
166
+ def show_status
167
+ _ = h2 'The status is as follows:'+br
168
+ _ << 'We are connected to: '+b(FTP.connected_to?,
169
+ '','','text-decoration: underline')+br+br
170
+ _ << FTP.status?+br
171
+ _ << link_to_everything
172
+ end
173
+
174
+ # ========================================================================= #
175
+ # localhost:81/connect
176
+ # ========================================================================= #
177
+ [
178
+ CONNECT+'/:connect',
179
+ CONNECT_TO+'/:connect'
180
+ ].each {|entry|
181
+ get(entry) do
182
+ FTP.connect :to => params[:connect]
183
+ _ = 'Now connecting to ...'+params[:connect].to_s+
184
+ show_status+br+link_to(:root)
185
+ return _
186
+ end
187
+ }
188
+
189
+ # ========================================================================= #
190
+ # The root at / is shown here.
191
+ # localhost:81/
192
+ # ========================================================================= #
193
+ get ROOT do
194
+ h1('Welcome to the web-interface of the FtpParadise project. ',
195
+ '','','margin-top:0.5em')+
196
+ h2('We will now show which actions are possible:','','',
197
+ 'margin-bottom:1px; margin-left:1em')+
198
+ link_to_everything
199
+ end
200
+
201
+ # ========================================================================= #
202
+ # === report_port
203
+ # ========================================================================= #
204
+ def report_port
205
+ cliner {
206
+ e 'We will use the port '+sfancy(port?)+' ( http://localhost:'+port?+'/ ).'
207
+ }
208
+ end
209
+
210
+ # ========================================================================= #
211
+ # === port?
212
+ # ========================================================================= #
213
+ def port?
214
+ USE_THIS_PORT.to_s
215
+ end
216
+
217
+ # ========================================================================= #
218
+ # === not_found
219
+ #
220
+ # In case the action was not found, continue here.
221
+ #
222
+ # localhost:81/not_existing
223
+ # ========================================================================= #
224
+ not_found do
225
+ status 404
226
+ h1('The action '+request.path_info+' was not found.')+
227
+ link_to_everything
228
+ end
229
+
230
+ # ========================================================================= #
231
+ # === run
232
+ # ========================================================================= #
233
+ def run
234
+ report_port
235
+ self.class.run!
236
+ end
237
+
238
+ end
239
+
240
+ if __FILE__ == $PROGRAM_NAME
241
+ FtpWebApp.new
242
+ end # rb sinatra_web_interface.rb
@@ -0,0 +1,3 @@
1
+ h2 My Tasks
2
+ ul.tasks
3
+ li Get Milk
@@ -0,0 +1,11 @@
1
+ doctype html
2
+ html
3
+ head
4
+ meta charset="utf-8"
5
+ title Just Do It
6
+ link rel="stylesheet" media="screen, projection" href="/styles.css"
7
+ /[if lt IE 9]
8
+ script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
9
+ body
10
+ h1 Just Do It
11
+ == yield
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # http://localhost/DATA/PROGRAMMING_LANGUAGES/RUBY/src/ftp_paradise/lib/ftp_paradise/www/web_interface.cgi
6
+ # =========================================================================== #
7
+ require 'web_object/autoinclude'
8
+ require 'ftp_paradise'
9
+
10
+ english {
11
+ title 'Ftp Paradise Web Interface'
12
+
13
+ doc {
14
+ h2 sg(:ausrufungszeichen2,'marr8px')+'Welcome to Web-based FTP','ud'
15
+ p {
16
+ e 'You will be able to connect to a remote FTP
17
+ site with this cgi script.'
18
+ }
19
+ FTP_LIBRARY = FtpParadise::Connection.new(:dont_run)
20
+ div('pad1em wid50','','border: 1px inset crimson;') {
21
+ form('self','post','form_name') {
22
+ ee 'Connect to:'
23
+ input_field
24
+ ee '<select size="1" name="foobar">'
25
+ ee '<option value="aa">Choose a Host:</option>'
26
+ FTP_LIBRARY.array_available_hosts.each {|entry|
27
+ ee '<option value="aa">'+entry+'</option>'
28
+ }
29
+ cselect
30
+ br
31
+ submit
32
+ }
33
+ }
34
+ }}
@@ -0,0 +1 @@
1
+ --- false
@@ -0,0 +1 @@
1
+ --- true
@@ -0,0 +1 @@
1
+ --- false
@@ -0,0 +1 @@
1
+ --- true
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'verbose_truth'
6
+ require 'colours/colours_e_autoinclude.rb'
7
+ require 'cliner'
8
+ require 'ftp_paradise'
9
+
10
+ @counter = 0
11
+
12
+ # =========================================================================== #
13
+ # === fancy_colour
14
+ #
15
+ # Through a Konsole-colour.
16
+ # =========================================================================== #
17
+ def fancy_colour(i)
18
+ ::Colours.springgreen(i)
19
+ end; alias main_colour fancy_colour # === main_colour
20
+
21
+ # =========================================================================== #
22
+ # === counter
23
+ #
24
+ # We return a colourized-counter here.
25
+ # =========================================================================== #
26
+ def counter
27
+ @counter += 1
28
+ return ::Colours.peachpuff('('+@counter.to_s+') ')
29
+ end
30
+
31
+ e 'Now testing the project called '+sfancy('ftp_paradise')+'.'
32
+ e 'Will we use colours?'
33
+ e VerboseTruth[FtpParadise.use_colours?]
34
+ e
35
+ e 'Next, we will instantiate a new FtpParadise::Connection object.'
36
+ connection = FtpParadise::Connection.new { :default_dataset }
37
+ # library.set_data :shevy # <-- This is not necessary.
38
+ pp connection
39
+ cliner
40
+ # =========================================================================== #
41
+ # === Feedback the configuration object
42
+ # =========================================================================== #
43
+ e 'The configuration object is:'
44
+ pp FtpParadise.config?
45
+ pp FtpParadise::CONFIGURATION
46
+ e '^^^ should be the same'
47
+ cliner
48
+ e 'Next, we will test some colours:'
49
+ FtpParadise.testing_colours # Making some colour-tests next.
50
+ cliner
51
+ e 'Next, we will show the user name, port and password:'
52
+ connection.show_host_user_name_port_and_password
53
+ cliner
54
+ e counter+'Now testing the '+fancy_colour('class FtpParadise::Connection')
55
+ connection = FtpParadise::Connection.new(:default)
56
+ e 'Will we debug? '+VerboseTruth[connection.debug?]
57
+ e 'The user name is: '+::Colours.orchid(connection.user_name?)
58
+ e 'Next showing the FtpParadise::Connection object:'
59
+ pp connection # test_ftp
60
+ connection.set_passive
61
+ connection.set_mode
62
+ connection.cd 'ZEUGNISSE'
63
+ e 'Next testing the method '+main_colour('.nlst()')
64
+ connection.nlst
65
+ e 'Debugging next:'
66
+ connection.debug
67
+ e 'We are connected to?'
68
+ e ' '+::Colours.deepskyblue(connection.connected_to?)
69
+ connection.report_remote_directory
70
+ # connection.upload 'LPC_CODE_SHEET'
71
+ e 'Is CSS/ a directory? '+connection.is_directory?('CSS').to_s
72
+ e 'The last response was: `'+connection.last_response?.chomp+'`'
73
+ e 'open_timeout? '+connection.open_timeout?.to_s # ftplib
74
+ e 'Next testing '+main_colour('FtpParadise.connect')+' functionality'
75
+ FtpParadise.connect to: :shevy
76
+ # =========================================================================== #
77
+ # Testing whether we will transfer in binary mode:
78
+ # =========================================================================== #
79
+ cliner
80
+ e 'Will we transfer in binary mode? '+VerboseTruth[connection.binary?].to_s
81
+ cliner
82
+ e 'Next, we will test '+simp('FtpParadise.mlsd()')+' but only the first entry there:'
83
+ e FtpParadise.mlsd.first
84
+ e FtpParadise.mlsd.first.class
85
+ # =========================================================================== #
86
+ # Ok, done testing FtpParadise::Connection.
87
+ # =========================================================================== #
88
+
89
+ # =========================================================================== #
90
+ # Now we can test interactive FTP. This must come last because it will
91
+ # start up the interactive variant.
92
+ # =========================================================================== #
93
+ interactive = FtpParadise.interactive(:no_main_loop)
94
+ interactive.run
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This small .rb file will just show how to quickly connect to a default
6
+ # host that I use. I have the login information stored in a yaml file.
7
+ # =========================================================================== #
8
+ require 'yaml'
9
+ require 'colours/colours_e_autoinclude.rb'
10
+ require 'net/ftp'
11
+
12
+ e Colours.rev+'Now testing a minimal FTP example.'
13
+
14
+ _ = '/home/x/DATA/PC/OS/LINUX/FTP/YAML/roebe_ftp.yml'
15
+ dataset = YAML.load_file(_)['bytehost']
16
+ url = dataset.fetch 'url'
17
+ _port = dataset.fetch 'port'
18
+ user_name = dataset.fetch 'user_name'
19
+ password = dataset.fetch 'password'
20
+
21
+ e 'We will use this url: '+sfancy(url)
22
+ e 'We will use this user name: '+sfancy(user_name)
23
+ e 'We will use this password: '+sfancy(password)
24
+ ftp = Net::FTP.new(url)
25
+ ftp.login(user_name, password) # First the user's name, then the password
26
+ pp ftp
27
+ pp ftp.list
28
+ ftp.close
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'colours/colours_e_autoinclude.rb'
6
+ require 'cliner/autoinclude'
7
+ require 'verbose_truth'
8
+ require 'ftp_paradise'
9
+
10
+ e 'Now testing the component '+sfancy('ftp_paradise')+'.'
11
+
12
+ _ = FtpParadise::Connection.new(:dont_run_yet) { :use_default_dataset }
13
+
14
+ e
15
+ e 'The following Hash should have some data:'
16
+ e
17
+ pp FtpParadise.dataset?
18
+ e
19
+ e '(This should have already connected to the remote URL.)'
20
+ e
21
+ e 'Next, showing whether we are connected to the remote host: '+
22
+ slateblue(VerboseTruth[_.are_we_connected?])
23
+ e
24
+ e 'We will issue the method .nlst? next:'
25
+ e
26
+ pp _.nlst?
27
+ e
28
+ e
29
+ e 'Next, show a listing via .list() on the ftp-object:'
30
+ e
31
+ pp _.list?
32
+
33
+ e
34
+ e 'We will cd on the remote host next, into htdocs:'
35
+ e
36
+ e _.pwd
37
+ _.rcd 'htdocs'
38
+ e _.pwd
39
+ e
40
+ e 'HMM'
41
+ e
42
+ e 'And get a file-listing (in two different ways):'
43
+ e
44
+ pp _.list?
45
+ e
46
+ e "Listing all #{Colours.lightgreen('remote files')} next:"
47
+ e
48
+ pp _.return_all_remote_files
49
+ e
50
+ e 'Uploading a file; then showing the remote files, before this file is removed again:'
51
+ e
52
+ _.upload_this_file '/Depot/j/test.txt'
53
+ pp _.return_all_remote_files
54
+ _.remove_remote_file '/Depot/j/test.txt'
55
+ pp _.return_all_remote_files
56
+ pp _.pwd
57
+ _.do_list_content
58
+ cliner
59
+ e 'Next showing all remote directories:'
60
+ e
61
+ pp _.return_remote_directories
62
+ e
63
+ _.rcd '..'
64
+ e 'Showing the remote directory listing:'
65
+ e
66
+ _.show_remote_directory_listing
67
+ e
68
+ pp _.file_listing_as_entries?
69
+ cliner
70
+ _.show_file_listing