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.
- checksums.yaml +7 -0
- data/README.md +319 -0
- data/bin/create_remote_directory +9 -0
- data/bin/ftp_get +17 -0
- data/bin/ftp_gtk3 +7 -0
- data/bin/ftp_upload +42 -0
- data/bin/ftp_upload_binary +18 -0
- data/bin/iftp +7 -0
- data/bin/remote_remove +28 -0
- data/doc/README.gen +302 -0
- data/doc/todo/TODO_FOR_FTP_PARADISE_PROJECT.md +79 -0
- data/ftp_paradise.gemspec +122 -0
- data/lib/ftp_paradise.rb +5 -0
- data/lib/ftp_paradise/base/cliner.rb +23 -0
- data/lib/ftp_paradise/base/colours.rb +83 -0
- data/lib/ftp_paradise/base/prototype.rb +171 -0
- data/lib/ftp_paradise/base/reset.rb +29 -0
- data/lib/ftp_paradise/colours/colours.rb +141 -0
- data/lib/ftp_paradise/colours/use_colours.rb +76 -0
- data/lib/ftp_paradise/configuration/configuration.rb +49 -0
- data/lib/ftp_paradise/connection/README.md +1 -0
- data/lib/ftp_paradise/connection/connection.rb +35 -0
- data/lib/ftp_paradise/connection/constants.rb +46 -0
- data/lib/ftp_paradise/connection/data.rb +164 -0
- data/lib/ftp_paradise/connection/debug.rb +78 -0
- data/lib/ftp_paradise/connection/directory_handling.rb +271 -0
- data/lib/ftp_paradise/connection/do_login.rb +108 -0
- data/lib/ftp_paradise/connection/download.rb +86 -0
- data/lib/ftp_paradise/connection/file_handling.rb +174 -0
- data/lib/ftp_paradise/connection/ftp_object.rb +21 -0
- data/lib/ftp_paradise/connection/initialize.rb +88 -0
- data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +20 -0
- data/lib/ftp_paradise/connection/is_connected.rb +46 -0
- data/lib/ftp_paradise/connection/misc.rb +474 -0
- data/lib/ftp_paradise/connection/notify.rb +71 -0
- data/lib/ftp_paradise/connection/password.rb +47 -0
- data/lib/ftp_paradise/connection/port.rb +33 -0
- data/lib/ftp_paradise/connection/remote_pwd.rb +72 -0
- data/lib/ftp_paradise/connection/remote_url.rb +164 -0
- data/lib/ftp_paradise/connection/remove.rb +143 -0
- data/lib/ftp_paradise/connection/reset.rb +78 -0
- data/lib/ftp_paradise/connection/run.rb +18 -0
- data/lib/ftp_paradise/connection/set_array_available_hosts.rb +27 -0
- data/lib/ftp_paradise/connection/set_input.rb +18 -0
- data/lib/ftp_paradise/connection/show.rb +153 -0
- data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +24 -0
- data/lib/ftp_paradise/connection/transfer_mode.rb +163 -0
- data/lib/ftp_paradise/connection/upload.rb +253 -0
- data/lib/ftp_paradise/connection/use_default_dataset.rb +40 -0
- data/lib/ftp_paradise/connection/username.rb +42 -0
- data/lib/ftp_paradise/constants/constants.rb +19 -0
- data/lib/ftp_paradise/constants/misc.rb +57 -0
- data/lib/ftp_paradise/constants/namespace.rb +14 -0
- data/lib/ftp_paradise/constants/newline.rb +14 -0
- data/lib/ftp_paradise/constants/roebe.rb +31 -0
- data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +233 -0
- data/lib/ftp_paradise/entry/entry.rb +300 -0
- data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +34 -0
- data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +34 -0
- data/lib/ftp_paradise/gui/shared_code/ftp_paradise/ftp_paradise_module.rb +709 -0
- data/lib/ftp_paradise/images/connection_image.png +0 -0
- data/lib/ftp_paradise/interactive_ftp/constants.rb +103 -0
- data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +216 -0
- data/lib/ftp_paradise/interactive_ftp/help.rb +50 -0
- data/lib/ftp_paradise/interactive_ftp/initialize.rb +27 -0
- data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +998 -0
- data/lib/ftp_paradise/interactive_ftp/main_loop.rb +51 -0
- data/lib/ftp_paradise/interactive_ftp/menu.rb +786 -0
- data/lib/ftp_paradise/interactive_ftp/misc.rb +208 -0
- data/lib/ftp_paradise/interactive_ftp/mode.rb +124 -0
- data/lib/ftp_paradise/interactive_ftp/readline.rb +113 -0
- data/lib/ftp_paradise/interactive_ftp/remove.rb +97 -0
- data/lib/ftp_paradise/interactive_ftp/reset.rb +90 -0
- data/lib/ftp_paradise/interactive_ftp/run.rb +22 -0
- data/lib/ftp_paradise/interactive_ftp/show.rb +184 -0
- data/lib/ftp_paradise/interactive_ftp/upload.rb +90 -0
- data/lib/ftp_paradise/interactive_ftp/user_input.rb +53 -0
- data/lib/ftp_paradise/project/project.rb +64 -0
- data/lib/ftp_paradise/requires/common_basic_requires.rb +14 -0
- data/lib/ftp_paradise/requires/common_external_requires.rb +9 -0
- data/lib/ftp_paradise/requires/require_the_constants.rb +7 -0
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +18 -0
- data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +10 -0
- data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +28 -0
- data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +28 -0
- data/lib/ftp_paradise/toplevel_methods/connect.rb +50 -0
- data/lib/ftp_paradise/toplevel_methods/data.rb +31 -0
- data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +37 -0
- data/lib/ftp_paradise/toplevel_methods/directory_related_actions.rb +33 -0
- data/lib/ftp_paradise/toplevel_methods/e.rb +16 -0
- data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +49 -0
- data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +270 -0
- data/lib/ftp_paradise/toplevel_methods/is_on_roebe.rb +20 -0
- data/lib/ftp_paradise/toplevel_methods/login_name.rb +49 -0
- data/lib/ftp_paradise/toplevel_methods/misc.rb +16 -0
- data/lib/ftp_paradise/toplevel_methods/opn.rb +24 -0
- data/lib/ftp_paradise/toplevel_methods/password.rb +50 -0
- data/lib/ftp_paradise/toplevel_methods/port.rb +41 -0
- data/lib/ftp_paradise/toplevel_methods/rds.rb +18 -0
- data/lib/ftp_paradise/toplevel_methods/remote_url.rb +57 -0
- data/lib/ftp_paradise/toplevel_methods/time.rb +45 -0
- data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +108 -0
- data/lib/ftp_paradise/version/version.rb +19 -0
- data/lib/ftp_paradise/www/public/css/style.css +3 -0
- data/lib/ftp_paradise/www/sinatra_web_interface.rb +242 -0
- data/lib/ftp_paradise/www/views/index.slim +3 -0
- data/lib/ftp_paradise/www/views/layout.slim +11 -0
- data/lib/ftp_paradise/www/web_interface.cgi +34 -0
- data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +1 -0
- data/lib/ftp_paradise/yaml/debug.yml +1 -0
- data/lib/ftp_paradise/yaml/open_in_default_editor.yml +1 -0
- data/lib/ftp_paradise/yaml/show_full_names.yml +1 -0
- data/lib/ftp_paradise/yaml/use_colours.yml +1 -0
- data/test/testing_ftp_paradise.rb +94 -0
- data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +28 -0
- data/test/testing_the_ftp_connection_component.rb +70 -0
- data/test/testing_upload_a_local_directory.rb +10 -0
- metadata +336 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1b6d3a006fd092742114c88fab423c7710496d9053d7ebd8ad53dad0568d5a5e
|
4
|
+
data.tar.gz: 890921f06bf315fe27f64805a671c49cdd2cf13ecf760920ca0ff097b59d665c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 59976fc1a9ed5960b938ad184fbfb9adbc658a59848fbfd3572edc9aa47e7d15b75e52165ef9c38ebf4fe6f293fb61b7250974dd5b1beedb61d42aadca7f8da7
|
7
|
+
data.tar.gz: a286bde9aca62ec9b1f82e75a18f9a0f9882c32a708552b00236916aa804b45753d600ec453dfd93fb98005777d98e2829dc613b8103647560ca2d55a2d5718a
|
data/README.md
ADDED
@@ -0,0 +1,319 @@
|
|
1
|
+
[](https://www.gobolinux.org/)
|
2
|
+
[](https://www.ruby-lang.org/en/)
|
3
|
+
[](https://badge.fury.io/rb/ftp_paradise)
|
4
|
+
|
5
|
+
## FtpParadise - Introduction
|
6
|
+
|
7
|
+
This README file contains FTP-related information about the ruby
|
8
|
+
scripts that are part of the **FtpParadise project**.
|
9
|
+
|
10
|
+
Currently the most important part of the FTP Paradise project is
|
11
|
+
the Library around the Ruby-FTP base library, and an interactive
|
12
|
+
component that can check on the given user-input.
|
13
|
+
|
14
|
+
A simple **GUI** also exists to support the extended FTP
|
15
|
+
functionality, but this GUI is extremely limited - I recommend
|
16
|
+
to use the commandline variant instead. (The commandline variant
|
17
|
+
is also significantly faster, in my experience.)
|
18
|
+
|
19
|
+
Since as of **March 2014** a web-interface of some sorts is
|
20
|
+
available too, currently being offered as a sinatra-app and
|
21
|
+
a .cgi file. This is also limited, so again: prefer to use
|
22
|
+
the commandline variant whenever possible.
|
23
|
+
|
24
|
+
The interactive component can be used to connect to remote websites
|
25
|
+
by making use of the script called **iftp** at **bin/iftp**. This
|
26
|
+
file is distributed with the project.
|
27
|
+
|
28
|
+
The name **iftp** indicates towards "interactive_ftp", which
|
29
|
+
describes its functionality best - it allows you to interactively
|
30
|
+
enter commands, which will then be evaluated in the context of
|
31
|
+
FTP. (Evidently you have to first connect to the remote
|
32
|
+
website via your FTP login credentials, so make sure to do
|
33
|
+
that first before inputting commands.)
|
34
|
+
|
35
|
+
## Requiring the FtpParadise library:
|
36
|
+
|
37
|
+
Simply do the following in order to require this project:
|
38
|
+
|
39
|
+
require 'ftp_paradise'
|
40
|
+
|
41
|
+
Please do note that rather than the various .set_ methods, you
|
42
|
+
could also use traditional = methods instead.
|
43
|
+
|
44
|
+
So, for instance:
|
45
|
+
|
46
|
+
set_port()
|
47
|
+
|
48
|
+
is the very same as using a direct setter method such as:
|
49
|
+
|
50
|
+
port=
|
51
|
+
|
52
|
+
This is mostly for convenience. Use in your code whatever you
|
53
|
+
prefer. Most may prefer foo=, I like to read a leading set_
|
54
|
+
though, visually.
|
55
|
+
|
56
|
+
## The interactive component of the FTP Paradise:
|
57
|
+
|
58
|
+
The **interactive** component will properly tell the user whether
|
59
|
+
he/she is connected to a remote host or whether the user is not
|
60
|
+
connected, since as of the version **1.0.35**.
|
61
|
+
|
62
|
+
If you need to determine manually whether you are connected, do
|
63
|
+
input this command in the interactive shell:
|
64
|
+
|
65
|
+
connected?
|
66
|
+
|
67
|
+
## Autoconnecting (Added as of December 2017)
|
68
|
+
|
69
|
+
This presently works only on my home system, by checking whether
|
70
|
+
the environment variable IS_ROEBE was set. If it was set, and
|
71
|
+
if **an upload event** occurs before we have connected
|
72
|
+
somewhere, then we will first connect.
|
73
|
+
|
74
|
+
This functionality could be changed to include any way to
|
75
|
+
auto-connect, but for now, this has to suffice.
|
76
|
+
|
77
|
+
In September 2018, an additional option has been added. The
|
78
|
+
file **automatically_connect_on-statup_of_the_interactive_ftp_shell.yml**
|
79
|
+
has been created. If its content is set to true, and if we
|
80
|
+
are on **roebe**, and we start the interactive ftp-shell, then
|
81
|
+
we will automatically connect to the remote shevy-FTP site.
|
82
|
+
|
83
|
+
This obviously is only useful on my home system, but it could
|
84
|
+
in theory be expanded to include other FTP sites as well.
|
85
|
+
|
86
|
+
## Readline support
|
87
|
+
|
88
|
+
The interactive component of the FtpParadise project will try
|
89
|
+
to make use of the readline module, if it is available. Not
|
90
|
+
every ruby version installed may have support for Readline,
|
91
|
+
though, so this must be **optional**.
|
92
|
+
|
93
|
+
If you do not want to use readline or do not need it, you can
|
94
|
+
pass the flag --no-readline to disable this for the current
|
95
|
+
invocation.
|
96
|
+
|
97
|
+
iftp --no-readline
|
98
|
+
|
99
|
+
(Where **iftp** stands short for interactive ftp.)
|
100
|
+
|
101
|
+
## Using FTP Paradise it in a project:
|
102
|
+
|
103
|
+
First, you must require this gem, as stated above:
|
104
|
+
|
105
|
+
require 'ftp_paradise'
|
106
|
+
|
107
|
+
Then you can use Ruby code such as this one here:
|
108
|
+
|
109
|
+
_ = FtpParadise::Connection.new("science_news")
|
110
|
+
_.set_user 'the_name_of_your_user_here' # <-- this is optional
|
111
|
+
_.set_port '21' # <-- this is also optional
|
112
|
+
_.connect_to 'insert_the_ftp_host_here'
|
113
|
+
_.run # Start transation (as in, try to login).
|
114
|
+
|
115
|
+
Note that most of the above is completely optional and thus can be
|
116
|
+
omitted.
|
117
|
+
|
118
|
+
It simply allows you to fine tune when you need to set these entries.
|
119
|
+
|
120
|
+
Convenience methods exist of course, for instance:
|
121
|
+
|
122
|
+
FtpParadise.connect to: 'url here'
|
123
|
+
|
124
|
+
A much simpler alternative to the above is to provide a Hash with all
|
125
|
+
that required information instead.
|
126
|
+
|
127
|
+
If you don't want to connect the very moment a new Library class is
|
128
|
+
instantiated, then you can do the following:
|
129
|
+
|
130
|
+
_ = FtpParadise::Connection.new :dont_run
|
131
|
+
|
132
|
+
You can also directly upload a file, by using a class_method such
|
133
|
+
as this one here:
|
134
|
+
|
135
|
+
FtpParadise.upload(this, to)
|
136
|
+
|
137
|
+
Class methods (or rather, module methods in this case), will
|
138
|
+
be stored in the file module.rb.
|
139
|
+
|
140
|
+
A pure commandline-program also exists, called:
|
141
|
+
|
142
|
+
ftp_upload
|
143
|
+
|
144
|
+
Check it's --help option for its available options.
|
145
|
+
|
146
|
+
## Uploading content to a remote FTP server
|
147
|
+
|
148
|
+
Remember that you can do all of this via the **official ruby FTP
|
149
|
+
bindings** already - I only wanted to be able to do so interactively
|
150
|
+
as well.
|
151
|
+
|
152
|
+
Uploading from the interactive FTP paradise executable can be done
|
153
|
+
by giving numbers. The FTP paradise project will assume that any
|
154
|
+
numbers given, will refer to the index position of the current
|
155
|
+
working directory.
|
156
|
+
|
157
|
+
That is, index 7 would mean file position at 7 in the current
|
158
|
+
directory:
|
159
|
+
|
160
|
+
upload 7,8
|
161
|
+
|
162
|
+
The above instructions would try to **upload file number 7**
|
163
|
+
and **8** to the remote host. Of course you could use the file
|
164
|
+
name instead directly - the numbers are just there for
|
165
|
+
convenience. Less to type when in an interactive mode.
|
166
|
+
|
167
|
+
Also note that this refers only to files. Directories will be
|
168
|
+
ignored for this purpose. This behaviour may change in the
|
169
|
+
future, but then again it may not. (The default is mostly
|
170
|
+
what is the most convenient and most used behaviour; for me
|
171
|
+
it is a LOT more common to just quickly upload files to a
|
172
|
+
remote ftp server, so the number support above prefers
|
173
|
+
files too.)
|
174
|
+
|
175
|
+
To **upload files** do:
|
176
|
+
|
177
|
+
upload foo.txt
|
178
|
+
|
179
|
+
You can **upload** several files by using , as a delimiter:
|
180
|
+
|
181
|
+
upload 6,7
|
182
|
+
|
183
|
+
This would upload file 6 and file 7.
|
184
|
+
|
185
|
+
If you wish to batch-upload some .pdf files, you can try this:
|
186
|
+
|
187
|
+
upload *pdf
|
188
|
+
|
189
|
+
To simply batch-upload the content of the current working
|
190
|
+
directory, this should suffice:
|
191
|
+
|
192
|
+
upload *
|
193
|
+
|
194
|
+
|
195
|
+
## General use cases for the interactive FTP component - using the interactive component
|
196
|
+
|
197
|
+
The interactive FTP component allows you to do several **ftp-related
|
198
|
+
commands** via an interactive interface. I needed this functionality
|
199
|
+
so that I can connect to remote FTP servers and quickly do things
|
200
|
+
such as creating a directory, removing it, renaming files, uploading
|
201
|
+
and downloading content.
|
202
|
+
|
203
|
+
Once you are all set and finished working with the Interactive
|
204
|
+
Ftp component of the ftp_paradise project, you can type **q** or
|
205
|
+
**quit** to exit from it again - or simply hit Ctrl-D, which achieves
|
206
|
+
the same, more or less.
|
207
|
+
|
208
|
+
To start the interactive ftp component, you can issue a command
|
209
|
+
such as:
|
210
|
+
|
211
|
+
_ = FtpParadise::InteractiveFtp.new
|
212
|
+
|
213
|
+
This should start the interactive component of the **FtpParadise project**.
|
214
|
+
|
215
|
+
If you want a **simplified API** call, you can also use:
|
216
|
+
|
217
|
+
_ = FtpParadise.interactive
|
218
|
+
|
219
|
+
instead. This variant has the benefit of being more succinct.
|
220
|
+
|
221
|
+
Once inside the main loop there, the one that will continually
|
222
|
+
fetch user input, you can issue "help" to get help.
|
223
|
+
|
224
|
+
The same syntax that is used via <b>upload</b>ing content, can
|
225
|
+
also be used by **downloading**, such as via:
|
226
|
+
|
227
|
+
download 8
|
228
|
+
download 8,9
|
229
|
+
download 1,2,3
|
230
|
+
|
231
|
+
In short, we can use positional numbers to handle files and
|
232
|
+
directories. The number 3 means "whatever is at the third
|
233
|
+
position", be it a file or a directory.
|
234
|
+
|
235
|
+
You can also specifically download a binary file by issuing:
|
236
|
+
|
237
|
+
download_remote_file test.bin
|
238
|
+
|
239
|
+
You can show the full path to a file, both remote or local,
|
240
|
+
if you wish to.
|
241
|
+
|
242
|
+
For this do either of:
|
243
|
+
|
244
|
+
toggle show
|
245
|
+
show_names
|
246
|
+
|
247
|
+
If you wish to remove all remote entries from a remote directory,
|
248
|
+
do issue this command:
|
249
|
+
|
250
|
+
remote_remove *
|
251
|
+
|
252
|
+
You can also upload from the commandline, by using the script
|
253
|
+
**ftp_upload**:
|
254
|
+
|
255
|
+
ftp_upload file_that_should_exist_comes_here.txt
|
256
|
+
ftp_upload *
|
257
|
+
|
258
|
+
The latter command would simply upload all the found files in
|
259
|
+
the current directory.
|
260
|
+
|
261
|
+
You can also do the above in **binary mode**:
|
262
|
+
|
263
|
+
ftp_upload file --binary
|
264
|
+
|
265
|
+
## Editor
|
266
|
+
|
267
|
+
You can query which editor is in use, in the interactive FTP
|
268
|
+
component of the **FtpParadise project**, by issuing this
|
269
|
+
command:
|
270
|
+
|
271
|
+
editor?
|
272
|
+
|
273
|
+
You can also assign another editor in use, via:
|
274
|
+
|
275
|
+
set_editor vim # Use "vim" as the editor.
|
276
|
+
|
277
|
+
This value is used when you wish to quickly **modify a file**
|
278
|
+
from within the **interactive_ftp component**. The latter
|
279
|
+
is triggered via:
|
280
|
+
|
281
|
+
edit NAME_OF_THE_FILE_HERE
|
282
|
+
edit foobar.md # <- an example
|
283
|
+
|
284
|
+
## Remote Hosts
|
285
|
+
|
286
|
+
If you need to determine the remote host, you can use this
|
287
|
+
toplevel method:
|
288
|
+
|
289
|
+
FtpParadise.remote_host?
|
290
|
+
|
291
|
+
This will return nil if no connection has been made as of
|
292
|
+
yet.
|
293
|
+
|
294
|
+
## The graphical user interface (ruby-gtk3)
|
295
|
+
|
296
|
+
There exists a small ruby-gtk3 client for the ftp_paradise
|
297
|
+
gem. Unfortunately it is not complete and has a few bugs;
|
298
|
+
if anyone wants to fix that ... :)
|
299
|
+
|
300
|
+
For selecting a local file, you currently have to
|
301
|
+
double-click. At some later point I will extend this
|
302
|
+
to one-click only.
|
303
|
+
|
304
|
+
|
305
|
+
## Contact information
|
306
|
+
|
307
|
+
If your creative mind has ideas and specific suggestions to make this
|
308
|
+
gem more useful in general, feel free to drop me an email at any
|
309
|
+
time, via:
|
310
|
+
|
311
|
+
shevegen@gmail.com
|
312
|
+
|
313
|
+
(Do keep in mind that responding to emails may take some time, depending
|
314
|
+
on the amount of work I may have at that moment, due to reallife. I will,
|
315
|
+
however had, read feedback. Patches and code changes are welcome too
|
316
|
+
of course, as long as they are in the spirit of the project at
|
317
|
+
hand, e. g. fitting to the general theme.)
|
318
|
+
|
319
|
+
Thank you.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'ftp_paradise/toplevel_methods/ftp_object.rb'
|
6
|
+
|
7
|
+
ARGV.each {|entry|
|
8
|
+
FtpParadise.remote_create_directory(entry)
|
9
|
+
}
|
data/bin/ftp_get
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'ftp_paradise'
|
6
|
+
|
7
|
+
_ = FtpParadise::Connection.new(:dont_run_yet) { :use_default_dataset }
|
8
|
+
_.be_verbose
|
9
|
+
_.do_login
|
10
|
+
_.do_use_colours
|
11
|
+
_.remote_cd 'www'
|
12
|
+
|
13
|
+
ARGV.each {|obtain_this_file|
|
14
|
+
_.download(
|
15
|
+
obtain_this_file
|
16
|
+
)
|
17
|
+
}
|
data/bin/ftp_gtk3
ADDED
data/bin/ftp_upload
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# Usage example for a binary upload:
|
6
|
+
#
|
7
|
+
# ftp_upload file --binary
|
8
|
+
#
|
9
|
+
# =========================================================================== #
|
10
|
+
require 'ftp_paradise'
|
11
|
+
|
12
|
+
if ARGV.empty?
|
13
|
+
puts 'Please supply at least one argument.'
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
_ = FtpParadise::Connection.new(:dont_run_yet)
|
18
|
+
_.be_verbose
|
19
|
+
|
20
|
+
# =========================================================================== #
|
21
|
+
# Next, check commandline arguments given:
|
22
|
+
# =========================================================================== #
|
23
|
+
ARGV.each {|entry|
|
24
|
+
case entry.to_s.delete('-')
|
25
|
+
when '--start-gui',
|
26
|
+
'--gui',
|
27
|
+
'gui',
|
28
|
+
'startgui' # fupload --gui
|
29
|
+
FtpParadise.do_start_gui
|
30
|
+
exit
|
31
|
+
when /-?-?help/
|
32
|
+
e ' --binary # use binary method'
|
33
|
+
exit
|
34
|
+
when 'binary','BINARY','BIN','bin','--binary'
|
35
|
+
_.set_mode :binary, :be_verbose
|
36
|
+
end
|
37
|
+
}
|
38
|
+
_.set_data('SHEVY')
|
39
|
+
_.do_login('SHEVY')
|
40
|
+
ARGV.each {|file|
|
41
|
+
_.upload(file, :be_silent) if File.exist? file
|
42
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This code can be used to upload a binary file.
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'ftp_paradise/toplevel_methods/upload_this_binary_file.rb'
|
8
|
+
|
9
|
+
if ARGV.empty?
|
10
|
+
puts 'Please supply at least one argument to this file.'
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
ARGV.each {|file|
|
15
|
+
if File.exist? file
|
16
|
+
FtpParadise.upload_this_binary_file(file, :be_silent)
|
17
|
+
end
|
18
|
+
}
|
data/bin/iftp
ADDED
data/bin/remote_remove
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This code can be used to remove a remote file from a FTP site.
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'ftp_paradise'
|
8
|
+
|
9
|
+
if ARGV.empty?
|
10
|
+
puts 'Please supply at the least one argument.'
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
_ = ::FtpParadise::Connection.new(:dont_run_yet)
|
15
|
+
# =========================================================================== #
|
16
|
+
# This is presently hardcoded to my system.
|
17
|
+
# =========================================================================== #
|
18
|
+
_.set_data('SHEVY')
|
19
|
+
_.do_login('SHEVY')
|
20
|
+
|
21
|
+
ARGV.each {|file|
|
22
|
+
if file.include? '/' # Handle / given, meaning that we first cd into the base dir there.
|
23
|
+
dirname = File.dirname(file)
|
24
|
+
_.cd_into_this_remote_directory(dirname)
|
25
|
+
file = File.basename(file)
|
26
|
+
end
|
27
|
+
_.delete(file, :be_verbose) # Be verbose rather than silent.
|
28
|
+
}
|