Class: RBT::ColourizeParser
- Inherits:
-
Base
show all
- Defined in:
- lib/rbt/misc/colourize_parser.rb
Overview
Constant Summary
LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === RBT::ColourizeParser[] ========================================================================= #.
-
.parse_this_line(line) ⇒ Object
# === RBT::ColourizeParser.parse_this_line ========================================================================= #.
Instance Method Summary
collapse
Methods inherited from Base
#cat, #cd_back_to_the_current_working_directory, #consider_reporting_how_many_programs_are_registered, #cookbook_files?, #copy_recursively, #delete_code_of_conduct?, #determine_appdir_prefix_from_this_input, #directory_validation?, #do_not_show_names, #fast_return_file_size_of_this_program, #file_last_symlinked_program?, #file_programs_version_url, #gem_version, #is_a_64bit_system?, #is_ccache_available?, #is_porg_available?, #is_this_binary_registered?, #is_this_program_included?, #make_command?, #make_install_command?, #new_cookbook_instance_for, #program_exists?, #publish_list_of_all_programs_version, #rcp, registered_binaries?, #remove_symlink, #rename_kde_konsole_tab, #repackage, #report_n_programs, #report_working_directory, #return_compile_time_statistics, #return_n_random_characters, #return_version_of_this_program, #run_make_then_make_install, #sanitize_url1_entry, #set_source_directory, #show_overview_over_available_utility_scripts, #symlink_all_files_from_this_directory_to_that_directory, #system_tags?, #upload_list_of_all_programs_version, #use_yaml_database_for_tags?, #warn_and_exit, #wget
#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_arguments, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #debug?, #directory_expanded_cookbooks?, #disable_colours, #display_md5sum?, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #enable_debug, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #extract_to?, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_meson_installed?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #is_this_program_included?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #n_programs_available?, #namespace?, #no_directory_exists_at, #no_directory_was_found_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #opnn, #otomato, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_symlink, #remove_the_first_commandline_argument, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #reset_the_internal_hash, #return_all_archives_from_this_directory, #return_appdir_prefix, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_name, #return_program_name_for_gobolinux_systems, #return_program_name_via_program_information, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #rpn, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_colours, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no
Constructor Details
#initialize(i = nil, run_already = true) ⇒ ColourizeParser
27
28
29
30
31
32
33
34
|
# File 'lib/rbt/misc/colourize_parser.rb', line 27
def initialize(
i = nil,
run_already = true
)
reset
set_line(i) if i
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
RBT::ColourizeParser[]
#
879
880
881
|
# File 'lib/rbt/misc/colourize_parser.rb', line 879
def self.[](i = ARGV)
new(i)
end
|
.parse_this_line(line) ⇒ Object
#
RBT::ColourizeParser.parse_this_line
#
865
866
867
|
# File 'lib/rbt/misc/colourize_parser.rb', line 865
def self.parse_this_line(line)
new(line).line?
end
|
Instance Method Details
#colour_for_found(i) ⇒ Object
#
colour_for_found
This method will colourize the word “found”. That word is used in particular for checks made in some cmake-based projects, such as the KDE project.
#
840
841
842
|
# File 'lib/rbt/misc/colourize_parser.rb', line 840
def colour_for_found(i)
darkorchid(i)
end
|
#colour_for_warnings_and_errors(i) ⇒ Object
Also known as:
colour_for_warning_and_errors
#
colour_for_warnings_and_errors
#
847
848
849
|
# File 'lib/rbt/misc/colourize_parser.rb', line 847
def colour_for_warnings_and_errors(i)
crimson(i)
end
|
#line? ⇒ Boolean
Also known as:
input?
52
53
54
|
# File 'lib/rbt/misc/colourize_parser.rb', line 52
def line?
@line
end
|
#parse_missing_dependency(i) ⇒ Object
#
parse_missing_dependency
This method will try to colourize a String such as:
meson.build:38:0: ERROR: Dependency "telepathy-glib" not found, tried pkgconfig and cmake
#
857
858
859
860
|
# File 'lib/rbt/misc/colourize_parser.rb', line 857
def parse_missing_dependency(i)
regex_to_use = /ERROR:\s+Dependency "(.+)" not found/
i.sub(regex_to_use, crimson('\1'))
end
|
#reset ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/rbt/misc/colourize_parser.rb', line 39
def reset
super()
infer_the_namespace
enable_colours
@line = ''.dup
end
|
#run ⇒ Object
872
873
874
|
# File 'lib/rbt/misc/colourize_parser.rb', line 872
def run
end
|
#sanitize_line ⇒ Object
#
sanitize_line
We must be careful in this method, as “line.squeeze!()” may fail due to an ArgumentError.
#
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
|
# File 'lib/rbt/misc/colourize_parser.rb', line 73
def sanitize_line
begin
stripped_line = @line.strip
rescue ArgumentError, Encoding::CompatibilityError => error
pp error if is_on_roebe?
stripped_line = @line.to_s.dup end
stripped_line = stripped_line.dup if stripped_line and stripped_line.frozen?
_paleturquoise = ALL_COLOUR_METHODS.paleturquoise
if @line.include?('Building CXX object') or
@line.include?('Linking C shared library') or
@line.include?('] Copying llvm') or
@line.include?('] Creating export file') or
@line.include?('] [FLEX]') or
@line.include?('] Linking target ') or
@line.include?('] Generating') or
@line.include?('] Running moc') or
@line.include?('] Merging translations for') or
@line.include?('] Making') or
@line.include?('] Updated:') or
@line.include?('] actions for') or
@line.include?('] Validating for') or @line.include?('] Built target') or
@line.include?('Built target ') or @line.include?('] Copying ') or @line.include?('] Gzipping ') or
@line.include?('] Generate bindings ') or @line.include?('] Completed ') or
@line.include?('] Linking') or
@line.include?('] Compiling') or
@line.include?('] Creating') or
@line.include?('] Generate files for') or
@line.include?('] Processing ') or
@line.include?('] mo-update: ') or
@line.include?('] mo-update [') or
@line.include?('] Updating ') or
@line.include?('] Building ') or
@line.include?('] Preparing ') or
@line.include?('] Building C object') or
@line.include?('] Running AUTOMOC ') or
@line.include?('] Built target') or
@line.include?('] Linking C executable') or
@line.include?('] Compiling C object') or
@line.include?('] Compiling C++ object') or
@line.include?('] Running rcc ') or
@line.include?('] Compiling Vala source') or
@line.include?('] Checking the ') or
@line.include?('] Linking static target') or
@line.include?('] Linking CXX shared') or
@line.include?('] Linking CXX static') or
@line.include?('] Linking CXX executable') or
@line.include?('] Creating library symlink') or
@line.include?('] Linking C static library') or
@line.include?('] Linking C shared') or
@line.include?('] Installing files.') or
(@line.include?('] Automatic ') and
@line.include?(' for ')) or
(@line.include?('] Compiling ') and
@line.include?('.po'))
@line = limegreen(@line)
elsif @line.start_with?('cd ') and @line.include?(' && ')
@line = orangered(@line)
elsif @line.start_with?('-- Check for working C')
if @line.end_with? ' -- works'
@line.sub!(/(^.+)( -- works$)/, peru('\1')+orange('\2'))
else
@line = peru(@line)
end
elsif @line.include?('Leaving directory') or
@line.include?('Entering directory')
leaving_or_entering = 'Leaving' case @line
when /Leaving directory/
use_this_regex = /Leaving directory '(.+)'/
when /Entering directory/
use_this_regex = /Entering directory '(.+)'/
leaving_or_entering = 'Entering'
end
@line.sub!(use_this_regex,
slategray("#{leaving_or_entering} directory '")+
colourize_directory_for_system_results('\\1')+
slategray("'")
)
elsif @line.include?('-- Checking for module ') or
@line.include?('-- Checking for modules ')
use_this_regex = /(-- Checking for modules? ')(.+)'$/
@line.sub!(use_this_regex,
'\\1'+orchid('\\2')+"'"
)
elsif @line.include?('mkdir -p') and (@line.count("'") > 1)
use_this_regex = /^(\s+.+mkdir -p ')(.+)(')/ @line.sub!(
use_this_regex,
lightseagreen('\\1')+
lightslategray('\\2')+
lightseagreen('\\3')
)
elsif @line.include?('-- Build files have been written to: ') or
@line.include?('-- Configuring done') or @line.include?('-- Generating done') if @line.include?('-- Build files have been')
regex_to_use = /(-- Build files have been written to: )(.+)/
@line.sub!(
regex_to_use,
lightgreen('\\1')+
lightslategray('\\2')
)
else
@line = lightgreen(@line) end
elsif @line.start_with?('clang') and
@line.include?('warning: argument unused during compilation:')
use_this_regex = /(clang.+:)( warning: argument unused during compilation:.+)/
@line.sub!(use_this_regex, '\\1'+rosybrown('\\2'))
elsif @line.start_with?(
' GEN ',
' GEN ',
' GUILEC ',
'wrote `',
' CC ',
' BUNZIP2 ',
' XS ',
' BS ',
' BLIB ', ' CHMOD ',
' CP ',
' CCLD ',
' A11Y ',
' NASM ',
' HUGE ',
' CC ',
' AR ',
' [CC] ',
' HOSTCC',
' DOC',
' VDSO2C',
' SYSHDR',
' WRAP',
' GISCAN',
' [LN] ',
' [STRIP] ',
' [PY] ',
' SED',' [HEADERS] ',' SPLIT',' [GENERATE] ',
' CCAS ',
' [TEST] ',
' LN_S ',
' GISCAN ',
' GICOMP ',
' PPFC ',
' FCLD ',
' CPPAS ',
' LTLINK ',
' AR ',
' LD ',
' RANLIB ',
' MSGFMT ',
' ITMRG ',
' INSTALL ',
' SUBDIR',
' GENERATE',
' UIC',
' MOC ',
' HOSTLD',
' SHIPPED',
' PC ',
' [INSTALL] ',
' LINK',
' CHK ',
' DESCEND ',
' CALL ',
' VERT ',
' FRAG ',
' AS ',
' AS [M] ',
' CC [M] ',
' VDSO ',
' LDS ',
' [DEP] ',
' [CC] ',
' [SED] ',
' [DOXY] ',
' [CREATE] ',
' [CXX] ',
' [AR] ',
' [AS] ',
' [LD] ',
' [LD] ',
' [INSTALL] ',
' AR ',
' RANLIB ',
' C++ ',
' LINK ',
' BUILTIN ',
' MSGFMT ',
' LN/CP ',
' (deps) ',
' OBJCOPY ',
' OBJCOPY ',
' CXX',
' YACC',
' SWIG',
' YACC',
' CXX ',
' CXXLD '
)
@line = darkseagreen(@line) elsif (@line.start_with?('installing ') and
(@line =~ /^installing .+ \.\.\./)) or
(@line.start_with?('Installing ') and
@line.include?(' to ')) or
(@line.start_with?('Making directory /')) or
(@line.start_with?('installing ') and
@line.include?(' in /')) or
(@line.include?('Installing ') and @line.include?(' as '))
@line = darkseagreen(@line) elsif @line.start_with?(
' * new build flags',
' * new link flags',
' * new perl-specific parameters',
' * new prefix flags',
' * new script parameters',
'Note: ',
'Creating makefiles for ' )
@line = skyblue(@line) elsif @line.start_with?('config.status')
@line = limegreen(@line)
elsif @line.start_with?('which seems to be undefined. Please make sure it is defined')
@line = limegreen('which seems to be undefined. ')+
crimson('Please make sure it is defined')
end
if @line.start_with?('Scanning dependencies of ') or
@line.start_with?('Generating MOC')
@line = mediumaquamarine(@line)
elsif @line.start_with?('sed -')
@line = skyblue(@line)
elsif @line.start_with?('Building package') or
@line.start_with?('Installing package')
@line = teal(@line)
end
if @line.include? 'The Meson build system'
@line = orchid(@line)
elsif @line.include?('meson.build') and @line.include?('ERROR: Dependency') and
@line.include?('not found')
@line = parse_missing_dependency(@line)
end
if @line.start_with?('gcc -')
use_this_regex = /^(gcc)( -)/
@line.sub!(use_this_regex, orange('\\1')+'\\2')
if @line.include? '-std=gnu++'
use_this_regex = /(.+)(-std=gnu\+\+\d{1,2})(.+)/ @line.sub!(use_this_regex, '\\1'+khaki('\\2')+'\\3')
end
elsif @line.start_with?('g++') or
(@line.include?('g++') and @line.include?('-DHAVE'))
use_this_regex = /^(g\+\+)/
@line.sub!(use_this_regex, orange('\\1'))
elsif @line.start_with?('clang')
use_this_regex = /(clang-?\d?\.?\d?):/
@line.sub!(use_this_regex, orange('\\1')+':')
elsif @line.start_with?('strip:')
use_this_regex = /^(strip):/
@line.sub!(use_this_regex, orange('\\1')+':')
elsif @line.start_with?('ranlib')
use_this_regex = /^(ranlib)/
@line.sub!(use_this_regex, orange('\\1'))
elsif @line.start_with?('chmod')
use_this_regex = /^(chmod)/
@line.sub!(use_this_regex, orange('\\1'))
elsif @line.start_with?('/bin/sh')
@line = paleturquoise(@line)
elsif @line.start_with?('configure: creating ./config.status')
@line = salmon(@line)
end
@line = @line.dup if @line.frozen?
if @line.include? '-fno-strict-overflow'
@line.sub!(
/(-?fno-?strict-?overflow)/, colour_for_warnings_and_errors('\\1')
)
elsif @line.include? 'I/O warning : failed to load external entity'
@line = colour_for_warnings_and_errors(@line)
elsif @line.include? '-- Configuring incomplete, errors occurred!'
@line = colour_for_warnings_and_errors(@line)
elsif @line.include? 'ld: error: cannot find -l'
@line = colour_for_warnings_and_errors(@line)
elsif @line.include? 'fatal: not a'
@line = colour_for_warnings_and_errors(@line)
end
if @line.include? '-Wno-error'
@line.sub!(/(-?Wno-?error)/, colour_for_warnings_and_errors('\\1')+_paleturquoise)
end
if @line.start_with?('rm -f')
@line.sub!(/^rm -f/, colour_for_warnings_and_errors('\\1'))
end
if @line.include?('make') and
@line.include?(':')
use_this_regex = /^(make)(\[\d{1}\])(:)/ @line =~ use_this_regex
@line.sub!(use_this_regex, lightseagreen('\\1')+lightsteelblue('\\2')+('\\3'))
elsif @line.include?('make') and
@line.include?('all-recursive')
@line = lightseagreen(@line)
elsif @line.include?('make') and
@line.include?('all-am') @line = lightseagreen(@line)
elsif @line.include?('Making all in') or
@line.include?('Making install in') or
@line.include?('make install-exec-hook')
@line = lightseagreen(@line)
end
if @line.include?('Nothing to be done for') and
@line.include?('make')
use_this_regex = /( Nothing to be done for ')(.+)'\./
@line.sub!(
use_this_regex,
slategray('\\1')+cadetblue('\\2')+slategray("'.")
)
elsif (@line.include?('installing') and
@line.include?('.gmo '))
use_this_regex = /^(installing .{1,15}\.gmo .+)$/
@line.sub!(use_this_regex, darkcyan('\\1'))
elsif @line.include?('Nothing to be done for')
use_this_regex = /(Nothing to be done for)/
@line.sub!(use_this_regex, darkcyan('\\1'))
end
if @line.include?('install:') and
@line.include?(programs_dir?)
programs_dir = Regexp.quote(programs_dir?)
use_this_regex = /(.+)(#{programs_dir}.+?\/\d{1,3}\.\d{1,3}\.\d{1,3})(.+)/ @line.sub!(use_this_regex,
'\\1'+colourize_directory_for_system_results('\\2')+'\\3')
end
if @line.include?('libtool: compile: gcc -')
use_this_regex = /(gcc)( -)/
@line.sub!(use_this_regex, orange('\\1')+'\\2')
elsif @line.include?('libtool: compile:')
use_this_regex = /(libtool: compile:)/
@line.sub!(use_this_regex, cadetblue('\\1'))
elsif @line.include?('libtool: install: ') or @line.include?('libtool: finish: ') or @line.include?('libtool: link: ') @line = cadetblue(@line)
elsif (@line.include?('libtool: warning: ') and
@line.include?(' seems to be moved'))
@line = colour_for_warning_and_errors(@line)
elsif @line.include?('ERROR: Neither directory contains a build file meson.build.')
@line = colour_for_warning_and_errors(@line)
opne 'An error will be shown next, in red colour (if colours are used).'
opne 'To aid in debugging, the current '\
'working directory is:'
opne sdir(" #{return_pwd}")
elsif @line.include? ".la' "
use_this_regex = /'(.+\.la)'/ @line.sub!(use_this_regex, "'"+lightgreen('\\1')+"'")
end
if @line.include?('See also "') and
@line.include?('CMake') and
@line.include?('.log')
use_this_regex = /(See also ")(.+\.log)(".)/
@line.sub!(use_this_regex, '\\1'+navajowhite('\\2')+'\\3')
end
if (@line.include?("make: *** No rule to make target 'install'. Stop.")) or
(@line.include?("make: *** No targets specified and no makefile found. Stop")) or
(@line.include?('libtool: warning: relinking')) or
(@line.include?('-- The following REQUIRED packages have not been found:')) or
(@line.include?('ImportWarning:') and (@line.include?('.py') )) or
(@line.include?(' from') and @line.include?('import')) or
(@line.include?('.c: At top level:')) or
(@line.include?('.c:') and @line.include?('warning: ') and @line.include?('is deprecated')) or
(@line.include?('.cpp: In member function')) or
(@line.include?('.cpp: In lambda function')) or
(@line.include?(' ^~~~~~~~~~~~~~~~~~~')) or
(@line.include?('cc1:') and @line.include?('warning:')) or (@line.include?('cc1:') and @line.include?('note:')) or
(@line.include?('.la: No such file or directory')) or
(@line.include?('No ') and @line.include?(' localization of ') and @line.include?(' exists; using')) or
(@line.include?('Compilation failed: ') and @line.include?('error')) or (@line.include?('ninja: build stopped: subcommand failed.')) or (@line.include?('UnicodeEncodeError: ')) or (@line.include?(': DeprecationWarning: ')) or
(@line.include?('ResourceWarning: unclosed file')) or
(@line.include?(': warning: ')) or
(@line.include?(".cpp: In static member function '")) or
(@line.include?(": In function '") and @line.include?("':")) or
(@line.include?(' ^~~~~~')) or
(@line.end_with?(' ^')) or
(@line.start_with?('Warn: '))
@line = colour_for_warnings_and_errors(
Colours.remove_escape_sequences(@line)
)
end
if @line.start_with?("Couldn't find include") or
@line.start_with?('configure: error:') or
@line.include?('ld: warning:') or
(@line.include?('fatal error: ') and @line.include?('.h: No such file or directory')) or
(@line.start_with?('sh: ') and @line.include?('configure: No such file or directory'))
@line = colourize_this_error(@line)
elsif @line.include?('A required package was not found') or
@line.include?('-- Configuring incomplete, errors occurred!') or
@line.include?('CMake Error at ') or
@line.include?(' file RENAME failed to rename')
@line = colourize_this_error(@line)
elsif @line.include?('CMake Warning')
@line.sub!(/(CMake Warning)/, colourize_this_warning('\\1'))
elsif @line.include?('-- The following OPTIONAL packages have not been found:') or
@line.include?('-- The following RECOMMENDED packages have not been found:') or
@line.include?('-- The following features have been disabled:')
@line = colourize_this_warning(@line)
elsif @line.include?('config.log')
@line.sub!(/(config\.log)/, sfile('\\1'))
end
if @line.include?('install -c -m') or
@line.include?('install -c ./') or
@line.include?('install -c ') or
@line.include?('mkdir -p ') or
@line.include?('ln -s -f')
@line = lightseagreen(@line)
elsif @line.include?('CSC [basic]') or @line.include?(' [build-linux] ') @line = lightseagreen(@line)
elsif @line.start_with?('WARNING: ') or
@line.start_with?(' ^~~~~~~~~~~~~~~~~~~~~~~~')
@line = colourize_for_warnings(@line)
elsif @line.include?('Updating Gtk icon cache.')
@line = gray(@line)
elsif @line.include?('Libraries have been installed in:')
@line = lightsteelblue(@line)
elsif @line.include?('-- The following RUNTIME packages have been found:') or
@line.include?('-- The following OPTIONAL packages have been found:') or
@line.include?('-- The following REQUIRED packages have been found:') or
@line.include?('-- The following RECOMMENDED packages have been found:')
@line = skyblue(@line)
elsif @line.include?('-- Looking for include file') and
@line.include?(' - found') use_this_regex = /(-- Looking for include file )(.+.h)( - )([a-z]+)/ @line.gsub!(
use_this_regex, '\1'+cadetblue('\2')+'\3'+colour_for_found('\4')
)
elsif @line.include?('-- Looking for include file') and
!@line.include?(' - found') use_this_regex = /(-- Looking for include file )(.+.h)/ @line.gsub!(
use_this_regex, '\1'+cadetblue('\2')
)
elsif @line.include?('-- Looking for ')
use_this_regex = /^(-- Looking for )(\w+)$/ if stripped_line.end_with?(' - found')
@line.sub!(/(found)$/, colour_for_found('\1'))
end
@line.gsub!(
use_this_regex, '\1'+cadetblue('\2')
)
elsif @line.include?('Build Configuration:')
@line = orchid(@line)
elsif @line.end_with?(' - found')
@line.sub!(/(found)$/, colour_for_found('\1'))
elsif File.directory?(stripped_line)
@line = sdir(stripped_line)
end
return @line end
|
#set_line(i = '') ⇒ Object
Also known as:
grab_this_line
59
60
61
62
63
64
65
|
# File 'lib/rbt/misc/colourize_parser.rb', line 59
def set_line(i = '')
i = i.first if i.is_a? Array
i = i.to_s.dup.chomp @line = i
sanitize_line if use_colours?
return @line
end
|