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,51 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/interactive_ftp/main_loop.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class InteractiveFtp # === FtpParadise::InteractiveFtp
10
+
11
+ # ========================================================================= #
12
+ # === enter_main_loop
13
+ # ========================================================================= #
14
+ def enter_main_loop
15
+ # ======================================================================= #
16
+ # Enter the remote directory htdocs if we are on ftpupload.net
17
+ # or on a similar host..
18
+ # ======================================================================= #
19
+ if remote_url?.include?('ftpupload.net')
20
+ remote_cd 'htdocs', :be_verbose
21
+ elsif remote_url?.include?('shevy.bplaced.net')
22
+ remote_cd 'www', :be_verbose
23
+ end
24
+ check_commandline_arguments # <- This will also query the menu() method.
25
+ show_welcome_message
26
+ display_prompt
27
+ loop {
28
+ begin
29
+ # =================================================================== #
30
+ # Obtain the user input:
31
+ # =================================================================== #
32
+ obtain_user_input
33
+ # =================================================================== #
34
+ # Pass the user input into the menu interface:
35
+ # =================================================================== #
36
+ result = menu
37
+ result = result.first if result.is_a? Array
38
+ case result
39
+ when *ARRAY_VALID_OPTIONS_FOR_EXITING_THE_SHELL, :break
40
+ break
41
+ when :exit
42
+ exit
43
+ end
44
+ rescue Interrupt
45
+ e 'In order to quit, please use "'+
46
+ steelblue('q')+'" instead.'
47
+ end
48
+ }
49
+ end; alias enter_loop enter_main_loop # === enter_loop
50
+
51
+ end; end
@@ -0,0 +1,786 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/interactive_ftp/menu.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class InteractiveFtp
10
+
11
+ require 'ftp_paradise/interactive_ftp/upload.rb'
12
+
13
+ begin
14
+ require 'verbose_truth'
15
+ rescue LoadError; end
16
+
17
+ begin
18
+ require 'rcfiles/requires/require_the_expand_cd_aliases.rb'
19
+ rescue LoadError; end
20
+
21
+ require 'ftp_paradise/toplevel_methods/ftp_object.rb'
22
+
23
+ # ========================================================================= #
24
+ # === vte
25
+ # ========================================================================= #
26
+ def vt(i)
27
+ VerboseTruth[i].to_s
28
+ end
29
+
30
+ # ========================================================================= #
31
+ # === esystem
32
+ # ========================================================================= #
33
+ def esystem(i)
34
+ e i
35
+ system i
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === menu (menu tag)
40
+ #
41
+ # Do note that @user_input will always be an Array.
42
+ # ========================================================================= #
43
+ def menu(
44
+ i = @user_input
45
+ )
46
+ if i.is_a? Array
47
+ i.each {|entry| menu(entry) }
48
+ else
49
+ # ===================================================================== #
50
+ # Handle arguments first. We have to check if our input contains
51
+ # any ' ' characters or not.
52
+ # ===================================================================== #
53
+ if i.include? ' '
54
+ @splitted = i.split(' ')
55
+ @first_argument = @splitted[1]
56
+ @s = @second_argument = @splitted[2]
57
+ @all_arguments = @splitted[1..-1] # This here does not contain the first argument.
58
+ i = @splitted[0]
59
+ else
60
+ # =================================================================== #
61
+ # Reset again here so that we have a clean initial state.
62
+ # =================================================================== #
63
+ reset_instance_variables_that_hold_all_arguments
64
+ end
65
+ f = @first_argument
66
+ case i # case tag
67
+ # ===================================================================== #
68
+ # === toshevy
69
+ #
70
+ # This is my "convenience" login.
71
+ # ===================================================================== #
72
+ when /^-?-?toshevy$/,
73
+ /^-?-?shevy$/i,
74
+ 'shev', # Login as shevy.
75
+ 'iftp',
76
+ 'remote'
77
+ do_login_to_shevy_and_consider_showing_the_remote_files
78
+ # ===================================================================== #
79
+ # === uniwien_homepage
80
+ # ===================================================================== #
81
+ when /^-?-?uniwien(_|-)?homepage$/
82
+ do_login(:uniwien_homepage)
83
+ if SHOW_REMOTE_FILES_UPON_SUCCESSFUL_LOGIN
84
+ show_remote_files :also_show_filesize # Also display this since as of March 2015.
85
+ end
86
+ # ===================================================================== #
87
+ # === login
88
+ # ===================================================================== #
89
+ when 'login',
90
+ 'log',
91
+ 'cto',
92
+ 'con',
93
+ 'connect_to',
94
+ 'do_login',
95
+ 'conn',
96
+ 'connectto',
97
+ 'connect2',
98
+ /^-?-?do(_|-)?connect$/i,
99
+ 'connect' # ← easier alias for now.
100
+ do_login(f) { :be_verbose }
101
+ # ===================================================================== #
102
+ # === set_url
103
+ # ===================================================================== #
104
+ when /^-?-?set(_|-)?url$/i
105
+ e 'Setting to the remote host called '+sfancy(f)+'.'
106
+ set_url(f)
107
+ # ===================================================================== #
108
+ # === set_password
109
+ # ===================================================================== #
110
+ when 'set_password',
111
+ 'setpassword',
112
+ 'password'
113
+ set_password(f)
114
+ # ===================================================================== #
115
+ # === setname
116
+ #
117
+ # This entry point allows us to set the name of the user.
118
+ # ===================================================================== #
119
+ when 'setname',
120
+ 'set_name',
121
+ 'set_user',
122
+ 'setuser',
123
+ 'set_user_name',
124
+ 'username'
125
+ set_name(f)
126
+ # ===================================================================== #
127
+ # === everything
128
+ #
129
+ # Can also be invoked via show_host_user_name_port_and_password.
130
+ # ===================================================================== #
131
+ when 'everything',
132
+ /show_?host_?user_?name_?port_?and_?password/,
133
+ 'username?',
134
+ 'uname?',
135
+ 'user?'
136
+ show_host_user_name_port_and_password
137
+ # ===================================================================== #
138
+ # === chmod
139
+ # ===================================================================== #
140
+ when 'chmod'
141
+ filename = 'htop-2.2.0.tar.xz'
142
+ try_to_chmod_this_remote_file(filename)
143
+ # ===================================================================== #
144
+ # === remote_host?
145
+ # ===================================================================== #
146
+ when /^remote(_|-)host\??/
147
+ e sfancy(FtpParadise.remote_host?)
148
+ # ===================================================================== #
149
+ # === vim
150
+ # ===================================================================== #
151
+ when /^vim/
152
+ esystem "vim #{f}"
153
+ # ===================================================================== #
154
+ # === set_editor
155
+ #
156
+ # This entry point allows us to specify a different editor.
157
+ # ===================================================================== #
158
+ when /^set(-|_| )?editor$/ # === set_editor vim
159
+ set_editor(f)
160
+ # ===================================================================== #
161
+ # === editor?
162
+ # ===================================================================== #
163
+ when 'editor?',
164
+ /^report(-|_| )?which(-|_| )?editor(-|_| )?is(-|_| )?in(-|_| )?use$/i
165
+ report_which_editor_is_in_use
166
+ # ===================================================================== #
167
+ # === edit
168
+ # ===================================================================== #
169
+ when 'edit',
170
+ 'bluefish',
171
+ 'bl',
172
+ 'open',
173
+ /^open(-|_| )?this(-|_| )?file(-|_| )?in(-|_| )?editor$/,
174
+ 'open?'
175
+ open_this_file_in_editor(f)
176
+ # ===================================================================== #
177
+ # === binary_upload
178
+ # ===================================================================== #
179
+ when /^binary(-|_| )?upload$/,
180
+ /^upload(-|_| )?binary$/,
181
+ 'bupload',
182
+ do_use_binary_mode
183
+ upload(f)
184
+ # ===================================================================== #
185
+ # === upload_this_file
186
+ #
187
+ # This entry point allows us to upload a local file to a remote
188
+ # host.
189
+ #
190
+ # Invocation example:
191
+ #
192
+ # upload /Depot/j/test.md
193
+ #
194
+ # ===================================================================== #
195
+ when /^-?-?upload(-|_| )?this(-|_| )?file$/,
196
+ 'upload',
197
+ 'upoad',
198
+ 'upl',
199
+ 'up',
200
+ 'icopy', # copy all from local to remote dir
201
+ 'uload'
202
+ upload(@all_arguments) # bl $FTP_PARADISE/
203
+ # ===================================================================== #
204
+ # === iftp download
205
+ #
206
+ # This entry point allows us to download a remote file, via
207
+ # ruby's FTP interface.
208
+ # ===================================================================== #
209
+ when /^-?-?download$/,'get','down','do','dow','dload','dl',
210
+ 'wget','wg'
211
+ download_remote_file(f)
212
+ # ===================================================================== #
213
+ # === remote_dirs?
214
+ # ===================================================================== #
215
+ when 'remote_dirs?','dirs?','dir?','dir','dirs','onlydirs',
216
+ 'remotedirs?',
217
+ /^-?-?show(-|_| )?remote(-|_| )?directories$/
218
+ show_remote_directories
219
+ # ===================================================================== #
220
+ # === rpwd
221
+ # ===================================================================== #
222
+ when 'rpwd',
223
+ /^remote(-|_| )?pwd/,
224
+ 'remote_pwd?','remote_path?','remote_dir?','rdir',
225
+ 'lpwd','rpwd?','rcd?'
226
+ report_remote_directory
227
+ # ===================================================================== #
228
+ # === upload_directory
229
+ # ===================================================================== #
230
+ when /^upload(_|-)?directory$/
231
+ upload_directory(f)
232
+ # ===================================================================== #
233
+ # === raw_list
234
+ #
235
+ # This entry point will just do .list() on the ftp-object that
236
+ # holds our remote connection.
237
+ # ===================================================================== #
238
+ when /^raw(_|-)?list$/
239
+ pp ftp?.raw_list
240
+ # ===================================================================== #
241
+ # === raw
242
+ # ===================================================================== #
243
+ when 'raw','@array_file_listing','array_file_listing',
244
+ 'l1','list_content','raw?'
245
+ pp ftp?.array_file_listing
246
+ # ===================================================================== #
247
+ # === remote_remove
248
+ # ===================================================================== #
249
+ when 'remote_remove','rrmdir','remove_remote_directory','removeremove',
250
+ 'rremove','rrmfile','rrm','remove_remote','remote_rm','remoterm',
251
+ 'remove_remote_file',
252
+ 'rrem',
253
+ 'removeremotedirectory',
254
+ 'del',
255
+ 'remoteremove',
256
+ 'removeremote',
257
+ 'remove_remove',
258
+ 'remoteremote',
259
+ 'remove_remote_dir',
260
+ 'rmdir',
261
+ 'remotermdir',
262
+ 'deldir'
263
+ _ = a?
264
+ if user_input?.first.include?(' ') and
265
+ _.last.end_with?('.pdf','.pdf"') # <-- Yup, hackish. For now we only make an exception for .pdf files.
266
+ _ = _.join(' ')
267
+ end
268
+ remote_remove(_)
269
+ # ===================================================================== #
270
+ # === nlst
271
+ # ===================================================================== #
272
+ when 'nlst','nls','nlst?'
273
+ e ftp?.nlst
274
+ # ===================================================================== #
275
+ # === list?
276
+ # ===================================================================== #
277
+ when 'list?','list'
278
+ pp ftp?.list?
279
+ # ===================================================================== #
280
+ # === q
281
+ # ===================================================================== #
282
+ when *ARRAY_VALID_OPTIONS_FOR_EXITING_THE_SHELL, :break
283
+ :break # quit tag
284
+ # ===================================================================== #
285
+ # === @_
286
+ # ===================================================================== #
287
+ when '@_','@_?','__','ftp?','ftp_object?','ftpobject?'
288
+ pp ftp?
289
+ # ===================================================================== #
290
+ # === FtpParadise.dataset?
291
+ # ===================================================================== #
292
+ when 'FtpParadise.dataset?','dataset?'
293
+ pp FtpParadise.dataset?
294
+ # ===================================================================== #
295
+ # === ll
296
+ # ===================================================================== #
297
+ when 'll',
298
+ 'llpwd',
299
+ 'showlocalfiles',
300
+ 'show_local_files',
301
+ 'ls',
302
+ 'local','l'
303
+ show_local_entries
304
+ # ===================================================================== #
305
+ # === remote_ls
306
+ #
307
+ # This entry point will show which remote files exist.
308
+ # ===================================================================== #
309
+ when 'remote_ls',
310
+ 'remotell',
311
+ 'listing',
312
+ 'lll',
313
+ 'lls',
314
+ 'llll',
315
+ 'remotecontent?',
316
+ '3l','show_remote_files','l?','listing?',
317
+ 'rls',
318
+ '3list',
319
+ 'rll',
320
+ 'remotels',
321
+ /remote_?listing/,
322
+ 'showremotecontent','showremote'
323
+ e "The remote file listing at #{sfancy(remote_host?)} is:"
324
+ show_remote_files
325
+ # ===================================================================== #
326
+ # === rcd
327
+ #
328
+ # This entry point allows us to change to a remote directory.
329
+ #
330
+ # Invocation example:
331
+ #
332
+ # rcd htdocs
333
+ #
334
+ # ===================================================================== #
335
+ when 'rcd',
336
+ /^-?-?remote(-|_| )?change(-|_| )?directory$/,
337
+ 'rchange_dir','lcd','remotecd','rc','remote_cd'
338
+ remote_change_directory(f, :show_remote_file_listing)
339
+ # ===================================================================== #
340
+ # === anonymous
341
+ # ===================================================================== #
342
+ when 'anonymous','anon'
343
+ enable_anonymous_login
344
+ # ===================================================================== #
345
+ # === port?
346
+ # ===================================================================== #
347
+ when 'port?', /report_?port/
348
+ report_port
349
+ # ===================================================================== #
350
+ # === mode?
351
+ # ===================================================================== #
352
+ when 'mode?','mode','transfermode?'
353
+ e 'The mode for InteractiveFtp is: '+sfancy(@mode.to_s)
354
+ # ===================================================================== #
355
+ # === show_user_and_password
356
+ # ===================================================================== #
357
+ when /show_?user_?and_?password/
358
+ show_user_and_password
359
+ # ===================================================================== #
360
+ # === show_hosts
361
+ # ===================================================================== #
362
+ when /^-?-?show_?hosts/,'hosts?'
363
+ show_hosts
364
+ # ===================================================================== #
365
+ # === move_remote_file
366
+ # ===================================================================== #
367
+ when /move_?remote_?file/,'rmv','mmv','remote_mv'
368
+ move_remote_file(a)
369
+ # ===================================================================== #
370
+ # === download_binary_file
371
+ # ===================================================================== #
372
+ when 'download_binary_file','downloadbinaryfile',
373
+ 'getbinaryfile'
374
+ ftp?.download_binary_file(f)
375
+ # ===================================================================== #
376
+ # === file?
377
+ # ===================================================================== #
378
+ when 'file?','upload?','f?'
379
+ consider_reporting_file
380
+ # ===================================================================== #
381
+ # === www
382
+ # ===================================================================== #
383
+ when 'www','sinatra','show_www_component','www?'
384
+ show_www_component
385
+ # ===================================================================== #
386
+ # === binary?
387
+ # ===================================================================== #
388
+ when 'binary?'
389
+ e vt(@mode == :binary)
390
+ # ===================================================================== #
391
+ # === is_directory?
392
+ # ===================================================================== #
393
+ when 'is_directory?','isdirectory?','isdir?','is_a_directory?'
394
+ e is_dir(f).to_s
395
+ # ===================================================================== #
396
+ # === active
397
+ # ===================================================================== #
398
+ when 'active'
399
+ set_active
400
+ # ===================================================================== #
401
+ # === passive
402
+ # ===================================================================== #
403
+ when 'passive'
404
+ set_passive
405
+ # ===================================================================== #
406
+ # === download?
407
+ # ===================================================================== #
408
+ when 'download?'
409
+ download?
410
+ # ===================================================================== #
411
+ # === stat
412
+ # ===================================================================== #
413
+ when 'stat','stat?'
414
+ stat_remote_file(f)
415
+ # ===================================================================== #
416
+ # === a1?
417
+ # ===================================================================== #
418
+ when 'a1?' # Feedback the A1 values.
419
+ pp A1
420
+ # ===================================================================== #
421
+ # === ..
422
+ # ===================================================================== #
423
+ when '..'
424
+ change_directory(i) # Special cd instruction.
425
+ # ===================================================================== #
426
+ # === ascii
427
+ # ===================================================================== #
428
+ when 'ascii'
429
+ use_ascii_mode(true)
430
+ # ===================================================================== #
431
+ # === disable
432
+ # ===================================================================== #
433
+ when 'disable'
434
+ disable f
435
+ # ===================================================================== #
436
+ # === info
437
+ # ===================================================================== #
438
+ when 'info','debug','deb','debug_it','debugit'
439
+ debug_it
440
+ # ===================================================================== #
441
+ # === show_full_names
442
+ # ===================================================================== #
443
+ when 'show_full_names',
444
+ 'not_show',
445
+ 'notshow',
446
+ 'show',
447
+ 'show_names'
448
+ toggle_show_full_names
449
+ # ===================================================================== #
450
+ # === base_dir?
451
+ # ===================================================================== #
452
+ when 'base_dir?','basedir?'
453
+ e PROJECT_BASE_DIRECTORY
454
+ # ===================================================================== #
455
+ # === config?
456
+ # ===================================================================== #
457
+ when 'config?','configuration?','ccc','config'
458
+ display_configuration_options
459
+ pp @config
460
+ # ===================================================================== #
461
+ # === local_files
462
+ # ===================================================================== #
463
+ when 'local_files','localfiles'
464
+ show_local_files(true) # true for dirs-only.
465
+ # ===================================================================== #
466
+ # === set
467
+ # ===================================================================== #
468
+ when 'set','set_file','setfile','file','assign'
469
+ if @first_argument.to_s =~ /^\d+/ # upload only a specific number.
470
+ @first_argument = Dir['*'][@first_argument.to_i + 1]
471
+ end
472
+ set_file(f)
473
+ e "Setting @file to `#{sfile(file?)}` now." if be_verbose
474
+ # ===================================================================== #
475
+ # === available?
476
+ # ===================================================================== #
477
+ when 'available?','show_available_connections'
478
+ show_available_connections
479
+ # ===================================================================== #
480
+ # === toggle2
481
+ # ===================================================================== #
482
+ when 'toggle2','toggle_modes','togglemodes','t2' # toggle the mode.
483
+ toggle_modes
484
+ # ===================================================================== #
485
+ # === last
486
+ # ===================================================================== #
487
+ when 'last'
488
+ last_action = @history.last
489
+ check_against_menu(last_action)
490
+ # ===================================================================== #
491
+ # === localdir?
492
+ # ===================================================================== #
493
+ when 'localdir?','ldir'
494
+ report_local_dir
495
+ # ===================================================================== #
496
+ # === binary
497
+ # ===================================================================== #
498
+ when 'binary'
499
+ use_binary_mode(true)
500
+ # ===================================================================== #
501
+ # === yaml?
502
+ # ===================================================================== #
503
+ when 'yaml?'
504
+ show_ftp_yaml_file
505
+ # ===================================================================== #
506
+ # === remove_local
507
+ # ===================================================================== #
508
+ when 'remove_local','delete','rm','remove','rem'
509
+ remove_local(f)
510
+ # ===================================================================== #
511
+ # === site?
512
+ # ===================================================================== #
513
+ when 'site?'
514
+ e ftp?.site
515
+ # ===================================================================== #
516
+ # === mdtm
517
+ # ===================================================================== #
518
+ when 'mdtm','modtime?','modtime','modification_time_of?',
519
+ 'show_modtime_of','showmodtimeof','mtime?' # mtime? is probably only temporary.
520
+ show_modtime_of(f)
521
+ # ===================================================================== #
522
+ # === downloaded?
523
+ # ===================================================================== #
524
+ when 'downloaded?'
525
+ show_which_files_we_did_download_so_far
526
+ # ===================================================================== #
527
+ # === set_login
528
+ # ===================================================================== #
529
+ when /set_?login/,'login='
530
+ set_login(a?)
531
+ # ===================================================================== #
532
+ # === cd
533
+ # ===================================================================== #
534
+ when 'cd','change_dir'
535
+ change_directory(f)
536
+ # ===================================================================== #
537
+ # === status?
538
+ # ===================================================================== #
539
+ when 'status?','info?','stats?','s?','status'
540
+ show_status
541
+ # ===================================================================== #
542
+ # === connected_to?
543
+ # ===================================================================== #
544
+ when 'connected?','c?','remote?','host?',
545
+ 'connected_to?','url?','cto?','?'
546
+ connected_to?
547
+ # ===================================================================== #
548
+ # === remotemkdir
549
+ # ===================================================================== #
550
+ when 'rmkdir','remote_mkdir','remotemkdir','mkdir_remote'
551
+ create_remote_directory(f)
552
+ # ===================================================================== #
553
+ # === is_file?
554
+ # ===================================================================== #
555
+ when /is_?file\??/
556
+ f = convert_number_to_file(f)
557
+ e ftp?.is_file?(f).to_s
558
+ # ===================================================================== #
559
+ # === change
560
+ # ===================================================================== #
561
+ when 'change'
562
+ change @first_argument
563
+ # ===================================================================== #
564
+ # === full
565
+ # ===================================================================== #
566
+ when 'full'
567
+ e 'We will show the full path.'
568
+ do_show_full_names
569
+ # ===================================================================== #
570
+ # === full_names?
571
+ # ===================================================================== #
572
+ when 'full_names?','full?','names?','name?','fullnames?',
573
+ 'full_path?','fullpath?'
574
+ will_we_show_full_names
575
+ # ===================================================================== #
576
+ # === rename
577
+ # ===================================================================== #
578
+ when 'rename','remote_rename','remoterename','remotemv'
579
+ rename(f?, @s)
580
+ # ===================================================================== #
581
+ # === remote_remove
582
+ # ===================================================================== #
583
+ when 'mv','move_file','movefile','move_lovel_file'
584
+ move_local_file(f, @s)
585
+ # ===================================================================== #
586
+ # === last?
587
+ # ===================================================================== #
588
+ when 'last?'
589
+ e @history.last
590
+ # ===================================================================== #
591
+ # === history
592
+ # ===================================================================== #
593
+ when 'history','history?'
594
+ show_history
595
+ # ===================================================================== #
596
+ # === cat
597
+ # ===================================================================== #
598
+ when 'cat'
599
+ display_file(f)
600
+ # ===================================================================== #
601
+ # === touch
602
+ # ===================================================================== #
603
+ when 'touch'
604
+ create_file(f)
605
+ # ===================================================================== #
606
+ # === mkdir
607
+ # ===================================================================== #
608
+ when 'mkdir'
609
+ create_directory(f, :be_verbose)
610
+ # ===================================================================== #
611
+ # == set_port
612
+ # ===================================================================== #
613
+ when 'set_port','setport','port'
614
+ set_port(f) # setport 33791
615
+ # ===================================================================== #
616
+ # === debug?
617
+ # ===================================================================== #
618
+ when 'debug?'
619
+ e verbose_truth(@config.debug.to_s)
620
+ ftp?.status?
621
+ # ===================================================================== #
622
+ # === help?
623
+ # ===================================================================== #
624
+ when *ARRAY_HELP_OPTIONS
625
+ show_help
626
+ # ===================================================================== #
627
+ # === dated?
628
+ # ===================================================================== #
629
+ when 'dated?','dated'
630
+ show_date_sorted_entries
631
+ # ===================================================================== #
632
+ # === date?
633
+ # ===================================================================== #
634
+ when 'date?','date'
635
+ e return_time+' '+return_date
636
+ # ===================================================================== #
637
+ # === welcome
638
+ # ===================================================================== #
639
+ when 'welcome','show_welcome_message','welcome?','welc'
640
+ show_ftp_server_welcome
641
+ # ===================================================================== #
642
+ # === show_ftp_docu
643
+ # ===================================================================== #
644
+ when 'show_ftp_docu','ftp_docu?','docu?','ftp_docu'
645
+ show_ftp_docu
646
+ # ===================================================================== #
647
+ # === enable_readline
648
+ # ===================================================================== #
649
+ when /^-?-?enable(_|-)?readline$/
650
+ enable_readline
651
+ # ===================================================================== #
652
+ # === disconnect
653
+ # ===================================================================== #
654
+ when 'disconnect','dconnect','out'
655
+ disconnect
656
+ # ===================================================================== #
657
+ # === toggle
658
+ # ===================================================================== #
659
+ when 'toggle'
660
+ toggle(f)
661
+ # ===================================================================== #
662
+ # === colours?
663
+ # ===================================================================== #
664
+ when 'colours?','show_colours'
665
+ e 'Will we use colours: '+vt(use_colours?)
666
+ show_colours
667
+ # ===================================================================== #
668
+ # === nofull
669
+ # ===================================================================== #
670
+ when 'nofull'
671
+ e 'We will not show the full path.'
672
+ do_not_show_full_names
673
+ # ===================================================================== #
674
+ # === last_response_code?
675
+ # ===================================================================== #
676
+ when 'last_response_code?','last_response_code','lastresponsecode',
677
+ 'lastresponsecode?','report_last_response_code'
678
+ report_last_response_code
679
+ # ===================================================================== #
680
+ # === last_response?
681
+ # ===================================================================== #
682
+ when 'last_response?','last_response','lastresponse','lastresponse?',
683
+ 'lastconnected','laststatus'
684
+ report_last_response
685
+ # ===================================================================== #
686
+ # === noop
687
+ # ===================================================================== #
688
+ when 'noop'
689
+ ftp?.noop
690
+ e ftp?.last_response
691
+ # ===================================================================== #
692
+ # === pwd
693
+ # ===================================================================== #
694
+ when 'pwd','pwd?','pw'
695
+ report_local_directory
696
+ # ===================================================================== #
697
+ # === readline?
698
+ # ===================================================================== #
699
+ when 'readline?'
700
+ e verbose_truth(use_readline?)
701
+ # ===================================================================== #
702
+ # === iftp --no-readline
703
+ # ===================================================================== #
704
+ when /^-?-?no(-|_)?readline$/,
705
+ /^-?-?do(-|_| )?not(-|_| )?use(-|_| )?readline$/
706
+ do_not_use_readline
707
+ # ===================================================================== #
708
+ # === datafile?
709
+ # ===================================================================== #
710
+ when 'datafile?'
711
+ e datafile?
712
+ # ===================================================================== #
713
+ # === delete
714
+ #
715
+ # Invocation example:
716
+ # delete files for your website should be uploaded here!
717
+ # ===================================================================== #
718
+ when /^-?-?delete$/,
719
+ /^-?-?del$/
720
+ remote_remove_file(@all_arguments.join(' ').strip)
721
+ # ===================================================================== #
722
+ # === remote_remove_file
723
+ #
724
+ # This entry point allows us to remove a (or several) remote file(s).
725
+ #
726
+ # Usage example:
727
+ # rcd htdocs; remote-remove index2.html
728
+ # ===================================================================== #
729
+ when /^-?-?remote(-|_| )?remove(-|_| )?files?$/,
730
+ /^-?-?remote(-|_| )?remove$/
731
+ remote_remove_file(a?)
732
+ # ===================================================================== #
733
+ # === remote-create-directory
734
+ # ===================================================================== #
735
+ when /^-?-?remote(-|_| )?create(-|_| )?directory$/,
736
+ /^-?-?remote(-|_| )?mkdir$/
737
+ remote_create_directory(a?)
738
+ # ===================================================================== #
739
+ # === quiet
740
+ # ===================================================================== #
741
+ when 'quiet','be_quiet'
742
+ ConvertGlobalEnv.be_quiet # So that it will be silent.
743
+ # ===================================================================== #
744
+ # === password?
745
+ # ===================================================================== #
746
+ when 'password?',
747
+ 'pw?'
748
+ e password?
749
+ # ===================================================================== #
750
+ # === help
751
+ # ===================================================================== #
752
+ when /help/
753
+ show_help
754
+ # ===================================================================== #
755
+ # === list2
756
+ # ===================================================================== #
757
+ when 'list2','rlist' # Debug here.
758
+ ftp?.list
759
+ # ===================================================================== #
760
+ # === time
761
+ # ===================================================================== #
762
+ when 'time','time?'
763
+ e return_time
764
+ # ===================================================================== #
765
+ # === version?
766
+ # ===================================================================== #
767
+ when 'version?',/^report(_|-)?version/
768
+ report_version
769
+ else # else tag.
770
+ _ = Rcfiles::ExpandCdAliases.new(i) # To expand our cd-aliases.
771
+ if _._ # If we have found it.
772
+ change_directory(_._) # My cd-aliases go in here.
773
+ elsif i =~ /^\d+$/
774
+ remote_cd(i) # perform a remote cd here.
775
+ elsif i[0,1] == '?' # If has leading '?'
776
+ stat_remote_file(i[1..-1])
777
+ else
778
+ display_prompt # Else display the prompt by default.
779
+ end
780
+ end
781
+ reset_instance_variables_that_hold_all_arguments
782
+ return @run_mode
783
+ end
784
+ end; alias check_against_menu menu # === check_against_menu
785
+
786
+ end; end