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,78 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/reset.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ require 'ftp_paradise/connection/port.rb'
12
+ require 'ftp_paradise/connection/set_array_available_hosts.rb'
13
+ require 'ftp_paradise/connection/transfer_mode.rb'
14
+ require 'ftp_paradise/connection/username.rb'
15
+
16
+ # ========================================================================= #
17
+ # === reset
18
+ # ========================================================================= #
19
+ def reset
20
+ super()
21
+ # ======================================================================= #
22
+ # === @input
23
+ # ======================================================================= #
24
+ @input = nil
25
+ # ======================================================================= #
26
+ # === @ftp_object
27
+ # ======================================================================= #
28
+ @ftp_object = nil
29
+ populate_internal_hash_with_default_values
30
+ # ======================================================================= #
31
+ # The next method-call must come after
32
+ # populate_internal_hash_with_default_values().
33
+ # ======================================================================= #
34
+ set_be_verbose if BE_VERBOSE
35
+ set_port
36
+ set_array_available_hosts
37
+ set_default_transfer_mode :be_quiet
38
+ set_username
39
+ end
40
+
41
+ # ========================================================================= #
42
+ # === populate_internal_hash_with_default_values
43
+ # ========================================================================= #
44
+ def populate_internal_hash_with_default_values
45
+ # ======================================================================= #
46
+ # === @internal_hash
47
+ # ======================================================================= #
48
+ @internal_hash = {}
49
+ # ======================================================================= #
50
+ # === :port
51
+ #
52
+ # The internal Hash keeps track of some configure-settings and slots
53
+ # to be used that are of relevance to this class.
54
+ # ======================================================================= #
55
+ @internal_hash[:port] = nil # Has to be nil initially.
56
+ @internal_hash[:be_verbose] = nil
57
+ @internal_hash[:raw_entries] = nil
58
+ @internal_hash[:file] = nil
59
+ @internal_hash[:transfer_mode] = :binary
60
+ @internal_hash[:show_full_names] = false # Is false on startup.
61
+ @internal_hash[:debug] = false
62
+ # ======================================================================= #
63
+ # === :array_available_hosts
64
+ # ======================================================================= #
65
+ @internal_hash[:array_available_hosts] = []
66
+ # ======================================================================= #
67
+ # === :padding
68
+ # ======================================================================= #
69
+ @internal_hash[:padding] = ' ' # This padding value is used for remote directory listing.
70
+ # ======================================================================= #
71
+ # The following Array keeps track over the files that were uploaded
72
+ # successfully. This gives us the possibility to query this from other
73
+ # classes.
74
+ # ======================================================================= #
75
+ @internal_hash[:uploaded_these_files] = []
76
+ end
77
+
78
+ end; end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/run.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ # ========================================================================= #
12
+ # === run (run tag)
13
+ # ========================================================================= #
14
+ def run
15
+ do_connect
16
+ end
17
+
18
+ end; end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/set_array_available_hosts.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ # ========================================================================= #
12
+ # === set_array_available_hosts
13
+ #
14
+ # Use this method if you wish to define the available hosts. This is
15
+ # useful whenever you already have some pre-defined hosts that you wish
16
+ # to use.
17
+ # ========================================================================= #
18
+ def set_array_available_hosts(i = nil)
19
+ if Object.const_defined? :RoebeFtpConstants
20
+ i = ARRAY_AVAILABLE_HOSTS
21
+ else
22
+ i = []
23
+ end
24
+ @internal_hash[:array_available_hosts] = i
25
+ end
26
+
27
+ end; end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/set_input.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ # ========================================================================= #
12
+ # === set_input
13
+ # ========================================================================= #
14
+ def set_input(i)
15
+ @input = i
16
+ end
17
+
18
+ end; end
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/show.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ # ========================================================================= #
12
+ # === show_remote_directory_listing
13
+ #
14
+ # This will simply show the content of a remote directory.
15
+ #
16
+ # Invocation examples:
17
+ #
18
+ # show_remote_directory_listing
19
+ # show_remote_directory_listing :default, :show_only_directories
20
+ #
21
+ # ========================================================================= #
22
+ def show_remote_directory_listing(
23
+ i = list,
24
+ array_options = []
25
+ )
26
+ unless array_options.is_a? Array
27
+ array_options = [array_options]
28
+ end
29
+ case i
30
+ when :default
31
+ i = list
32
+ end
33
+ if i.is_a? Array
34
+ # ===================================================================== #
35
+ # Get rid of '.' and '..'.
36
+ # ===================================================================== #
37
+ i.reject! {|entry| entry.end_with?('..') or entry.end_with?('.') }
38
+ # ===================================================================== #
39
+ # First, turn them into entries.
40
+ # ===================================================================== #
41
+ i.map! {|entry| FtpParadise::Entry.new(entry) }
42
+ # ===================================================================== #
43
+ # Next, we can use different behaviours.
44
+ # ===================================================================== #
45
+ if array_options.include? :show_only_directories
46
+ i.select! {|entry| entry.is_a_directory? }
47
+ end
48
+ i.each {|entry| entry.show_the_line }
49
+ end
50
+ end; alias show_remote_files show_remote_directory_listing # === show_remote_files
51
+
52
+ # ========================================================================= #
53
+ # === show_full_names?
54
+ # ========================================================================= #
55
+ def show_full_names?
56
+ @internal_hash[:show_full_names]
57
+ end
58
+
59
+ # ========================================================================= #
60
+ # === show_remote_listing
61
+ #
62
+ # Use this method whenever you want to show the remote entries.
63
+ #
64
+ # As of June 2016, you can pass in your own dataset into this method
65
+ # as well. It must conform to the Array with the four entries, which
66
+ # is also returned via the method sanitized_remote_directory_content?.
67
+ # ========================================================================= #
68
+ def show_remote_listing(
69
+ dataset = sanitized_remote_directory_content?,
70
+ be_verbose = be_verbose?
71
+ )
72
+ n_rjust = 10
73
+ _ = dataset
74
+ if show_full_names?
75
+ _.map! {|entry|
76
+ filename = entry[0]
77
+ entry[0] = remote_pwd?+filename # This is the file size.
78
+ entry
79
+ }
80
+ end
81
+ _.each_with_index { |array, index|
82
+ if be_verbose # Display only when in verbose mode, which is the default.
83
+ file_or_directory = array[1]
84
+ name_of_the_file = array.first
85
+ # =================================================================== #
86
+ # Get a pointer to the filesize as well.
87
+ # =================================================================== #
88
+ filesize = array[2].to_s.rjust(n_rjust)
89
+ if file_or_directory == 'directory'
90
+ name_of_the_file << '/' unless name_of_the_file.end_with? '/'
91
+ end
92
+ # =================================================================== #
93
+ # === Put a proper padding to the index
94
+ # =================================================================== #
95
+ new_index = (index+1).to_s.rjust(_.size.to_s.size)
96
+ n_pad = 125
97
+ case file_or_directory
98
+ when 'directory' # Display for directories.
99
+ name_of_the_file = sdir(name_of_the_file)
100
+ e (padding?+sdir(new_index+') ')+name_of_the_file).ljust(n_pad)+' '+
101
+ filesize
102
+ else
103
+ e (padding?+sfancy(new_index+') ')+sfancy(name_of_the_file)).ljust(n_pad)+' '+
104
+ filesize
105
+ end
106
+ end
107
+ }
108
+ end; alias show_file_listing show_remote_listing # === show_file_listing
109
+ alias show_remote_file_listing show_remote_listing # === show_remote_file_listing
110
+
111
+ # ========================================================================= #
112
+ # === show_remote_directories
113
+ # ========================================================================= #
114
+ def show_remote_directories
115
+ show_remote_directory_listing :default, :show_only_directories
116
+ end
117
+
118
+ # ========================================================================= #
119
+ # === show_full_names=
120
+ # ========================================================================= #
121
+ def show_full_names=(i = true)
122
+ @internal_hash[:show_full_names] = i
123
+ end; alias show_full_names show_full_names= # === show_full_names
124
+
125
+ # ========================================================================= #
126
+ # === show_user_and_password
127
+ # ========================================================================= #
128
+ def show_user_and_password
129
+ ljust = 12
130
+ e
131
+ e ('User-Name: ').ljust(ljust)+sfancy(user_name?.to_s)
132
+ e ('Password: ' ).ljust(ljust)+sfancy(password?)
133
+ e
134
+ end; alias show_user_name_and_password show_user_and_password # === show_user_name_and_password
135
+
136
+ # ========================================================================= #
137
+ # === show_host_user_name_port_and_password
138
+ #
139
+ # Inform us about the basic settings.
140
+ # ========================================================================= #
141
+ def show_host_user_name_port_and_password(
142
+ do_use_spacer_around_the_output = true
143
+ )
144
+ ljust = 15
145
+ e if do_use_spacer_around_the_output
146
+ e ('Host: ' ).ljust(ljust)+sfancy(host?)
147
+ e ('User-Name: ').ljust(ljust)+sfancy(user_name?.to_s)
148
+ e ('Port: ' ).ljust(ljust)+sfancy(port?)
149
+ e ('Password: ' ).ljust(ljust)+sfancy(password?)
150
+ e if do_use_spacer_around_the_output
151
+ end
152
+
153
+ end; end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ require 'ftp_paradise/connection/ftp_object.rb'
12
+ require 'ftp_paradise/toplevel_methods/ftp_object.rb'
13
+
14
+ # ========================================================================= #
15
+ # === sync_ftp_object_onto_the_main_namespace
16
+ #
17
+ # Invoke this method only after having made sure that ftp_object?
18
+ # returns a non-nil object.
19
+ # ========================================================================= #
20
+ def sync_ftp_object_onto_the_main_namespace
21
+ ::FtpParadise.ftp_object = self
22
+ end
23
+
24
+ end; end
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'ftp_paradise/connection/transfer_mode.rb'
6
+ # =========================================================================== #
7
+ module FtpParadise
8
+
9
+ class Connection
10
+
11
+ # ========================================================================= #
12
+ # === set_passive_mode
13
+ #
14
+ # Use this when modifying the passive setting.
15
+ # ========================================================================= #
16
+ def set_passive_mode
17
+ set_transfer_mode :ascii
18
+ ftp_object?.passive = true if ftp_object?
19
+ end; alias set_passive set_passive_mode # === set_passive
20
+
21
+ # ========================================================================= #
22
+ # === set_default_transfer_mode
23
+ # ========================================================================= #
24
+ def set_default_transfer_mode(
25
+ be_verbose = :be_quiet
26
+ )
27
+ set_transfer_mode(DEFAULT_TRANSFER_MODE, be_verbose)
28
+ end
29
+
30
+ # ========================================================================= #
31
+ # === set_transfer_mode
32
+ #
33
+ # This method will set to either one of two different possibles modes:
34
+ #
35
+ # (1) :ascii
36
+ # (2) :binary
37
+ # (3) :passive
38
+ #
39
+ # Note that :passive "mode" is ascii, with an additional invocation to
40
+ # change the transfer mode to .passive.
41
+ #
42
+ # It will also change passive mode. The argument :default will default
43
+ # to the more commonly used ASCII mode.
44
+ #
45
+ # When would you want to use ASCII mode?
46
+ #
47
+ # Use ascii mode for:
48
+ #
49
+ # txt, rtf, html, php
50
+ #
51
+ # Use binary mode for:
52
+ #
53
+ # images, videos and similar.
54
+ #
55
+ # ========================================================================= #
56
+ def set_transfer_mode(
57
+ i = DEFAULT_TRANSFER_MODE, # Will usually default to :ascii
58
+ be_verbose = be_verbose?
59
+ )
60
+ case be_verbose
61
+ when :be_verbose
62
+ be_verbose = true
63
+ when :be_quiet
64
+ be_verbose = false
65
+ end
66
+ i = :ascii if i == :default
67
+ case i
68
+ # ======================================================================= #
69
+ # === :ascii
70
+ # ======================================================================= #
71
+ when :ascii
72
+ notify_the_user_about(i, __method__) if be_verbose
73
+ @internal_hash[:transfer_mode] = :ascii
74
+ ftp_object?.binary = false if ftp_object?
75
+ # ======================================================================= #
76
+ # === :binary
77
+ # ======================================================================= #
78
+ when :binary
79
+ notify_the_user_about(i, __method__) if be_verbose
80
+ @internal_hash[:transfer_mode] = :binary
81
+ # ======================================================================= #
82
+ # === :passive
83
+ # ======================================================================= #
84
+ when :passive,
85
+ :pass
86
+ notify_the_user_about(i, __method__) if be_verbose
87
+ @internal_hash[:transfer_mode] = :ascii
88
+ ftp_object?.passive = true if ftp_object?
89
+ else
90
+ opnn; e swarn('Not found the following mode: ')+
91
+ sfancy(i.to_s)
92
+ end
93
+ end; alias mode_to_use= set_transfer_mode # === mode_to_use=
94
+ alias set_mode set_transfer_mode # === set_mode
95
+
96
+ # ========================================================================= #
97
+ # === report_transfer_mode_in_use
98
+ # ========================================================================= #
99
+ def report_transfer_mode_in_use
100
+ e "Transfer mode: #{sfancy(transfer_mode?.to_s)}"
101
+ end
102
+
103
+ # ========================================================================= #
104
+ # === set_active
105
+ # ========================================================================= #
106
+ def set_active
107
+ ftp_object?.passive = false
108
+ end
109
+
110
+ # ========================================================================= #
111
+ # === passive_transfer?
112
+ # ========================================================================= #
113
+ def passive_transfer?
114
+ ftp_object?.passive
115
+ end; alias passive? passive_transfer? # === passive?
116
+
117
+ # ========================================================================= #
118
+ # === transfer_mode?
119
+ #
120
+ # This method will return the currently used transfer_mode. This mode
121
+ # can be either :binary, or :ascii. By default it will be :binary.
122
+ #
123
+ # The transfer mode can be :binary or :text. :ascii is an alias to
124
+ # :text.
125
+ # ========================================================================= #
126
+ def transfer_mode?
127
+ @internal_hash[:transfer_mode]
128
+ end; alias transfer_mode transfer_mode? # === transfer_mode
129
+ alias mode? transfer_mode? # === mode?
130
+ alias type transfer_mode? # === type
131
+ alias type? transfer_mode? # === type?
132
+
133
+ # ========================================================================= #
134
+ # === set_ascii
135
+ #
136
+ # Easier wrapper method.
137
+ # ========================================================================= #
138
+ def set_ascii
139
+ set_transfer_mode :ascii
140
+ end; alias set_ascii_mode set_ascii # === set_ascii_mode
141
+
142
+ # ========================================================================= #
143
+ # === binary?
144
+ #
145
+ # When this is true, then then all FTP-transfers will be performed in
146
+ # binary mode.
147
+ #
148
+ # Deaults to true.
149
+ # ========================================================================= #
150
+ def binary?
151
+ ftp_object?.binary
152
+ end; alias binary binary? # === binary
153
+
154
+ # ========================================================================= #
155
+ # === set_binary_mode
156
+ # ========================================================================= #
157
+ def set_binary_mode
158
+ set_transfer_mode :binary
159
+ ftp_object?.binary = true
160
+ end; alias set_binary set_binary_mode # === set_binary
161
+ alias set_to_binary_mode set_binary_mode # === set_to_binary_mode
162
+
163
+ end; end