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,196 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'directory_paradise/base/colours.rb'
6
+ # =========================================================================== #
7
+ module DirectoryParadise
8
+
9
+ class Base
10
+
11
+ # ========================================================================= #
12
+ # === do_use_colours
13
+ # ========================================================================= #
14
+ def do_use_colours(optional_args = '')
15
+ @internal_hash[:use_colours] = true # Whether we will use colours or whether we will not.
16
+ end; alias enable_colours do_use_colours # === enable_colours
17
+
18
+ # ========================================================================= #
19
+ # === use_colours?
20
+ #
21
+ # Whether we use colours or whether we don't.
22
+ # ========================================================================= #
23
+ def use_colours?(
24
+ i = @internal_hash[:use_colours]
25
+ )
26
+ i
27
+ end
28
+
29
+ # ========================================================================= #
30
+ # === disable_colours
31
+ #
32
+ # Disable colours through this method.
33
+ # ========================================================================= #
34
+ def disable_colours
35
+ @internal_hash[:use_colours] = false
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === slink
40
+ # ========================================================================= #
41
+ def slink(i)
42
+ return Colours.slink(i) if use_colours?
43
+ i
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === simp
48
+ # ========================================================================= #
49
+ def simp(i)
50
+ return Colours.simp(i) if use_colours?
51
+ i
52
+ end
53
+
54
+ # ========================================================================= #
55
+ # === sfancy
56
+ # ========================================================================= #
57
+ def sfancy(i)
58
+ return Colours.sfancy(i) if use_colours?
59
+ i
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === rev
64
+ # ========================================================================= #
65
+ def rev
66
+ "\e[0;37m"
67
+ end
68
+
69
+ # ========================================================================= #
70
+ # === bold_yellow
71
+ # ========================================================================= #
72
+ def bold_yellow(i)
73
+ if use_colours?
74
+ Colours::BOLD_YELLOW+i+rev
75
+ else
76
+ i
77
+ end
78
+ end
79
+
80
+ # ========================================================================= #
81
+ # === steelblue
82
+ # ========================================================================= #
83
+ def steelblue(i)
84
+ return Colours.steelblue(i) if use_colours?
85
+ i
86
+ end
87
+
88
+ # ========================================================================= #
89
+ # === springgreen
90
+ # ========================================================================= #
91
+ def springgreen(i)
92
+ return ::Colours.springgreen(i) if use_colours?
93
+ i
94
+ end
95
+
96
+ # ========================================================================= #
97
+ # === royalblue
98
+ # ========================================================================= #
99
+ def royalblue(i)
100
+ return ::Colours.royalblue(i) if use_colours?
101
+ i
102
+ end
103
+
104
+ # ========================================================================= #
105
+ # === lightblue
106
+ # ========================================================================= #
107
+ def lightblue(i)
108
+ return ::Colours.lightblue(i) if use_colours?
109
+ i
110
+ end
111
+
112
+ # ========================================================================= #
113
+ # === lightgreen
114
+ # ========================================================================= #
115
+ def lightgreen(i)
116
+ return ::Colours.lightgreen(i) if use_colours?
117
+ i
118
+ end
119
+
120
+ # ========================================================================= #
121
+ # === yellow
122
+ # ========================================================================= #
123
+ def yellow(i)
124
+ return ::Colours.yellow(i) if use_colours?
125
+ i
126
+ end
127
+
128
+ # ========================================================================= #
129
+ # === tomato
130
+ # ========================================================================= #
131
+ def tomato(i)
132
+ return ::Colours.tomato(i) if use_colours?
133
+ end
134
+
135
+ # ========================================================================= #
136
+ # === skyblue
137
+ # ========================================================================= #
138
+ def skyblue(i)
139
+ return ::Colours.skyblue(i) if use_colours?
140
+ end
141
+
142
+ # ========================================================================= #
143
+ # === olive
144
+ # ========================================================================= #
145
+ def olive(i)
146
+ return ::Colours.olive(i) if use_colours?
147
+ i
148
+ end
149
+
150
+ # ========================================================================= #
151
+ # === ssymlink
152
+ # ========================================================================= #
153
+ def ssymlink(i)
154
+ return ::Colours.ssymlink(i) if use_colours?
155
+ i
156
+ end
157
+
158
+ # ========================================================================= #
159
+ # === sdir
160
+ # ========================================================================= #
161
+ def sdir(i)
162
+ i = i.to_s.dup
163
+ # i << '/' unless i.end_with? '/'
164
+ # ^^^ Nope, that is bad.
165
+ i = rds(i) if i.include? '//'
166
+ i = Colours.sdir(i) if use_colours?
167
+ return i
168
+ end; alias colourize_directory sdir # === colourize_directory tag
169
+
170
+ # ========================================================================= #
171
+ # === sfile
172
+ #
173
+ # We will invoke this only when we have a file.
174
+ # ========================================================================= #
175
+ def sfile(i)
176
+ if use_colours?
177
+ splitted = i.split('/')
178
+ filename = Colours.sfile(splitted.pop) # Must come before dirname, due to .pop().
179
+ dirname = Colours.sdir( rds(splitted.join('/')+'/') )
180
+ unless show_leading_slash?
181
+ dirname = '' # Reset it in this case.
182
+ end
183
+ i = "#{dirname}#{filename}"
184
+ end
185
+ return i
186
+ end; alias colourize_file sfile # === colourize_file()
187
+
188
+ # ========================================================================= #
189
+ # === mediumpurple
190
+ # ========================================================================= #
191
+ def mediumpurple(i)
192
+ return ::Colours.mediumpurple(i) if use_colours?
193
+ i
194
+ end
195
+
196
+ end; end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'directory_content/constants/newline.rb'
6
+ # =========================================================================== #
7
+ class DirectoryContent
8
+
9
+ # ========================================================================= #
10
+ # === N
11
+ # ========================================================================= #
12
+ N = "\n"
13
+
14
+ end
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'directory_paradise/content/constants.rb'
6
+ # =========================================================================== #
7
+ require 'directory_paradise/base/base.rb'
8
+
9
+ module DirectoryParadise
10
+
11
+ class Content < Base
12
+
13
+ # ========================================================================= #
14
+ # === NAMESPACE
15
+ # ========================================================================= #
16
+ NAMESPACE = inspect
17
+
18
+ # ========================================================================= #
19
+ # === UNKNOWN
20
+ # ========================================================================= #
21
+ UNKNOWN = '(unknown)'
22
+
23
+ end; end