directory_paradise 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +213 -0
  3. data/bin/show_directory_content +7 -0
  4. data/directory_paradise.gemspec +45 -0
  5. data/doc/README.gen +185 -0
  6. data/doc/todo/todo.md +4 -0
  7. data/lib/directory_paradise/base/base.rb +195 -0
  8. data/lib/directory_paradise/base/colours.rb +196 -0
  9. data/lib/directory_paradise/constants/newline.rb +14 -0
  10. data/lib/directory_paradise/content/constants.rb +23 -0
  11. data/lib/directory_paradise/content/content.rb +682 -0
  12. data/lib/directory_paradise/project/project.rb +22 -0
  13. data/lib/directory_paradise/report/constants.rb +39 -0
  14. data/lib/directory_paradise/report/initialize.rb +75 -0
  15. data/lib/directory_paradise/report/menu.rb +329 -0
  16. data/lib/directory_paradise/report/misc.rb +675 -0
  17. data/lib/directory_paradise/report/obtain.rb +357 -0
  18. data/lib/directory_paradise/report/report.rb +527 -0
  19. data/lib/directory_paradise/report/reset.rb +174 -0
  20. data/lib/directory_paradise/requires/require_class_content.rb +7 -0
  21. data/lib/directory_paradise/requires/require_class_report.rb +7 -0
  22. data/lib/directory_paradise/requires/require_the_directory_paradise_project.rb +10 -0
  23. data/lib/directory_paradise/sdc.rb +24 -0
  24. data/lib/directory_paradise/to_human_readable/to_human_readable.rb +98 -0
  25. data/lib/directory_paradise/version/version.rb +19 -0
  26. data/lib/directory_paradise/yaml/colours_for_bytes_values.yml +14 -0
  27. data/lib/directory_paradise.rb +1 -0
  28. data/test/testing_class_content.rb +16 -0
  29. data/test/testing_class_report.rb +40 -0
  30. data/test/testing_toplevel_methods.rb +14 -0
  31. metadata +110 -0
