ftp_paradise 1.3.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ftp_paradise might be problematic. Click here for more details.

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