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.

Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +152 -28
  3. data/bin/{iftp → ftp_paradise_shell} +1 -1
  4. data/doc/README.gen +97 -15
  5. data/doc/todo/{TODO_FOR_FTP_PARADISE_PROJECT.md → todo_for_the_ftp_paradise_project.md} +0 -0
  6. data/ftp_paradise.gemspec +30 -39
  7. data/lib/ftp_paradise/base/base.rb +375 -0
  8. data/lib/ftp_paradise/colours/colours.rb +27 -27
  9. data/lib/ftp_paradise/colours/use_colours.rb +6 -1
  10. data/lib/ftp_paradise/configuration/configuration.rb +7 -4
  11. data/lib/ftp_paradise/connection/README.md +0 -0
  12. data/lib/ftp_paradise/connection/connection.rb +2782 -15
  13. data/lib/ftp_paradise/constants/constants.rb +91 -5
  14. data/lib/ftp_paradise/entry/entry.rb +42 -5
  15. data/lib/ftp_paradise/{connection → gui/gtk3/ftp_client}/constants.rb +33 -21
  16. data/lib/ftp_paradise/gui/{shared_code/ftp_paradise/ftp_paradise_module.rb → gtk3/ftp_client/ftp_client.rb} +658 -170
  17. data/lib/ftp_paradise/gui/gtk3/ftp_client/misc.rb +27 -0
  18. data/lib/ftp_paradise/project/project.rb +11 -15
  19. data/lib/ftp_paradise/requires/require_class_connection.rb +7 -0
  20. data/lib/ftp_paradise/requires/require_net_ftp.rb +7 -0
  21. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +4 -3
  22. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +1 -1
  23. data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +1 -0
  24. data/lib/ftp_paradise/{interactive_ftp → shell}/menu.rb +554 -448
  25. data/lib/ftp_paradise/shell/shell.rb +2321 -0
  26. data/lib/ftp_paradise/toplevel_methods/connect.rb +3 -0
  27. data/lib/ftp_paradise/toplevel_methods/dataset.rb +111 -0
  28. data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +4 -3
  29. data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +6 -5
  30. data/lib/ftp_paradise/toplevel_methods/login_name.rb +6 -4
  31. data/lib/ftp_paradise/toplevel_methods/misc.rb +19 -0
  32. data/lib/ftp_paradise/toplevel_methods/opn.rb +1 -1
  33. data/lib/ftp_paradise/toplevel_methods/password.rb +4 -2
  34. data/lib/ftp_paradise/toplevel_methods/port.rb +4 -1
  35. data/lib/ftp_paradise/toplevel_methods/remote_url.rb +11 -5
  36. data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +1 -0
  37. data/lib/ftp_paradise/version/version.rb +6 -1
  38. data/lib/ftp_paradise/www/web_interface.cgi +1 -1
  39. data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +0 -0
  40. data/lib/ftp_paradise/yaml/debug.yml +0 -0
  41. data/lib/ftp_paradise/yaml/open_in_default_editor.yml +0 -0
  42. data/lib/ftp_paradise/yaml/show_full_names.yml +0 -0
  43. data/lib/ftp_paradise/yaml/use_colours.yml +0 -0
  44. data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +13 -3
  45. metadata +52 -126
  46. data/lib/ftp_paradise/base/cliner.rb +0 -23
  47. data/lib/ftp_paradise/base/colours.rb +0 -83
  48. data/lib/ftp_paradise/base/prototype.rb +0 -171
  49. data/lib/ftp_paradise/base/reset.rb +0 -29
  50. data/lib/ftp_paradise/connection/data.rb +0 -164
  51. data/lib/ftp_paradise/connection/debug.rb +0 -78
  52. data/lib/ftp_paradise/connection/directory_handling.rb +0 -271
  53. data/lib/ftp_paradise/connection/do_login.rb +0 -108
  54. data/lib/ftp_paradise/connection/download.rb +0 -86
  55. data/lib/ftp_paradise/connection/file_handling.rb +0 -174
  56. data/lib/ftp_paradise/connection/ftp_object.rb +0 -21
  57. data/lib/ftp_paradise/connection/initialize.rb +0 -88
  58. data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +0 -20
  59. data/lib/ftp_paradise/connection/is_connected.rb +0 -46
  60. data/lib/ftp_paradise/connection/misc.rb +0 -474
  61. data/lib/ftp_paradise/connection/notify.rb +0 -71
  62. data/lib/ftp_paradise/connection/password.rb +0 -47
  63. data/lib/ftp_paradise/connection/port.rb +0 -33
  64. data/lib/ftp_paradise/connection/remote_pwd.rb +0 -72
  65. data/lib/ftp_paradise/connection/remote_url.rb +0 -164
  66. data/lib/ftp_paradise/connection/remove.rb +0 -143
  67. data/lib/ftp_paradise/connection/reset.rb +0 -78
  68. data/lib/ftp_paradise/connection/run.rb +0 -18
  69. data/lib/ftp_paradise/connection/set_array_available_hosts.rb +0 -27
  70. data/lib/ftp_paradise/connection/set_input.rb +0 -18
  71. data/lib/ftp_paradise/connection/show.rb +0 -153
  72. data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +0 -24
  73. data/lib/ftp_paradise/connection/transfer_mode.rb +0 -163
  74. data/lib/ftp_paradise/connection/upload.rb +0 -253
  75. data/lib/ftp_paradise/connection/use_default_dataset.rb +0 -40
  76. data/lib/ftp_paradise/connection/username.rb +0 -42
  77. data/lib/ftp_paradise/constants/misc.rb +0 -57
  78. data/lib/ftp_paradise/constants/namespace.rb +0 -14
  79. data/lib/ftp_paradise/constants/newline.rb +0 -14
  80. data/lib/ftp_paradise/constants/roebe.rb +0 -31
  81. data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +0 -233
  82. data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +0 -34
  83. data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +0 -34
  84. data/lib/ftp_paradise/interactive_ftp/constants.rb +0 -103
  85. data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +0 -216
  86. data/lib/ftp_paradise/interactive_ftp/help.rb +0 -50
  87. data/lib/ftp_paradise/interactive_ftp/initialize.rb +0 -27
  88. data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +0 -998
  89. data/lib/ftp_paradise/interactive_ftp/main_loop.rb +0 -51
  90. data/lib/ftp_paradise/interactive_ftp/misc.rb +0 -208
  91. data/lib/ftp_paradise/interactive_ftp/mode.rb +0 -124
  92. data/lib/ftp_paradise/interactive_ftp/readline.rb +0 -113
  93. data/lib/ftp_paradise/interactive_ftp/remove.rb +0 -97
  94. data/lib/ftp_paradise/interactive_ftp/reset.rb +0 -90
  95. data/lib/ftp_paradise/interactive_ftp/run.rb +0 -22
  96. data/lib/ftp_paradise/interactive_ftp/show.rb +0 -184
  97. data/lib/ftp_paradise/interactive_ftp/upload.rb +0 -90
  98. data/lib/ftp_paradise/interactive_ftp/user_input.rb +0 -53
  99. data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +0 -28
  100. data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +0 -28
  101. data/lib/ftp_paradise/toplevel_methods/data.rb +0 -31
  102. data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +0 -37