@@ -0,0 +1,357 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'directory_paradise/report/obtain.rb'
6
+ # =========================================================================== #
7
+ require 'directory_paradise/base/base.rb'
8
+
9
+ module DirectoryParadise
10
+
11
+ class Report < Base # === DirectoryParadise::Report
12
+
13
+ # ========================================================================= #
14
+ # === n_directories?
15
+ #
16
+ # This will exclude directories with a trailing '.'
17
+ # ========================================================================= #
18
+ def n_directories?
19
+ directories = directories?.reject {|entry| entry.end_with? '/.' }
20
+ return directories.size
21
+ end
22
+
23
+ # ========================================================================= #
24
+ # === hash_colours_for_bytes_value?
25
+ # ========================================================================= #
26
+ def hash_colours_for_bytes_value?
27
+ @internal_hash[:hash_colours_for_bytes_value]
28
+ end
29
+
30
+ # ========================================================================= #
31
+ # === report_filesize?
32
+ # ========================================================================= #
33
+ def report_filesize?
34
+ @internal_hash[:report_filesize]
35
+ end; alias report_the_total_filesize? report_filesize? # === report_the_total_filesize?
36
+
37
+ # ========================================================================= #
38
+ # === total_filesize?
39
+ # ========================================================================= #
40
+ def total_filesize?
41
+ @internal_hash[:total_filesize]
42
+ end; alias total_file_size? total_filesize? # === total_file_size?
43
+
44
+ # ========================================================================= #
45
+ # === work_on_which_directory?
46
+ # ========================================================================= #
47
+ def work_on_which_directory?
48
+ @internal_hash[:work_on_this_directory]
49
+ end; alias from_which_directory? work_on_which_directory? # === from_which_directory?
50
+ alias base_directory? work_on_which_directory? # === base_directory?
51
+ alias input? work_on_which_directory? # === input?
52
+ alias which_directory? work_on_which_directory? # === which_directory?
53
+ alias which_dir? work_on_which_directory? # === which_dir?
54
+ alias base_dir? work_on_which_directory? # === base_dir?
55
+ alias dir? work_on_which_directory? # === dir?
56
+
57
+ # ========================================================================= #
58
+ # === symlinks?
59
+ # ========================================================================= #
60
+ def symlinks?
61
+ @internal_hash[:directory_content].symlinks?
62
+ end
63
+
64
+ # ========================================================================= #
65
+ # === n_symlinks?
66
+ # ========================================================================= #
67
+ def n_symlinks?
68
+ symlinks?.size
69
+ end
70
+
71
+ # ========================================================================= #
72
+ # === directories?
73
+ # ========================================================================= #
74
+ def directories? # Feedback all available directories here.
75
+ @internal_hash[:directory_content].directories?
76
+ end
77
+
78
+ # ========================================================================= #
79
+ # === files?
80
+ #
81
+ # Query for all available files, by delegating towards class
82
+ # DirectoryContent.
83
+ # ========================================================================= #
84
+ def files?
85
+ @internal_hash[:directory_content].files?
86
+ end
87
+
88
+ # ========================================================================= #
89
+ # === n_files?
90
+ # ========================================================================= #
91
+ def n_files?
92
+ files?.size
93
+ end
94
+
95
+ # ========================================================================= #
96
+ # === show_statistics?
97
+ # ========================================================================= #
98
+ def show_statistics?
99
+ @internal_hash[:show_statistics]
100
+ end
101
+
102
+ # ========================================================================= #
103
+ # === return_directory_content
104
+ # ========================================================================= #
105
+ def return_directory_content(
106
+ i = @internal_hash[:work_on_this_directory]
107
+ )
108
+ obtain_from_directory_content(i)
109
+ consider_sorting
110
+ _ = @internal_hash[:directory_content].entries?
111
+ return _
112
+ end; alias gather_content return_directory_content # === gather_content
113
+ alias gather return_directory_content # === gather
114
+ alias run_main_loop return_directory_content # === run_main_loop
115
+ alias obtain_directory_listing return_directory_content # === obtain_directory_listing
116
+ alias obtain_entries return_directory_content # === obtain_entries
117
+
118
+ # ========================================================================= #
119
+ # === display_content?
120
+ # ========================================================================= #
121
+ def display_content?
122
+ @internal_hash[:display_content]
123
+ end
124
+
125
+ # ========================================================================= #
126
+ # === directory_content?
127
+ # ========================================================================= #
128
+ def directory_content?
129
+ @internal_hash[:directory_content]
130
+ end
131
+
132
+ # ========================================================================= #
133
+ # === obtain_from_directory_content
134
+ # ========================================================================= #
135
+ def obtain_from_directory_content(i)
136
+ @internal_hash[:directory_content].obtain_from(i)
137
+ end
138
+
139
+ # ========================================================================= #
140
+ # === show_permissionsbits?
141
+ # ========================================================================= #
142
+ def show_permission_bits?
143
+ @internal_hash[:show_permission_bits]
144
+ end; alias show_permissions? show_permission_bits? # === show_permissions?
145
+
146
+ # ========================================================================= #
147
+ # === display_only_directories?
148
+ # ========================================================================= #
149
+ def display_only_directories?
150
+ @internal_hash[:display_only_directories]
151
+ end
152
+
153
+ # ========================================================================= #
154
+ # === show_hidden_files?
155
+ # ========================================================================= #
156
+ def show_hidden_files?
157
+ @internal_hash[:show_hidden_files]
158
+ end
159
+
160
+ # ========================================================================= #
161
+ # === show_index?
162
+ # ========================================================================= #
163
+ def show_index?
164
+ @internal_hash[:show_index]
165
+ end; alias use_index? show_index? # === use_index?
166
+
167
+ # ========================================================================= #
168
+ # === entries?
169
+ # ========================================================================= #
170
+ def entries?
171
+ @internal_hash[:directory_content].entries
172
+ end; alias _ entries? # === _
173
+
174
+ # ========================================================================= #
175
+ # === sort_by?
176
+ # ========================================================================= #
177
+ def sort_by?
178
+ @internal_hash[:sort_by]
179
+ end
180
+
181
+ # ========================================================================= #
182
+ # === show_dots_only_entries?
183
+ # ========================================================================= #
184
+ def show_dots_only_entries?
185
+ @internal_hash[:show_dots_only_entries]
186
+ end
187
+
188
+ # ========================================================================= #
189
+ # === show_only_symlinks?
190
+ # ========================================================================= #
191
+ def show_only_symlinks?
192
+ @internal_hash[:show_only_symlinks]
193
+ end
194
+
195
+ # ========================================================================= #
196
+ # === ignore_backups?
197
+ # ========================================================================= #
198
+ def ignore_backups?
199
+ @internal_hash[:ignore_backups]
200
+ end
201
+
202
+ # ========================================================================= #
203
+ # === collapse?
204
+ #
205
+ # The revers of whether we will show the full path or not.
206
+ # ========================================================================= #
207
+ def collapse?
208
+ !show_full_path?
209
+ end
210
+
211
+ # ========================================================================= #
212
+ # === content?
213
+ # ========================================================================= #
214
+ def content?
215
+ @internal_hash[:directory_content].content?
216
+ end; alias content content? # === content?
217
+
218
+ # ========================================================================= #
219
+ # === show_inode?
220
+ # ========================================================================= #
221
+ def show_inode?
222
+ @internal_hash[:show_inode]
223
+ end
224
+
225
+ # ========================================================================= #
226
+ # === show_full_path?
227
+ # ========================================================================= #
228
+ def show_full_path?
229
+ @internal_hash[:show_full_path]
230
+ end; alias show_full_path show_full_path? # === show_full_path
231
+
232
+ # ========================================================================= #
233
+ # === show_group_information?
234
+ # ========================================================================= #
235
+ def show_group_information?
236
+ @internal_hash[:show_group_information]
237
+ end
238
+
239
+ # ========================================================================= #
240
+ # === show_size?
241
+ # ========================================================================= #
242
+ def show_size?
243
+ @internal_hash[:show_size]
244
+ end
245
+
246
+ # ========================================================================= #
247
+ # === colourize_path?
248
+ # ========================================================================= #
249
+ def colourize_path?
250
+ @internal_hash[:colourize_path]
251
+ end
252
+
253
+ # ========================================================================= #
254
+ # === show_permission_bits?
255
+ # ========================================================================= #
256
+ def show_permission_bits?
257
+ @internal_hash[:show_permission_bits]
258
+ end
259
+
260
+ # ========================================================================= #
261
+ # === show_header?
262
+ #
263
+ # Whether we will show the header or whether we will not. That header
264
+ # is not typical for the normal GNU "ls" command, hence why we need
265
+ # to have such an option.
266
+ # ========================================================================= #
267
+ def show_header?
268
+ @internal_hash[:show_header]
269
+ end
270
+
271
+ # ========================================================================= #
272
+ # === colourize_kb_and_mb?
273
+ # ========================================================================= #
274
+ def colourize_kb_and_mb?
275
+ @internal_hash[:colourize_kb_and_mb]
276
+ end
277
+
278
+ # ========================================================================= #
279
+ # === stop_on_missing_symlink?
280
+ # ========================================================================= #
281
+ def stop_on_missing_symlink?
282
+ @internal_hash[:stop_on_missing_symlink]
283
+ end
284
+
285
+ # ========================================================================= #
286
+ # === result?
287
+ #
288
+ # This will show the string that can be displayed.
289
+ # ========================================================================= #
290
+ def result?
291
+ @internal_hash[:result]
292
+ end
293
+
294
+ # ========================================================================= #
295
+ # === show_condensed_permissions?
296
+ # ========================================================================= #
297
+ def show_condensed_permissions?
298
+ @internal_hash[:show_condensed_permissions]
299
+ end; alias condensed? show_condensed_permissions? # === condensed?
300
+
301
+ # ========================================================================= #
302
+ # === owner?
303
+ # ========================================================================= #
304
+ def owner?(i)
305
+ @internal_hash[:directory_content].owner?(i)
306
+ end
307
+
308
+ # ========================================================================= #
309
+ # === truncate_long_file_names?
310
+ # ========================================================================= #
311
+ def truncate_long_file_names?
312
+ @internal_hash[:truncate_long_file_names]
313
+ end
314
+
315
+ # ========================================================================= #
316
+ # === show_simplified?
317
+ # ========================================================================= #
318
+ def show_simplified?
319
+ @internal_hash[:show_simplified]
320
+ end
321
+
322
+ # ========================================================================= #
323
+ # === show_modification_time?
324
+ # ========================================================================= #
325
+ def show_modification_time?
326
+ @internal_hash[:show_modification_time]
327
+ end
328
+
329
+ # ========================================================================= #
330
+ # === show_leading_slash?
331
+ # ========================================================================= #
332
+ def show_leading_slash?
333
+ @internal_hash[:show_leading_slash]
334
+ end
335
+
336
+ # ========================================================================= #
337
+ # === colour_for_files?
338
+ # ========================================================================= #
339
+ def colour_for_files?
340
+ @internal_hash[:colour_for_files]
341
+ end
342
+
343
+ # ========================================================================= #
344
+ # === colour_for_symlinks?
345
+ # ========================================================================= #
346
+ def colour_for_symlinks?
347
+ @internal_hash[:colour_for_symlinks]
348
+ end
349
+
350
+ # ========================================================================= #
351
+ # === colour_for_directories?
352
+ # ========================================================================= #
353
+ def colour_for_directories?
354
+ @internal_hash[:colour_for_directories]
355
+ end
356
+
357
+ end; end