universal_pipe_handler 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +461 -0
- data/doc/README.gen +417 -0
- data/doc/todo/todo_for_the_universal_pipe_handler_project.md +300 -0
- data/img/UNIVERSAL_PIPE_HANDLER_LOGO.jpg +0 -0
- data/img/pipe_paradise.png +0 -0
- data/lib/universal_pipe_handler/base/base.rb +147 -0
- data/lib/universal_pipe_handler/cmdlet/cmdlet.rb +287 -0
- data/lib/universal_pipe_handler/cmdlets/add.rb +15 -0
- data/lib/universal_pipe_handler/cmdlets/add_audio.rb +22 -0
- data/lib/universal_pipe_handler/cmdlets/all.rb +37 -0
- data/lib/universal_pipe_handler/cmdlets/any.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/ascii_video.rb +30 -0
- data/lib/universal_pipe_handler/cmdlets/assign.rb +24 -0
- data/lib/universal_pipe_handler/cmdlets/capture_screen.rb +46 -0
- data/lib/universal_pipe_handler/cmdlets/colourize.rb +35 -0
- data/lib/universal_pipe_handler/cmdlets/convert_to.rb +21 -0
- data/lib/universal_pipe_handler/cmdlets/convert_to_images.rb +17 -0
- data/lib/universal_pipe_handler/cmdlets/convert_to_mp3.rb +28 -0
- data/lib/universal_pipe_handler/cmdlets/convert_to_wav.rb +17 -0
- data/lib/universal_pipe_handler/cmdlets/copy_directories.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/count_character.rb +31 -0
- data/lib/universal_pipe_handler/cmdlets/count_longest_row.rb +21 -0
- data/lib/universal_pipe_handler/cmdlets/crop.rb +26 -0
- data/lib/universal_pipe_handler/cmdlets/cut.rb +101 -0
- data/lib/universal_pipe_handler/cmdlets/days.rb +41 -0
- data/lib/universal_pipe_handler/cmdlets/decolourize.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/download.rb +30 -0
- data/lib/universal_pipe_handler/cmdlets/download_torrent.rb +17 -0
- data/lib/universal_pipe_handler/cmdlets/duration.rb +34 -0
- data/lib/universal_pipe_handler/cmdlets/extract.rb +27 -0
- data/lib/universal_pipe_handler/cmdlets/extract_all.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/extract_audio.rb +30 -0
- data/lib/universal_pipe_handler/cmdlets/extract_video.rb +18 -0
- data/lib/universal_pipe_handler/cmdlets/find_all.rb +40 -0
- data/lib/universal_pipe_handler/cmdlets/generate_random_video.rb +29 -0
- data/lib/universal_pipe_handler/cmdlets/generate_string.rb +27 -0
- data/lib/universal_pipe_handler/cmdlets/get_all_audio_files.rb +33 -0
- data/lib/universal_pipe_handler/cmdlets/get_all_files.rb +61 -0
- data/lib/universal_pipe_handler/cmdlets/get_all_images.rb +47 -0
- data/lib/universal_pipe_handler/cmdlets/get_all_images_including_subdirs.rb +26 -0
- data/lib/universal_pipe_handler/cmdlets/get_all_video_files.rb +34 -0
- data/lib/universal_pipe_handler/cmdlets/get_last_characters.rb +24 -0
- data/lib/universal_pipe_handler/cmdlets/help.rb +36 -0
- data/lib/universal_pipe_handler/cmdlets/identify.rb +29 -0
- data/lib/universal_pipe_handler/cmdlets/increase_audio.rb +26 -0
- data/lib/universal_pipe_handler/cmdlets/install.rb +32 -0
- data/lib/universal_pipe_handler/cmdlets/match_regex.rb +24 -0
- data/lib/universal_pipe_handler/cmdlets/n_directories.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/n_files.rb +20 -0
- data/lib/universal_pipe_handler/cmdlets/n_words.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/number_lines.rb +34 -0
- data/lib/universal_pipe_handler/cmdlets/open_in_browser.rb +40 -0
- data/lib/universal_pipe_handler/cmdlets/pad_left.rb +20 -0
- data/lib/universal_pipe_handler/cmdlets/pad_right.rb +20 -0
- data/lib/universal_pipe_handler/cmdlets/play.rb +18 -0
- data/lib/universal_pipe_handler/cmdlets/position.rb +21 -0
- data/lib/universal_pipe_handler/cmdlets/processes.rb +18 -0
- data/lib/universal_pipe_handler/cmdlets/random.rb +21 -0
- data/lib/universal_pipe_handler/cmdlets/random_video.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/read_file.rb +44 -0
- data/lib/universal_pipe_handler/cmdlets/read_line.rb +31 -0
- data/lib/universal_pipe_handler/cmdlets/read_n_lines.rb +38 -0
- data/lib/universal_pipe_handler/cmdlets/read_n_lines_inverted.rb +36 -0
- data/lib/universal_pipe_handler/cmdlets/remove_audio.rb +22 -0
- data/lib/universal_pipe_handler/cmdlets/remove_comments.rb +26 -0
- data/lib/universal_pipe_handler/cmdlets/remove_directories.rb +29 -0
- data/lib/universal_pipe_handler/cmdlets/remove_html.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/remove_newlines.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/remove_numbers.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/repackage_to.rb +27 -0
- data/lib/universal_pipe_handler/cmdlets/replace_underscores.rb +29 -0
- data/lib/universal_pipe_handler/cmdlets/resize.rb +39 -0
- data/lib/universal_pipe_handler/cmdlets/resize_image.rb +45 -0
- data/lib/universal_pipe_handler/cmdlets/reverse.rb +22 -0
- data/lib/universal_pipe_handler/cmdlets/screenshot.rb +41 -0
- data/lib/universal_pipe_handler/cmdlets/search_torrent.rb +24 -0
- data/lib/universal_pipe_handler/cmdlets/seconds.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/select.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/show_lines.rb +31 -0
- data/lib/universal_pipe_handler/cmdlets/shuffle.rb +16 -0
- data/lib/universal_pipe_handler/cmdlets/shuffle_csv.rb +55 -0
- data/lib/universal_pipe_handler/cmdlets/size.rb +21 -0
- data/lib/universal_pipe_handler/cmdlets/sort_alphabetical.rb +20 -0
- data/lib/universal_pipe_handler/cmdlets/sort_by_date.rb +23 -0
- data/lib/universal_pipe_handler/cmdlets/starts_with.rb +25 -0
- data/lib/universal_pipe_handler/cmdlets/stat_file.rb +61 -0
- data/lib/universal_pipe_handler/cmdlets/to_ascii.rb +38 -0
- data/lib/universal_pipe_handler/cmdlets/to_camel_case.rb +38 -0
- data/lib/universal_pipe_handler/cmdlets/to_dna.rb +31 -0
- data/lib/universal_pipe_handler/cmdlets/to_movie.rb +16 -0
- data/lib/universal_pipe_handler/cmdlets/to_pdf.rb +58 -0
- data/lib/universal_pipe_handler/cmdlets/translate.rb +36 -0
- data/lib/universal_pipe_handler/cmdlets/upload_to.rb +29 -0
- data/lib/universal_pipe_handler/cmdlets/word_count.rb +39 -0
- data/lib/universal_pipe_handler/cmdlets/word_wrap.rb +26 -0
- data/lib/universal_pipe_handler/cmdlets/write_to.rb +51 -0
- data/lib/universal_pipe_handler/cmdlets/years.rb +30 -0
- data/lib/universal_pipe_handler/cmdlets_handler/cmdlets_handler.rb +193 -0
- data/lib/universal_pipe_handler/colours/colourize.rb +112 -0
- data/lib/universal_pipe_handler/colours/colours.rb +54 -0
- data/lib/universal_pipe_handler/configuration/configuration.rb +18 -0
- data/lib/universal_pipe_handler/constants/constants.rb +201 -0
- data/lib/universal_pipe_handler/dataset/dataset.rb +14 -0
- data/lib/universal_pipe_handler/project/project.rb +36 -0
- data/lib/universal_pipe_handler/requires/do_require_the_individual_cmdlet_files.rb +21 -0
- data/lib/universal_pipe_handler/requires/require_the_universal_pipe_handler.rb +14 -0
- data/lib/universal_pipe_handler/shell/shell.rb +256 -0
- data/lib/universal_pipe_handler/toplevel_methods/all_actions.rb +48 -0
- data/lib/universal_pipe_handler/toplevel_methods/cmdlet_directory.rb +22 -0
- data/lib/universal_pipe_handler/toplevel_methods/e.rb +16 -0
- data/lib/universal_pipe_handler/toplevel_methods/misc.rb +54 -0
- data/lib/universal_pipe_handler/toplevel_methods/rds.rb +18 -0
- data/lib/universal_pipe_handler/toplevel_methods/token.rb +18 -0
- data/lib/universal_pipe_handler/version/version.rb +19 -0
- data/lib/universal_pipe_handler/yaml/aliases_to_cmdlets.yml +250 -0
- data/lib/universal_pipe_handler/yaml/allowed_cmdlets.yml +118 -0
- data/lib/universal_pipe_handler/yaml/predefined_methods.yml +15 -0
- data/lib/universal_pipe_handler.rb +5 -0
- data/test/testing_the_universal_pipe_handler.rb +65 -0
- data/test/this_file +46 -0
- data/universal_pipe_handler.gemspec +80 -0
- metadata +299 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# === aliases_to_cmdlets.yml
|
3
|
+
#
|
4
|
+
# The purpose of this file is to use aliases for specific actions
|
5
|
+
# in the UniversalPipeHandler namespace.
|
6
|
+
#
|
7
|
+
# The format used here for this file is very simple:
|
8
|
+
#
|
9
|
+
# First comes the `ALIAS NAME`, and then comes the `REAL NAME`.
|
10
|
+
#
|
11
|
+
# Sort by REAL_NAME first, please.
|
12
|
+
# =========================================================================== #
|
13
|
+
# To load this .yml file, do:
|
14
|
+
#
|
15
|
+
# yaml_file = ENV['PIPE_PARADISE']+'/yaml/pipe_aliases.yml'
|
16
|
+
# pipe_aliases = YAML.load_file(yaml_file); pp pipe_aliases
|
17
|
+
#
|
18
|
+
# To use it in code, do:
|
19
|
+
#
|
20
|
+
# pp PipeParadise::PIPE_ALIASES
|
21
|
+
#
|
22
|
+
# =========================================================================== #
|
23
|
+
|
24
|
+
convert to wav: convert_to_wav
|
25
|
+
convert_to wav: convert_to_wav
|
26
|
+
|
27
|
+
convert_to mp3: convert_to_mp3
|
28
|
+
convert to mp3: convert_to_mp3
|
29
|
+
|
30
|
+
download torrent: download_torrent
|
31
|
+
|
32
|
+
match: match_regex
|
33
|
+
|
34
|
+
on one line: remove_newlines
|
35
|
+
remove newlines: remove_newlines
|
36
|
+
strip_newlines: remove_newlines
|
37
|
+
|
38
|
+
pad: pad_left
|
39
|
+
pad left: pad_left
|
40
|
+
pad right: pad_right
|
41
|
+
|
42
|
+
show_line: read_line
|
43
|
+
show line: read_line
|
44
|
+
|
45
|
+
repackage to: repackage_to
|
46
|
+
|
47
|
+
generate string: generate_string
|
48
|
+
|
49
|
+
search torrent: search_torrent
|
50
|
+
|
51
|
+
head: read_n_lines
|
52
|
+
|
53
|
+
tail: read_n_lines_inverted
|
54
|
+
|
55
|
+
copy dirs: copy_directories
|
56
|
+
copy all directories: copy_directories
|
57
|
+
|
58
|
+
down: download
|
59
|
+
|
60
|
+
longest_row: count_longest_row
|
61
|
+
|
62
|
+
ndirectories: n_directories
|
63
|
+
|
64
|
+
remove html: remove_html
|
65
|
+
|
66
|
+
remove_number: remove_numbers
|
67
|
+
|
68
|
+
extract all: extract_all
|
69
|
+
extract dir: extract_all
|
70
|
+
extract directories: extract_all
|
71
|
+
|
72
|
+
complete_reverse: reverse
|
73
|
+
full_reverse file: reverse
|
74
|
+
|
75
|
+
processes: processes?
|
76
|
+
|
77
|
+
find all: find_all
|
78
|
+
find: find_all
|
79
|
+
grep: find_all
|
80
|
+
|
81
|
+
trans: translate
|
82
|
+
tra: translate
|
83
|
+
tr: translate
|
84
|
+
|
85
|
+
wrap_at: word_wrap
|
86
|
+
wrap at: word_wrap
|
87
|
+
|
88
|
+
count: count_character
|
89
|
+
cnt: count_character
|
90
|
+
|
91
|
+
egrep: starts_with?
|
92
|
+
starts with: starts_with?
|
93
|
+
|
94
|
+
col: colourize
|
95
|
+
rcol: colourize
|
96
|
+
|
97
|
+
n_words?: n_words
|
98
|
+
|
99
|
+
count_word: word_count
|
100
|
+
count_words: word_count
|
101
|
+
search_unique_words: word_count
|
102
|
+
find_unique_words: word_count
|
103
|
+
|
104
|
+
play video file: play
|
105
|
+
|
106
|
+
help: help?
|
107
|
+
|
108
|
+
show in browser: open_in_browser
|
109
|
+
display_in_browser: open_in_browser
|
110
|
+
to_browser: open_in_browser
|
111
|
+
to browser: open_in_browser
|
112
|
+
browser: open_in_browser
|
113
|
+
open in browser: open_in_browser
|
114
|
+
|
115
|
+
generate random video: generate_random_video
|
116
|
+
generate video: generate_random_video
|
117
|
+
|
118
|
+
pdf: to_pdf
|
119
|
+
to pdf: to_pdf
|
120
|
+
|
121
|
+
to dna: to_dna
|
122
|
+
|
123
|
+
shuffle csv: shuffle_csv
|
124
|
+
|
125
|
+
write to: write_to
|
126
|
+
save in: write_to
|
127
|
+
save: write_to
|
128
|
+
save to: write_to
|
129
|
+
extract_audio_to: write_to
|
130
|
+
save_to: write_to
|
131
|
+
save_into: write_to
|
132
|
+
save_as: write_to
|
133
|
+
|
134
|
+
decolorize: decolourize
|
135
|
+
decol: decolourize
|
136
|
+
uncolourize: decolourize
|
137
|
+
grey: decolourize
|
138
|
+
gray: decolourize
|
139
|
+
greyize: decolourize
|
140
|
+
|
141
|
+
ascii: to_ascii
|
142
|
+
to ascii: to_ascii
|
143
|
+
|
144
|
+
random_line: random
|
145
|
+
random line: random
|
146
|
+
rline: random
|
147
|
+
|
148
|
+
asciivid: ascii_video
|
149
|
+
play in ascii: ascii_video
|
150
|
+
play_in_ascii: ascii_video
|
151
|
+
asciivideo: ascii_video
|
152
|
+
|
153
|
+
stat: stat_file
|
154
|
+
file_size: stat_file
|
155
|
+
file size: stat_file
|
156
|
+
stat file: stat_file
|
157
|
+
|
158
|
+
upload: upload_to
|
159
|
+
ftp_upload: upload_to
|
160
|
+
|
161
|
+
shot: screenshot
|
162
|
+
snapshot: screenshot
|
163
|
+
|
164
|
+
rblanks: replace_underscores
|
165
|
+
replace_space: replace_underscores
|
166
|
+
replace underscores: replace_underscores
|
167
|
+
|
168
|
+
convert into images: convert_to_images
|
169
|
+
convert to images: convert_to_images
|
170
|
+
convert images: convert_to_images
|
171
|
+
|
172
|
+
images: get_all_images
|
173
|
+
all_images: get_all_images
|
174
|
+
all images: get_all_images
|
175
|
+
all_images_from: get_all_images
|
176
|
+
get_all_images_from: get_all_images
|
177
|
+
get all images: get_all_images
|
178
|
+
|
179
|
+
resize image: resize_image
|
180
|
+
resize: resize_image
|
181
|
+
|
182
|
+
strip_comment: remove_comments
|
183
|
+
strip_comments: remove_comments
|
184
|
+
remove comments: remove_comments
|
185
|
+
remove_comment: remove_comments
|
186
|
+
strip comments: remove_comments
|
187
|
+
|
188
|
+
remove directories: remove_directories
|
189
|
+
|
190
|
+
remove audio: remove_audio
|
191
|
+
disable audio: remove_audio
|
192
|
+
disable_audio: remove_audio
|
193
|
+
|
194
|
+
screencast: capture_screen
|
195
|
+
scrot: capture_screen
|
196
|
+
scot: capture_screen
|
197
|
+
capturescreen: capture_screen
|
198
|
+
|
199
|
+
nl: number_lines
|
200
|
+
count_lines: number_lines
|
201
|
+
|
202
|
+
day: days?
|
203
|
+
days: days?
|
204
|
+
|
205
|
+
total_size: size
|
206
|
+
total size: size
|
207
|
+
|
208
|
+
add audio: add_audio
|
209
|
+
|
210
|
+
increase audio: increase_audio
|
211
|
+
increase volume: increase_audio
|
212
|
+
increase_volume: increase_audio
|
213
|
+
|
214
|
+
get all audio files: get_all_audio_files
|
215
|
+
all videos: get_all_video_files
|
216
|
+
|
217
|
+
nfiles: n_files
|
218
|
+
|
219
|
+
open: assign
|
220
|
+
assign file: assign
|
221
|
+
|
222
|
+
# =========================================================================== #
|
223
|
+
# === read file tag
|
224
|
+
# =========================================================================== #
|
225
|
+
cat: read_file
|
226
|
+
get_content: read_file
|
227
|
+
readfile: read_file
|
228
|
+
rfile: read_file
|
229
|
+
read: read_file
|
230
|
+
read file: read_file
|
231
|
+
|
232
|
+
# =========================================================================== #
|
233
|
+
# === camelcase tag
|
234
|
+
# =========================================================================== #
|
235
|
+
camel_case: to_camel_case
|
236
|
+
camelCase: to_camel_case
|
237
|
+
|
238
|
+
# =========================================================================== #
|
239
|
+
# === ls tag
|
240
|
+
# =========================================================================== #
|
241
|
+
# get_all_files: list_content # Nope - this is now a standalone action.
|
242
|
+
ls: get_all_files
|
243
|
+
get all files: get_all_files
|
244
|
+
list_content: get_all_files
|
245
|
+
lc: get_all_files
|
246
|
+
ll: get_all_files
|
247
|
+
all_files: get_all_files
|
248
|
+
get_files: get_all_files
|
249
|
+
list_dir: get_all_files
|
250
|
+
cmdlet_ls: get_all_files
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# === allowed_cmdlets.yml
|
3
|
+
#
|
4
|
+
# ALL allowed possible actions __MUST__ be registered here.
|
5
|
+
#
|
6
|
+
# There exists NO exception to this rule!
|
7
|
+
#
|
8
|
+
# There also may be only ONE action here for any specific task.
|
9
|
+
#
|
10
|
+
# Also, NO exception to this - if you want to assign aliases, use
|
11
|
+
# the yaml file called aliases_to_cmdlets.yml instead.
|
12
|
+
#
|
13
|
+
# Please do sort the actions alphabetically.
|
14
|
+
#
|
15
|
+
# Last but not least - the name of each action here will also
|
16
|
+
# become a .rb file.
|
17
|
+
#
|
18
|
+
# So, if we have an action called "add", then we will also find the
|
19
|
+
# corresponding pipe_paradise/actions/add.rb file.
|
20
|
+
#
|
21
|
+
# For example, the entry "- years" here also should correspond to a
|
22
|
+
# file called years.rb, which defines the task it should do.
|
23
|
+
# =========================================================================== #
|
24
|
+
|
25
|
+
- add
|
26
|
+
- add_audio
|
27
|
+
- all
|
28
|
+
- any
|
29
|
+
- assign
|
30
|
+
- ascii_video
|
31
|
+
- capture_screen
|
32
|
+
- convert_to
|
33
|
+
- convert_to_images
|
34
|
+
- convert_to_wav
|
35
|
+
- convert_to_mp3
|
36
|
+
- count_longest_row
|
37
|
+
- count_character
|
38
|
+
- colourize
|
39
|
+
- copy_directories
|
40
|
+
- crop
|
41
|
+
- cut
|
42
|
+
- days?
|
43
|
+
- decolourize
|
44
|
+
- download
|
45
|
+
- download_torrent
|
46
|
+
- duration
|
47
|
+
- extract
|
48
|
+
- extract_audio
|
49
|
+
- extract_all
|
50
|
+
- extract_video
|
51
|
+
- find_all
|
52
|
+
- find_unique_words
|
53
|
+
- generate_random_video
|
54
|
+
- get_all_images
|
55
|
+
- get_all_images_including_subdirs
|
56
|
+
- get_all_audio_files
|
57
|
+
- get_all_video_files
|
58
|
+
- get_all_files
|
59
|
+
- get_last_characters
|
60
|
+
- generate_string
|
61
|
+
- help?
|
62
|
+
- identify
|
63
|
+
- increase_audio
|
64
|
+
- list_content
|
65
|
+
- match_regex
|
66
|
+
- n_directories
|
67
|
+
- n_files
|
68
|
+
- n_words
|
69
|
+
- number_lines
|
70
|
+
- install
|
71
|
+
- open_in_browser
|
72
|
+
- pad_left
|
73
|
+
- pad_right
|
74
|
+
- play
|
75
|
+
- position
|
76
|
+
- processes?
|
77
|
+
- random
|
78
|
+
# - random_line # This is actually an alias. If things work, we will remove this completely eventually at the latest in 2016.
|
79
|
+
- random_video
|
80
|
+
- read_file
|
81
|
+
- read_line
|
82
|
+
- read_n_lines
|
83
|
+
- read_n_lines_inverted
|
84
|
+
- remove_audio
|
85
|
+
- remove_comments
|
86
|
+
- remove_directories
|
87
|
+
- remove_html
|
88
|
+
- remove_newlines
|
89
|
+
- remove_numbers
|
90
|
+
- repackage_to
|
91
|
+
- replace
|
92
|
+
- replace_underscores
|
93
|
+
- resize
|
94
|
+
- resize_image
|
95
|
+
- reverse
|
96
|
+
- search_torrent
|
97
|
+
- seconds?
|
98
|
+
- select
|
99
|
+
- screenshot
|
100
|
+
- show_lines
|
101
|
+
- shuffle
|
102
|
+
- shuffle_csv
|
103
|
+
- size
|
104
|
+
- sort_alphabetical
|
105
|
+
- sort_by_date
|
106
|
+
- starts_with?
|
107
|
+
- stat_file
|
108
|
+
- to_ascii
|
109
|
+
- to_camel_case
|
110
|
+
- to_dna
|
111
|
+
- to_movie
|
112
|
+
- to_pdf
|
113
|
+
- translate
|
114
|
+
- upload_to
|
115
|
+
- word_wrap
|
116
|
+
- word_count
|
117
|
+
- write_to
|
118
|
+
- years
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# === predefined_methods.yml
|
3
|
+
#
|
4
|
+
# This file will contain special methods. For example, enlarge is
|
5
|
+
# the same such as invoking resize_image with a default of 150%.
|
6
|
+
# =========================================================================== #
|
7
|
+
|
8
|
+
# =========================================================================== #
|
9
|
+
# === enlarge
|
10
|
+
#
|
11
|
+
# enlarge defaults to resize_image(result?, 150%)
|
12
|
+
# =========================================================================== #
|
13
|
+
enlarge:
|
14
|
+
invoke_this_method: resize_image
|
15
|
+
extra_argument: 150%
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'universal_pipe_handler'
|
6
|
+
require 'colours/autoinclude'
|
7
|
+
require 'opn'
|
8
|
+
|
9
|
+
# =========================================================================== #
|
10
|
+
# === ARRAY_TEST_THESE_INSTRUCTIONS
|
11
|
+
# =========================================================================== #
|
12
|
+
ARRAY_TEST_THESE_INSTRUCTIONS = [
|
13
|
+
'ls | nl', # Works fine.
|
14
|
+
' read_file :ruby', # Works fine.
|
15
|
+
' cat :ruby | nl', # Works fine.
|
16
|
+
'ls | nl ', # Works fine.
|
17
|
+
'cat $RUBY_TOOLS/return_random_image.rb | nl',
|
18
|
+
|
19
|
+
# The following entry does not yet work.
|
20
|
+
#
|
21
|
+
# 'assign file THIS_FILE | nl'
|
22
|
+
]
|
23
|
+
|
24
|
+
# =========================================================================== #
|
25
|
+
# === 1 tag
|
26
|
+
# =========================================================================== #
|
27
|
+
e 'The YAML directory the project can be found here:'
|
28
|
+
e
|
29
|
+
e " #{sfancy(UniversalPipeHandler.project_yaml_dir?})"
|
30
|
+
e
|
31
|
+
# =========================================================================== #
|
32
|
+
# === 2 tag
|
33
|
+
# =========================================================================== #
|
34
|
+
e
|
35
|
+
e 'Testing the pipe aliases next for UniversalPipeHandler:'
|
36
|
+
e
|
37
|
+
pp UniversalPipeHandler.pipe_aliases?
|
38
|
+
pp Hash[UniversalPipeHandler.pipe_aliases?] #<<' [TRUNCATED]'
|
39
|
+
e
|
40
|
+
# =========================================================================== #
|
41
|
+
# === 3 tag - testing Commandlet[]
|
42
|
+
# =========================================================================== #
|
43
|
+
e
|
44
|
+
e 'Next testing the standalone '+
|
45
|
+
mediumseagreen('Cmdlet[]')+' functionality:'
|
46
|
+
e
|
47
|
+
e UniversalPipeHandler::Cmdlet[' resize image $IMG/NJOY/Jennifer_Jones.jpg 25% ']
|
48
|
+
|
49
|
+
ARRAY_TEST_THESE_INSTRUCTIONS.each {|instruction|
|
50
|
+
opn; e "The instruction was: `#{lawngreen(instruction)}`"
|
51
|
+
commandlet = UniversalPipeHandler::Cmdlet.new(instruction) {{ do_not_exit: true }}
|
52
|
+
e " #{skyblue(commandlet.result)}"
|
53
|
+
} # tspipe
|
54
|
+
|
55
|
+
# =========================================================================== #
|
56
|
+
# === 4 tag
|
57
|
+
# =========================================================================== #
|
58
|
+
e N+counter+'Next testing a bunch of instructions for '+
|
59
|
+
orangered('commandlet.rb')+' by '
|
60
|
+
e ' using the array '+lawngreen('ARRAY_TEST_THESE_INSTRUCTIONS')+
|
61
|
+
'.'+N+N
|
62
|
+
ARRAY_TEST_THESE_INSTRUCTIONS.each {|instruction|
|
63
|
+
opn; e "The instruction was: `#{lawngreen(instruction)}`"
|
64
|
+
commandlet = UniversalPipeHandler::Cmdlet.new(instruction) {{ :do_not_exit => true }}
|
65
|
+
} # tspipe
|
data/test/this_file
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
This is a file that can be used to test the UniversalPipeHandler.
|
2
|
+
|
3
|
+
1 abc
|
4
|
+
2 def
|
5
|
+
3 ghi
|
6
|
+
4 jkl
|
7
|
+
5
|
8
|
+
6 abc
|
9
|
+
7 def
|
10
|
+
8 Ich ging allein im Wald spazieren - yuche!
|
11
|
+
9 Diese Zeile hat genau 80 Characters. Diese Zeile hat genau 80 Characters. Yup.
|
12
|
+
10 das ist die 10. zeile ...
|
13
|
+
11 das ist die 11. zeile ...
|
14
|
+
12 das ist die 12. zeile ...
|
15
|
+
|
16
|
+
abc
|
17
|
+
def
|
18
|
+
ghi
|
19
|
+
jkl
|
20
|
+
mno
|
21
|
+
pqr ABC
|
22
|
+
|
23
|
+
23 hey
|
24
|
+
24 yo
|
25
|
+
25 the rock steady crew
|
26
|
+
|
27
|
+
dog cat
|
28
|
+
cat dog
|
29
|
+
|
30
|
+
Line 31
|
31
|
+
Line 32
|
32
|
+
Line 33
|
33
|
+
Line 34
|
34
|
+
Line 35
|
35
|
+
Line 36
|
36
|
+
Line 37
|
37
|
+
Line 38
|
38
|
+
Line 39
|
39
|
+
Line 40
|
40
|
+
Line 41
|
41
|
+
Line 42
|
42
|
+
Line 43
|
43
|
+
Line 44
|
44
|
+
Line 45
|
45
|
+
Line 46
|
46
|
+
47 Line
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for the project.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'universal_pipe_handler/version/version.rb'
|
5
|
+
require 'roebe/toplevel_methods/misc.rb'
|
6
|
+
|
7
|
+
Gem::Specification.new { |s|
|
8
|
+
|
9
|
+
s.name = 'universal_pipe_handler'
|
10
|
+
s.version = UniversalPipeHandler::VERSION
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
12
|
+
|
13
|
+
DESCRIPTION = <<-EOF
|
14
|
+
|
15
|
+
WARNING: THIS IS INCOMPLETE AS OF YET. DO NOT YET DOWNLOAD!!!
|
16
|
+
|
17
|
+
This library is called universal_pipe_handler.
|
18
|
+
|
19
|
+
It allows the user to construct pipes (if these are
|
20
|
+
registered - otherwise we can not use them).
|
21
|
+
|
22
|
+
How does this look like?
|
23
|
+
|
24
|
+
A pipe is something like:
|
25
|
+
|
26
|
+
cat test.txt | nl
|
27
|
+
|
28
|
+
This will count how many lines there are in said file.
|
29
|
+
|
30
|
+
EOF
|
31
|
+
|
32
|
+
s.summary = DESCRIPTION
|
33
|
+
s.description = DESCRIPTION
|
34
|
+
|
35
|
+
s.authors = ['Robert A. Heiler']
|
36
|
+
s.email = Roebe.email?
|
37
|
+
s.files = Dir['**/*']
|
38
|
+
s.license = 'MIT'
|
39
|
+
s.homepage = 'https://rubygems.org/gems/universal_pipe_handler'
|
40
|
+
|
41
|
+
s.required_ruby_version = '>= '+Roebe.second_most_stable_version_of_ruby
|
42
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
43
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
44
|
+
|
45
|
+
# ========================================================================= #
|
46
|
+
# Show this when a user installs this project.
|
47
|
+
# ========================================================================= #
|
48
|
+
s.post_install_message = <<-EOF
|
49
|
+
|
50
|
+
This project sanitizes and validates actions that were registered
|
51
|
+
for a "pipe simulator" in Ruby.
|
52
|
+
|
53
|
+
The general idea for the project is to be used in a similar
|
54
|
+
way as "Unix Pipes" are used, in the context of ruby, and to
|
55
|
+
also experiment with ideas pioneered by VirtualDub and
|
56
|
+
AviSynth.
|
57
|
+
|
58
|
+
EOF
|
59
|
+
|
60
|
+
# ========================================================================= #
|
61
|
+
# Dependencies for the UniversalPipeHandler project:
|
62
|
+
# ========================================================================= #
|
63
|
+
# s.add_dependency 'coderay'
|
64
|
+
# s.add_dependency 'crop'
|
65
|
+
# s.add_dependency 'wget'
|
66
|
+
# s.add_dependency 'remove_comments'
|
67
|
+
# s.add_dependency 'stat_file'
|
68
|
+
# s.add_dependency 'ftp_paradise'
|
69
|
+
# s.add_dependency 'prawn'
|
70
|
+
|
71
|
+
s.add_dependency 'beautiful_url'
|
72
|
+
s.add_dependency 'bioroebe'
|
73
|
+
s.add_dependency 'colours'
|
74
|
+
s.add_dependency 'extracter'
|
75
|
+
s.add_dependency 'convert_global_env'
|
76
|
+
s.add_dependency 'multimedia_paradise'
|
77
|
+
s.add_dependency 'roebe'
|
78
|
+
s.add_dependency 'save_file'
|
79
|
+
|
80
|
+
}
|