@@ -1,474 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'ftp_paradise/connection/misc.rb'
6
- # =========================================================================== #
7
- module FtpParadise
8
-
9
- class Connection
10
-
11
- require 'ftp_paradise/connection/directory_handling.rb'
12
- require 'ftp_paradise/connection/download.rb'
13
- require 'ftp_paradise/toplevel_methods/clear_user_dataset.rb'
14
-
15
- # ========================================================================= #
16
- # === dataset?
17
- # ========================================================================= #
18
- def dataset?
19
- FtpParadise.data?
20
- end
21
-
22
- # ========================================================================= #
23
- # === raw_list
24
- # ========================================================================= #
25
- def raw_list(i = '*')
26
- ftp_object?.list(i)
27
- end
28
-
29
- # ========================================================================= #
30
- # === return_slightly_sanitized_entries_ignoring_a_few
31
- # ========================================================================= #
32
- def return_slightly_sanitized_entries_ignoring_a_few(
33
- i = '*'
34
- )
35
- ftp_object?.list(i).reject {|entry|
36
- entry.to_s.strip.empty? or entry.end_with?(' .') or entry.end_with?(' ..')
37
- }.map {|line|
38
- if line.end_with? ':' # <- Some remote FTP-hosts use ':' for a directory.
39
- line[-1,1] = '/'
40
- end
41
- line
42
- }
43
- end; alias list return_slightly_sanitized_entries_ignoring_a_few # === list
44
-
45
- # ========================================================================= #
46
- # === nlst?
47
- #
48
- # Returns an array of filenames in the remote directory. This will
49
- # yield less information than the "ls -l" variant, aka list().
50
- #
51
- # Documentation:
52
- #
53
- # https://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/Net/FTP.html#method-i-nlst
54
- #
55
- # ========================================================================= #
56
- def nlst?
57
- ftp_object?.nlst
58
- end; alias nlst nlst? # === nlst
59
-
60
- # ========================================================================= #
61
- # === list? (list tag)
62
- #
63
- # Returns an array of file information in the directory (the output
64
- # is like `ls -l`). If a block is given, it iterates through the
65
- # listing.
66
- # ========================================================================= #
67
- def list?(i = '*')
68
- # ======================================================================= #
69
- # We will also sanitize this a bit.
70
- # ======================================================================= #
71
- @internal_hash[:raw_entries] = return_slightly_sanitized_entries_ignoring_a_few
72
- return @internal_hash[:raw_entries] # And return the result here.
73
- end; alias ls list? # === ls
74
- alias populate_raw_entries list? # === populate_raw_entries
75
-
76
- # ========================================================================= #
77
- # === passive=
78
- # ========================================================================= #
79
- def passive=(i = true)
80
- if ftp_object?
81
- ftp_object?.passive = i
82
- else
83
- e 'No ftp-object has been instantiated yet.'
84
- end
85
- end
86
-
87
- # ========================================================================= #
88
- # === list_content (list tag, ls tag)
89
- #
90
- # List available data.
91
- # ========================================================================= #
92
- def list_content
93
- report_current_remote_dir
94
- result = list?
95
- cliner { pp result }
96
- _ = result.first[0, 1]
97
- case _
98
- when 'd'
99
- e "Directory #{result.first}"
100
- # @array_directories
101
- when 'l'
102
- e "Link #{result.first}"
103
- else
104
- e "File #{result.first}"
105
- end
106
- end; alias do_list_content list_content # === list
107
- alias listing? list_content # === listing?
108
-
109
- # ========================================================================= #
110
- # === file_listing_as_entries?
111
- # ========================================================================= #
112
- def file_listing_as_entries?
113
- _ = remote_file_listing?
114
- if _
115
- return _.map {|entry| FtpParadise::Entry.new(entry) }
116
- end
117
- return nil
118
- end
119
-
120
- # ========================================================================= #
121
- # === empty?
122
- # ========================================================================= #
123
- def empty?
124
- array_remote_files.empty?
125
- end
126
-
127
- # ========================================================================= #
128
- # === find_matches_for
129
- #
130
- # This method will return an array of files and directories that match
131
- # to the provided input (which we will assume to be a query).
132
- # ========================================================================= #
133
- def find_matches_for(i)
134
- i = i.delete '*'
135
- update_file_listing
136
- _ = return_remote_directory_content.map(&:first)
137
- _ = _.grep(/#{i}/)
138
- return _
139
- end
140
-
141
- # ========================================================================= #
142
- # === output_sorted_by_time
143
- #
144
- # This method will output the remote content in a time-sorted manner.
145
- # ========================================================================= #
146
- def output_sorted_by_time
147
- _ = sanitized_remote_directory_content?
148
- sorted_result = _.sort_by {|array|
149
- array.last
150
- }.reverse
151
- sorted_result.each_with_index {|array, index| index += 1
152
- file_or_directory = array[1]
153
- name_of_the_file = array.first
154
- if file_or_directory == 'directory'
155
- name_of_the_file << '/' unless name_of_the_file.end_with? '/'
156
- end
157
- index = simp( (index.to_s+') ').rjust(6))
158
- e index+sfancy(name_of_the_file)
159
- }
160
- end
161
-
162
- # ========================================================================= #
163
- # === last_response
164
- #
165
- # The server's last response is available through this method here.
166
- # ========================================================================= #
167
- def last_response
168
- ftp_object?.last_response
169
- end; alias last_response? last_response # === last_response?
170
- alias last_server_response? last_response # === last_server_response?
171
-
172
- # ========================================================================= #
173
- # === raw_entries?
174
- # ========================================================================= #
175
- def raw_entries?
176
- @internal_hash[:raw_entries]
177
- end; alias remote_file_listing? raw_entries? # === remote_file_listing?
178
- alias file_listing? raw_entries? # === file_listing?
179
- alias raw_listing? raw_entries? # === raw_listing?
180
-
181
- # ========================================================================= #
182
- # === return_all_remote_files
183
- #
184
- # This method will return an Array with all remote files.
185
- # ========================================================================= #
186
- def return_all_remote_files
187
- results = nil
188
- if file_listing?
189
- results = file_listing?.select {|entry|
190
- if entry.is_a?(String) and !entry.empty?
191
- entry = FtpParadise::Entry.new(entry)
192
- end
193
- entry.is_a_file?
194
- }
195
- end
196
- return results
197
- end; alias remote_file_listing? return_all_remote_files # === remote_file_listing?
198
- alias all_remote_files? return_all_remote_files # === all_remote_files?
199
- alias array_remote_files return_all_remote_files # === array_remote_files
200
- alias return_remote_files return_all_remote_files # === return_remote_files
201
- alias return_remote_file_listing return_all_remote_files # === return_remote_file_listing
202
- alias remote_files? return_all_remote_files # === remote_files
203
- alias files? return_all_remote_files # === files?
204
-
205
- # ========================================================================= #
206
- # === status?
207
- #
208
- # Report the status here. This is equivalent to the STAT command.
209
- # ========================================================================= #
210
- def status?
211
- ftp_object?.status.to_s
212
- end; alias status status? # === status
213
-
214
- # ========================================================================= #
215
- # === return_local_directories
216
- #
217
- # Return all local directories.
218
- # ========================================================================= #
219
- def return_local_directories
220
- Dir['*'].select {|entry| File.directory?(entry) }
221
- end
222
-
223
- # ========================================================================= #
224
- # === modification_time_of?
225
- #
226
- # This method will give us the last modification time of a remote
227
- # file, by issuing the mdtm() command.
228
- #
229
- # The format returned will be in YYYMMDDhhmmss.
230
- #
231
- # If you require a parsed Time instance, you can use mtime()
232
- # on the ftp object.
233
- #
234
- # Symbols could also be used, such as "pp modification_time_of? :a".
235
- # ========================================================================= #
236
- def modification_time_of?(i)
237
- if i.is_a? Array
238
- i.each {|entry| modification_time_of(entry) } # <- Recursive call.
239
- else
240
- ftp_object?.mdtm(i.to_s)
241
- end
242
- end; alias mdtm modification_time_of? # === mdtm
243
-
244
- # ========================================================================= #
245
- # === set_file
246
- #
247
- # Use only this to modify the @file variable.
248
- # ========================================================================= #
249
- def set_file(i = nil)
250
- @internal_hash[:file] = i
251
- end
252
-
253
- # ========================================================================= #
254
- # === is_file?
255
- #
256
- # This method will check whether the input is a file or not.
257
- # It will call the method .is_directory?()
258
- # ========================================================================= #
259
- def is_file?(i)
260
- !is_a_directory?(i)
261
- end
262
-
263
- # ========================================================================= #
264
- # === logged_in?
265
- # ========================================================================= #
266
- def logged_in?
267
- ftp_object?.instance_variable_get '@logged_in'
268
- end
269
-
270
- # ========================================================================= #
271
- # === available_hosts?
272
- # ========================================================================= #
273
- def available_hosts?
274
- @internal_hash[:array_available_hosts]
275
- end; alias array_available_hosts available_hosts? # === array_available_hosts
276
- alias array_available_hosts? available_hosts? # === array_available_hosts?
277
-
278
- # ========================================================================= #
279
- # === open_timeout?
280
- # ========================================================================= #
281
- def open_timeout?
282
- ftp_object?.open_timeout.to_s if ftp_object?.respond_to? :open_timeout
283
- end
284
-
285
- # ========================================================================= #
286
- # === feedback_login_hosts
287
- #
288
- # Feedback all available login hosts, based on the information stored
289
- # in the Array @array_available_hosts.
290
- # ========================================================================= #
291
- def feedback_login_hosts
292
- opnn; e 'The followings hosts are easily available:'
293
- e
294
- available_hosts?.each { |host| e " - #{sfancy(host)}" }
295
- e
296
- end
297
-
298
- # ========================================================================= #
299
- # === help?
300
- # ========================================================================= #
301
- def help?
302
- ftp_object?.help
303
- end; alias help help? # === help
304
-
305
- # ========================================================================= #
306
- # === close (close tag)
307
- #
308
- # Close the connection here.
309
- #
310
- # Further operations will be impossible until a new connection
311
- # is opened up again, via connect().
312
- # ========================================================================= #
313
- def close
314
- ftp_object?.close
315
- end
316
-
317
- # ========================================================================= #
318
- # === mlsd
319
- # ========================================================================= #
320
- def mlsd(i)
321
- ftp_object?.mlsd(i)
322
- end
323
-
324
- # ========================================================================= #
325
- # === site
326
- # ========================================================================= #
327
- def site(i = nil)
328
- ftp_object?.site(i)
329
- end
330
-
331
- # ========================================================================= #
332
- # === file?
333
- # ========================================================================= #
334
- def file?
335
- @internal_hash[:file]
336
- end
337
-
338
- # ========================================================================= #
339
- # === system_command
340
- #
341
- # This will return system information from the remote host.
342
- #
343
- # Stuff like:
344
- # UNIX Type: L8
345
- # ========================================================================= #
346
- def system_command
347
- ftp_object?.system
348
- end; alias system system_command # === system
349
-
350
- # ========================================================================= #
351
- # === report_host_port_user_name_and_password
352
- # ========================================================================= #
353
- def report_host_port_user_name_and_password
354
- ljust = 15
355
- e '- Now trying to log in to '+simp(host?)+
356
- ' (Port: '+swarn(port?)+') using:'
357
- e ' '+('Login Name: ').ljust(ljust)+sfancy(user_name?)
358
- e ' '+('Password: ').ljust(ljust)+sfancy(password?)
359
- end
360
-
361
- # ========================================================================= #
362
- # === opnn
363
- # ========================================================================= #
364
- def opnn
365
- super(NAMESPACE)
366
- end
367
-
368
- # ========================================================================= #
369
- # === read_timeout=
370
- #
371
- # Setter-method for the #read_timeout attribute.
372
- # ========================================================================= #
373
- def read_timeout=(i)
374
- ftp_object?.read_timeout = i
375
- end
376
-
377
- # ========================================================================= #
378
- # === size?
379
- #
380
- # This method will return the size of the given (remote) filename.
381
- # ========================================================================= #
382
- def size?(i)
383
- ftp_object?.size(i)
384
- end; alias size size? # === size
385
-
386
- # ========================================================================= #
387
- # === padding?
388
- # ========================================================================= #
389
- def padding?
390
- @internal_hash[:padding]
391
- end
392
-
393
- # ========================================================================= #
394
- # === be_verbose?
395
- # ========================================================================= #
396
- def be_verbose?
397
- @internal_hash[:be_verbose]
398
- end
399
-
400
- # ========================================================================= #
401
- # === server_welcome_message?
402
- #
403
- # This method will return the remote server's welcome message.
404
- # ========================================================================= #
405
- def server_welcome_message?
406
- ftp_object?.welcome
407
- end; alias welcome? server_welcome_message? # === welcome?
408
- alias welcome server_welcome_message? # === welcome
409
-
410
- # ========================================================================= #
411
- # === noop
412
- # ========================================================================= #
413
- def noop
414
- ftp_object?.noop
415
- end
416
-
417
- # ========================================================================= #
418
- # === last_response_code?
419
- #
420
- # Return the server's last response code.
421
- # ========================================================================= #
422
- def last_response_code?
423
- ftp_object?.last_response_code
424
- end; alias last_response_code last_response_code? # === last_response_code
425
-
426
- # ========================================================================= #
427
- # === quit (quit tag)
428
- #
429
- # Use this to quit (and disconnect) from the FTP Connection again.
430
- # ========================================================================= #
431
- def quit
432
- begin
433
- if is_connected?
434
- if ftp_object?
435
- FtpParadise.clear_user_dataset
436
- ftp_object?.quit
437
- end
438
- end
439
- rescue Exception => error
440
- opnn; e "An error happened in the method #{sfancy(__method__)}()"
441
- pp error
442
- end
443
- end
444
-
445
- # ========================================================================= #
446
- # === []
447
- # ========================================================================= #
448
- def [](i)
449
- update_file_listing
450
- if i =~ /^\d+$/ # If is a number.
451
- i = remote_file_listing.size if i.to_i > remote_file_listing.size
452
- i = remote_file_listing[i.to_i - 1].first
453
- end
454
- return i
455
- end
456
-
457
- # ========================================================================= #
458
- # === sendcmd
459
- #
460
- # Sends a command and returns the response of the server.
461
- #
462
- # This has to be rescued, because there are lots of different errors
463
- # possible.
464
- # ========================================================================= #
465
- def sendcmd(i)
466
- begin
467
- ftp_object?.sendcmd(i)
468
- rescue Exception => error
469
- pp error
470
- e '(This error may be due to the remote file not existing.)'
471
- end
472
- end
473
-
474
- end; end
@@ -1,71 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'ftp_paradise/connection/notify.rb'
6
- # =========================================================================== #
7
- module FtpParadise
8
-
9
- class Connection
10
-
11
- # ========================================================================= #
12
- # === notify_the_user_about
13
- #
14
- # This method is a general "user notifier". It will notify the user
15
- # about doing certain actions within the FtpParadise project.
16
- # ========================================================================= #
17
- def notify_the_user_about(
18
- i, method
19
- )
20
- case method
21
- # ======================================================================= #
22
- # === :set_transfer_mode
23
- # ======================================================================= #
24
- when :set_transfer_mode
25
- opnn; e "Setting mode to #{orange(i.to_s)} now."
26
- # ======================================================================= #
27
- # === :remove_remote_files
28
- # ======================================================================= #
29
- when :remove_remote_files
30
- opnn; e "Deleting the remote file `#{sdir(i)}` now."
31
- # ======================================================================= #
32
- # === :upload_binary_file
33
- # ======================================================================= #
34
- when :upload_binary_file
35
- opnn; e 'Now trying to upload the binary file `'+sfile(i)+'`'
36
- opnn; e 'to the remote host `'+sfancy(remote_host?)+'`.'
37
- # ======================================================================= #
38
- # === :create_this_remote_directory
39
- # ======================================================================= #
40
- when :create_this_remote_directory
41
- opnn; e 'Creating the remote directory `'+sdir(i)+'` now.'
42
- # ======================================================================= #
43
- # === :remote_cd
44
- # ======================================================================= #
45
- when :remote_cd
46
- opnn; e 'Trying to remote-change directory into `'+sdir(i)+'`.'
47
- # ======================================================================= #
48
- # === :download_this_remote_file
49
- # ======================================================================= #
50
- when :download_this_remote_file
51
- opnn; e "Downloading the remote file `#{sdir(i)}` now."
52
- # ======================================================================= #
53
- # === :upload_this_text_file
54
- # ======================================================================= #
55
- when :upload_this_text_file
56
- opnn; e 'Uploading the local text file `'+sfile(i)+'` to '\
57
- 'the remote host at `'+sfancy(remote_pwd?)+'`.'
58
- # ======================================================================= #
59
- # === :create_remote_file
60
- # ======================================================================= #
61
- when :create_remote_file
62
- opnn; e 'Creating the remote file `'+sdir(i)+'` now.'
63
- # ======================================================================= #
64
- # === :remove_remote_directory
65
- # ======================================================================= #
66
- when :remove_remote_directory
67
- opnn; e 'Removing the remote directory `'+sdir(i)+'` now.'
68
- end
69
- end
70
-
71
- end; end
@@ -1,47 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'ftp_paradise/connection/password.rb'
6
- # =========================================================================== #
7
- module FtpParadise
8
-
9
- class Connection
10
-
11
- require 'ftp_paradise/toplevel_methods/password.rb'
12
-
13
- # ========================================================================= #
14
- # === password?
15
- # ========================================================================= #
16
- def password?
17
- ::FtpParadise.password?.to_s
18
- end; alias password password? # === password
19
-
20
- # ========================================================================= #
21
- # === set_password
22
- #
23
- # Use only this method when attempting to modify the @password.
24
- #
25
- # This @ivar keeps track of the password we will use.
26
- # ========================================================================= #
27
- def set_password(
28
- i = :try_to_use_a_default_password
29
- )
30
- case i
31
- when :try_to_use_a_default_password,
32
- :default
33
- if FtpParadise::RoebeFtpConstants::BPLACED
34
- _ = FtpParadise::RoebeFtpConstants::BPLACED[2]
35
- _.chop! if _.end_with? '_'
36
- i = _
37
- end
38
- when :anonymous
39
- i = nil
40
- else
41
- i = i.to_s
42
- end
43
- ::FtpParadise.set_password(i)
44
- i # Return the password here as well, so that we can use it for assignments.
45
- end; alias password= set_password # === password=
46
-
47
- end; end
@@ -1,33 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'ftp_paradise/connection/port.rb'
6
- # =========================================================================== #
7
- module FtpParadise
8
-
9
- class Connection
10
-
11
- require 'ftp_paradise/toplevel_methods/port.rb'
12
- require 'ftp_paradise/connection/ftp_object.rb'
13
-
14
- # ========================================================================= #
15
- # === set_port
16
- #
17
- # Use this method to set the port. The port will be stored on the
18
- # toplevel-"namespace".
19
- # ========================================================================= #
20
- def set_port(
21
- i = DEFAULT_PORT
22
- )
23
- FtpParadise.set_port(i)
24
- end
25
-
26
- # ========================================================================= #
27
- # === port?
28
- # ========================================================================= #
29
- def port?
30
- FtpParadise.port?.to_s
31
- end; alias port port? # === port
32
-
33
- end; end
@@ -1,72 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'ftp_paradise/connection/remote_pwd.rb'
6
- # =========================================================================== #
7
- module FtpParadise
8
-
9
- class Connection
10
-
11
- require 'ftp_paradise/connection/remote_url.rb'
12
-
13
- # ========================================================================= #
14
- # === remote_pwd
15
- # ========================================================================= #
16
- def remote_pwd
17
- ftp_object?.pwd
18
- end; alias rpwd remote_pwd # === rpwd
19
- alias getdir remote_pwd # === getdir
20
-
21
- # ========================================================================= #
22
- # === return_remote_pwd
23
- #
24
- # This method will return the (remote) pwd, including the remote working
25
- # directory - including the subpath..
26
- #
27
- # This method will ensure that a trailing '/' will be returned here.
28
- #
29
- # The official documentation can be seen here:
30
- # https://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/Net/FTP.html#method-i-pwd
31
- # ========================================================================= #
32
- def return_remote_pwd
33
- begin
34
- if is_connected?
35
- remote_pwd = remote_url?.dup
36
- # ===================================================================== #
37
- # Need to safeguard, in the event that we are not connected to a
38
- # remote FTP server.
39
- # ===================================================================== #
40
- remote_pwd << ftp_object?.pwd.to_s if ftp_object?
41
- remote_pwd << '/'
42
- return rds(remote_pwd)
43
- else
44
- opnn; e 'No FTP connection is open.'
45
- ''
46
- end
47
- rescue Net::FTPReplyError
48
- opnn; e 'Error Net::FTPReplyError received. May be due to user interrupting.'
49
- opnn; e 'Exiting now at once either way.'
50
- exit
51
- rescue SystemExit, Interrupt
52
- opnn; e 'User requested to exit, thus exiting now.'
53
- exit
54
- end
55
- end; alias pwd? return_remote_pwd # === pwd?
56
- alias pwd return_remote_pwd # === pwd (pwd tag)
57
- alias getdir return_remote_pwd # === get_dir
58
- alias remote_pwd return_remote_pwd # === remote_pwd
59
- alias remote_pwd? return_remote_pwd # === remote_pwd?
60
- alias connected_to? return_remote_pwd # === connected_to?
61
- alias remote? return_remote_pwd # === remote?
62
- alias base_dir? return_remote_pwd # === base_dir?
63
- alias remote_directory? return_remote_pwd # === remote_directory?
64
- alias remote_dir? return_remote_pwd # === remote_dir?
65
- alias remote_path? return_remote_pwd # === remote_path?
66
- alias return_subdirectory return_remote_pwd # === return_subdirectory
67
- alias current_directory return_remote_pwd # === current_directory
68
- alias return_remote_dir return_remote_pwd # === return_remote_dir
69
- alias get_remote_dir return_remote_pwd # === get_remote_dir
70
- alias remote_host? return_remote_pwd # === remote_host?
71
-
72
- end; end