Class: AsciiParadise::Flexbox

Inherits:
Base
  • Object
show all
Defined in:
lib/ascii_paradise/flexbox/flexbox.rb

Overview

AsciiParadise::Flexbox

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
UNICODE_SYMBOL_TO_USE_FOR_THE_TOP_LEFT_AREA =
#

UNICODE_SYMBOL_TO_USE_FOR_THE_TOP_LEFT_AREA

This emoji provides some little “graphical” modification to the flexbox title.

#
'✨️'
COLOUR_FOR_THE_TITLE =
#

COLOUR_FOR_THE_TITLE

#
:mediumturquoise
TEST_INPUT =
#

TEST_INPUT

This is simply a hardcoded String that can be used to quickly test the Flexbox, without depending on an external project, such as the “rbt” gem.

#
'Compiling this program:       | htop                                                   |
Assumed Operating System:     | Windows                                                |
Prefix:                       | /home/Programs/Htop/2.2.0/                             |
Program version:              | 2.2.0                                                  |
Program path:                 | /home/x/src/htop/htop-2.2.0.tar.xz                     |
Will be extracted towards:    | /home/Temp/rbt/htop-2.2.0/                             |
Keep the archive extracted:   | Yes.                                                   |
Will ccache be used:          | No.                                                    |
CFLAGS in use:                | -O2 -fPIC -fno-strict-overflow -Wno-error              |
Use a build directory:        | Yes, at                                                |
configure options:            | --disable-unicode                                      |
Host architecture in use:     | x86_64                                                 |
Build system to be used:      | :infer_automatically                                   |
Compiler to be used:          | gcc                                                    |
URL to the source archive:    | http://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz |
Homepage:                     | http://hisham.hm/htop/                                 |'
MAX_VALUE_FOR_PADDING =
#

MAX_VALUE_FOR_PADDING

#
100
N_LEFT_PAD_FOR_THE_RBT_PROJECT =
#

N_LEFT_PAD_FOR_THE_RBT_PROJECT

#
27
N_RIGHT_PAD_FOR_THE_RBT_PROJECT =
#

N_RIGHT_PAD_FOR_THE_RBT_PROJECT

This should be sufficiently large to accomodate different remote URL entries.

#
78
TRY_TO_USE_UNICODE_SYMBOLS_FOR_THE_COMMANDLINE_USER_INTERFACE =
#

TRY_TO_USE_UNICODE_SYMBOLS_FOR_THE_COMMANDLINE_USER_INTERFACE

If the following constant is set to true then the Flexbox will try to use Unicode symbols for the commandline interface. This may look nicer, depending on the terminal and encoding in use.

#
true
SHOW_REMOTE_URLS_BY_DEFAULT =
#

SHOW_REMOTE_URLS_BY_DEFAULT

If this constant is set to true then the Flexbox will also try to show the two entries “url1” and “homepage”, if these are available.

#
true
VERTICAL_ASCII_BAR =
#

VERTICAL_ASCII_BAR

#
'|'
DEFAULT_COLOURS_FOR_RBT =
#

DEFAULT_COLOURS_FOR_RBT

This constant can be used to notify the default colours for the Flexbox to use.

#
{
  default_colour:                :steelblue, # ← The default colour comes first.
  default_colour_for_the_border: :slateblue, # ← The default colour for the border.
  required_dependencies_on:      :olivedrab,
  will_be_extracted_towards:     :mediumslateblue,
  url1:                          :mediumpurple,
  homepage:                      :lightseagreen, # :mediumpurple,
  compiler_to_be_used:           :mediumpurple,
  parameters_for_make:           :seagreen,
  build_system_to_be_used:       :seagreen
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

animation_dir?, #animation_directory?, #clear_screen, #colour_parse_this_string, #debug?, #do_not_run_already, #do_not_use_clear, #do_use_random_colour, #do_wait_for_keypress_event, e, #e, #enable_debug, #is_animated?, #project_base_dir?, #register_sigint, #remove_trailing_ansci_escape_code, #report_how_many_animated_components_exist, #return_basename_of_this_file_without_the_extension, #return_random_colour, #royalblue, run, #set_use_this_colour, #sfancy, #sfile, #show_available_components, #show_help, #simp, #slategrey, #sort_files, #static_dir?, #steelblue, #swarn

Constructor Details

#initialize(commandline_arguments = nil, run_already = true, &block) ⇒ Flexbox

#

initialize

#


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
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 136

def initialize(
    commandline_arguments = nil,
    run_already           = true,
    &block
  )
  try_to_require_external_dependencies # Must come early.
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  case run_already
  when :do_not_run_yet
    run_already = false
  end
  # ======================================================================= #
  # === Handle blocks given next
  # ======================================================================= #
  if block_given?
    yielded = yield
    if yielded.is_a? Hash
      # =================================================================== #
      # === :show_required_dependencies_on
      #
      # This entry point allows us to specify the dependencies to be
      # used.
      # =================================================================== #
      if yielded.has_key? :show_required_dependencies_on
        set_show_required_dependencies(
          yielded[:show_required_dependencies_on]
        )
      end
      # =================================================================== #
      # === :use_this_dataset
      # =================================================================== #
      if yielded.has_key? :use_this_dataset
        set_use_this_as_dataset(
          yielded[:use_this_dataset]
        )
      end
      # =================================================================== #
      # === :do_what
      # =================================================================== #
      if yielded.has_key? :do_what
        set_do_what(
          yielded[:do_what]
        )
      end
      # =================================================================== #
      # === :use_colours
      # =================================================================== #
      if yielded.has_key? :use_colours
        @use_colours = yielded[:use_colours]
      end
      # =================================================================== #
      # === :use_this_dataset
      # =================================================================== #
      if yielded.has_key? :use_this_dataset
        _ = yielded[:use_this_dataset]
        prepare_the_compile_dataset(_)
      end
    end
  end
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

AsciiParadise::Flexbox[]

#


759
760
761
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 759

def self.[](i = '')
  new(i)
end

Instance Method Details

#add_this_to_the_right_padding(i) ⇒ Object Also known as: add_this_number_to_right_just

#

add_this_to_the_right_padding

#


449
450
451
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 449

def add_this_to_the_right_padding(i)
  @n_right_pad += i
end

#autoexpandObject

#

autoexpand (auto tag, autoexpand tag)

This method will try to automatically expand the left-pad and right-pad values if any individual entry is “too long”. It thus exists mostly as a convenience feature.

#


727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 727

def autoexpand
  # ======================================================================= #
  # (1) First, handle the left side properly and correctly. We must find
  #     the largest element.
  # ======================================================================= #
  left_side = @hash[:left_side]
  max_n_left = left_side.map {|entry| entry.size }.max.to_i
  if max_n_left > left_pad?
    set_left_padding(max_n_left)
  end
  # ======================================================================= #
  # (2) Next, handle the right side properly and correctly. We must
  #     find the largest element.
  # ======================================================================= #
  right_side = @hash[:right_side]
  max_n_right = right_side.map {|entry| entry.to_s.size }.max.to_i
  if max_n_right > right_pad?
    set_right_padding(max_n_right+1)
  end
end

#blfs?Boolean Also known as: blfs_entry?

#

blfs?

#

Returns:

  • (Boolean)


880
881
882
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 880

def blfs?
  @compile_dataset.send(__method__) if @compile_dataset.respond_to?(__method__)
end

#bottom_eclinerObject

#

bottom_ecliner

#


617
618
619
620
621
622
623
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 617

def bottom_ecliner
  result = cliner { :bottom }
  if colourize_border?
    result = Colours.send(@use_this_colour_for_the_border, result)
  end
  e " #{result}"
end

#clear_hashObject

#

clear_hash

#


715
716
717
718
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 715

def clear_hash
  @hash[:left_side].clear
  @hash[:right_side].clear
end

#cliner(use_n_tokens = :default, use_this_token = :infer) ⇒ Object

#

cliner (cliner tag)

Specialized cliner-variant. It also responds to certain block arguments such as :top or :bottom.

#


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
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 502

def cliner(
    use_n_tokens   = :default,
    use_this_token = :infer
  )
  case use_n_tokens
  when :default
    use_n_tokens = return_combined_value_from_both_padding_values
  end
  case use_this_token
  when :infer
    if really_use_unicode?
      use_this_token = Roebe.horizontal_block
    else
      use_this_token = '-'
    end
  end
  result = use_this_token * use_n_tokens
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :middle
    # ===================================================================== #
    when :middle
      result[0,1] = @vertical
      result << @vertical
      # =================================================================== #
      # And change the "centerpiece" too:
      # =================================================================== #
      result[left_pad?+3,1] = @vertical
    # ===================================================================== #
    # === :top
    # ===================================================================== #
    when :top
      result[0,1] = Roebe.top_left_corner
      result << Roebe.top_right_corner.dup
      # =================================================================== #
      # And change the "centerpiece" too:
      # =================================================================== #
      result[left_pad?+3,1] = Roebe.centerpiece_and_down
    # ===================================================================== #
    # === :bottom
    # ===================================================================== #
    when :bottom
      result[0,1] = Roebe.bottom_left_corner
      result << Roebe.bottom_right_corner.dup
      # =================================================================== #
      # And change the "centerpiece" too:
      # =================================================================== #
      result[left_pad?+3,1] = Roebe.centerpiece_and_up
    end
  end
  result
end

#colourize_border(use_this_colour = :default) ⇒ Object Also known as: set_border_colour

#

colourize_border

This method can be used to colourize the border.

#


335
336
337
338
339
340
341
342
343
344
345
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 335

def colourize_border(
    use_this_colour = :default
  )
  case use_this_colour
  when :default
    use_this_colour = DEFAULT_COLOURS_FOR_RBT[:default_colour_for_the_border]
  when :none
    use_this_colour = nil
  end
  @use_this_colour_for_the_border = use_this_colour
end

#colourize_border?Boolean

#

colourize_border

This method will return true if we shall colourize the border.

#

Returns:

  • (Boolean)


778
779
780
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 778

def colourize_border?
  @use_colours and @use_this_colour_for_the_border
end

#colourize_right_side_with_these_colours(*i) ⇒ Object

#

colourize_right_side_with_these_colours

This method can be used to colourize the right-hand side of the table via a specific colour. This is currently simply a hardcoded Array. Perhaps one day we should transition into a Hash, but Arrays are simpler to use so we will stick with them for now.

If you wish to use the default colours here, use this:

colourize_right_side_with_these_colours :default
#


813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 813

def colourize_right_side_with_these_colours(*i)
  i.flatten!
  if i.flatten.first == :default
    i = %i(
          cadetblue
          mediumslateblue
          paleturquoise
          steelblue
          slateblue
          steelblue
          royalblue
          orchid
          steelblue
          royalblue
          steelblue
          steelblue
          mediumseagreen
          steelblue
          steelblue
          steelblue
          steelblue
          violet
        )
  end
  @array_colourize_right_side_with_these_colours = i
end

#colourize_this_in_that_colour(this, that_colour = @use_this_colour_for_the_border) ⇒ Object

#

colourize_this_in_that_colour

The default colour will be the colour used for the border, if otherwise not specified.

#


314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 314

def colourize_this_in_that_colour(
    this,
    that_colour = @use_this_colour_for_the_border
  )
  case that_colour
  when nil, :default # This was added in October 2022, as a tiny safeguard.
    that_colour = @use_this_colour_for_the_border
  end
  if this and this.include? 'No CFLAGS in use.'
    that_colour = :crimson # Use another colour in this case.
  end
  if that_colour and this
    Colours::HtmlColoursMethods.send(that_colour, this)
  end
end

#colourize_this_via_the_default_border_colour(i) ⇒ Object

#

colourize_this_via_the_default_border_colour

#


350
351
352
353
354
355
356
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 350

def colourize_this_via_the_default_border_colour(i)
  if @use_colours and @use_this_colour_for_the_border
    return colourize_this_in_that_colour(i, @use_this_colour_for_the_border)
  else
    return i
  end
end

#colourized_verbose_truth(i) ⇒ Object

#

colourized_verbose_truth

#


361
362
363
364
365
366
367
368
369
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 361

def colourized_verbose_truth(i)
  _ = verbose_truth(i)
  case _
  when /^No./
    return mediumorchid(_)
  when /^Yes./
    return royalblue(_)
  end
end

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


492
493
494
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 492

def commandline_arguments?
  @commandline_arguments
end

#compile_dataset?Boolean Also known as: cookbook_dataset?, dataset?

#

compile_dataset?

#

Returns:

  • (Boolean)


1324
1325
1326
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1324

def compile_dataset?
  @compile_dataset
end

#compile_this_program?Boolean Also known as: input?

#

compile_this_program?

#

Returns:

  • (Boolean)


950
951
952
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 950

def compile_this_program?
  @compile_this_program
end

#compiler_to_use?Boolean

#

compiler_to_use?

#

Returns:

  • (Boolean)


936
937
938
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 936

def compiler_to_use?
  @compile_dataset.send(__method__).to_s
end

#content?Boolean

#

content?

Show the original content.

#

Returns:

  • (Boolean)


383
384
385
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 383

def content?
  [@hash[:left_side], @hash[:right_side]]
end

#disable_coloursObject

#

disable_colours

#


785
786
787
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 785

def disable_colours
  @use_colours = false
end

#displayObject Also known as: show

#

display (display tag, report tag)

This is the method that will display the content of the flexbox-table.

You can style the colour of the border in one method call, such as by using:

flexbox.display {{ border: :steelblue }}

To not use any border-colouring, use this:

flexbox.display {{ border: :none }}
#


1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1378

def display
  left_pad     = left_pad?
  right_pad    = right_pad?
  vertical_bar = vertical_bar?
  use_colours = use_colours?
  if block_given?
    yielded = yield
    if yielded.is_a? Hash
      # =================================================================== #
      # === :border
      # =================================================================== #
      if yielded.has_key? :border
        set_border_colour(
          yielded.delete(:border)
        )
      end
    end
  end
  # ======================================================================= #
  # First display the top-cliner:
  # ======================================================================= #
  top_ecliner
  right_side = right_side?
  middle_ecliner
  _return_potentially_colourized_vertical_token = return_potentially_colourized_vertical_token
  # ======================================================================= #
  # Display the content next by iterating through the left-side of the
  # main (data) hash.
  # ======================================================================= #
  left_side?.each_with_index {|left_side_content, index|
    # ===================================================================== #
    # Build up our result-string next. This one will be shown to the user.
    # ===================================================================== #
    result = ' '.dup
    result << _return_potentially_colourized_vertical_token
    result << " #{rev}#{left_side_content.to_s.ljust(@n_left_pad)} "
    # ===================================================================== #
    # Obtain a reference to the right-side "content".
    # ===================================================================== #
    right_side_content = right_side[index].to_s
    # ===================================================================== #
    # Modify the required-dependencies via a leading right-side arrow next.
    # ===================================================================== #
    case left_side_content
    when /^Required dependencies on/
      right_side_content.prepend('')
    end
    if right_side_content.size > right_pad
      # =================================================================== #
      # Do some padding then. This is typically done for the entry
      # "configure options", since that may become very long.
      # =================================================================== #
      splitted = ::AsciiParadise.wrap_at(right_side_content, 56).split("\n")
      # =================================================================== #
      # The variable splitted may now look like this:
      #
      #   ["--enable-gnutls --enable-gpl --enable-libmp3lame",
      #
      # In that case, if it has at the least two entries that begin with
      # -- we will split it up further.
      # =================================================================== #
      if !splitted.empty? and splitted.first and (splitted.first.count('--') > 1)
        splitted = splitted.map {|inner_entry|
          if inner_entry.include?('--')
            inner_entry = inner_entry.split('--').map {|most_inner_entry|
              "--#{most_inner_entry.strip}"
            }.reject {|entry| entry == '--' }
          end
          inner_entry
        }.flatten
      end
      index = 0
      # =================================================================== #
      # splitted is an Array - and we have 3 different paths to proceed
      # from here, past this point.
      # =================================================================== #
      splitted.map! {|yet_another_entry| index += 1
        if index == 1
          # =============================================================== #
          # All entries with exactly one member: these are the default and
          # most commonly seen variants. So we handle that case first.
          # =============================================================== #
          "#{yet_another_entry.strip.ljust(@n_right_pad)}#{vertical_bar}\n"
        elsif index == splitted.size
          # =============================================================== #
          # This variant will NOT append a vertical bar.
          # =============================================================== #
          ' '+vertical_bar+(' ' * (left_pad+2))+vertical_bar+' '+
           yet_another_entry.strip.ljust(@n_right_pad)+"\n"
        else
          # =============================================================== #
          # This variant will append a vertical_bar. It is for e. g.
          # long configure_options entries, such as for "glibc".
          # =============================================================== #
          ' '+vertical_bar+(' ' * (left_pad+2))+vertical_bar+' '+
           yet_another_entry.strip.ljust(@n_right_pad)+
           vertical_bar+
           "\n"
        end
      }
      right_side_content = splitted.join
      right_side_content_properly_padded = right_side_content.chomp
    else
      right_side_content_properly_padded = right_side_content.ljust(@n_right_pad)
    end
    result << _return_potentially_colourized_vertical_token
    # ===================================================================== #
    # Next colourize the right-hand side of the table:
    # ===================================================================== #
    if use_colours and !@array_colourize_right_side_with_these_colours.empty?
      case left_side_content
      # =================================================================== #
      # === Required dependencies on
      # =================================================================== #
      when 'Required dependencies on:'
        right_side_content_properly_padded = tomato(right_side_content_properly_padded)
      # =================================================================== #
      # === Program path
      # =================================================================== #
      when 'Program path:'
        # ================================================================= #
        # Split up the program path and colourize is a bit. The second
        # argument given to colourize_this_in_that_colour() must be
        # an existing value, defaulting towards the content of
        # @use_this_colour_for_the_border.
        # ================================================================= #
        _ = right_side_content_properly_padded.split('/')
        right_side_content_properly_padded = colourize_this_in_that_colour(
          _[0 .. -2].join('/')+'/',
          @array_colourize_right_side_with_these_colours[index]
        )+royalblue(_.last)
      else
        that_colour = @array_colourize_right_side_with_these_colours[index]
        right_side_content_properly_padded = colourize_this_in_that_colour(
          right_side_content_properly_padded,
          that_colour
        )
      end
    end
    result << ' '+
              right_side_content_properly_padded.to_s # ← Add the right side next.
    result << _return_potentially_colourized_vertical_token
    e result
  }
  middle_ecliner
  bottom_ecliner
end

#do_what=(i = 'Compiling') ⇒ Object

#

do_what=

This method can be used to determine which action is to be done.

Available actions are:

- compiling
- extracting
- installing
#


680
681
682
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 680

def do_what=(i = 'Compiling')
  @do_this_action = i
end

#does_the_program_have_to_be_compiled?Boolean

#

does_the_program_have_to_be_compiled?

#

Returns:

  • (Boolean)


866
867
868
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 866

def does_the_program_have_to_be_compiled?
  @compile_dataset.send(__method__)
end

#eclinerObject

#

ecliner

#


628
629
630
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 628

def ecliner
  e cliner
end

#empty?Boolean

#

empty?

This method will determine whether the Flexbox is empty or not, that is whether it contains data or whether it currently holds no data.

#

Returns:

  • (Boolean)


393
394
395
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 393

def empty?
  @hash[:left_side].empty? and @hash[:right_side].empty?
end

#enable_rbt_specific_behaviourObject

#

enable_rbt_specific_behaviour

#


986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 986

def enable_rbt_specific_behaviour
  # ======================================================================= #
  # Do not autoexpand the Flexbox when we display data from the RBT
  # project.
  # ======================================================================= #
  @shall_we_autoexpand = false
  # ======================================================================= #
  # Set the proper values for the RBT project.
  # ======================================================================= #
  set_proper_padding_for_the_rbt_project
  # use_this_title = "#{UNICODE_SYMBOL_TO_USE_FOR_THE_TOP_LEFT_AREA} Infobox"
  use_this_title = "Infobox"
  set_title(use_this_title)
  # ======================================================================= #
  # Obtain a handle to the compile-dataset next.
  # ======================================================================= #
  dataset = compile_dataset?
  return if dataset.nil?
  array = []
  @do_this_action = if extract_only?
                      'Extracting'
                    elsif has_to_be_compiled?
                      'Compiling'
                    else
                      'Installing'
                    end
  # ======================================================================= #
  # === Compiling (or installing or extracting) this program:
  #
  # Note that the display-string can be different, e. g. such as
  # in "Installing this program" instead.
  # ======================================================================= #
  array << "#{extracting_compiling_or_installing?} this program:"
  array << dataset.query_for(array.last)
  # ======================================================================= #
  # === Assumed Operating System:
  # ======================================================================= #
  array << "Assumed Operating System:"
  array << dataset.query_for(array.last)
  # ======================================================================= #
  # === Prefix:
  #
  # Show the prefix in use, but not if it is a .gem file.
  # ======================================================================= #
  unless is_it_a_gem?
    array << 'Prefix:'
    array << dataset.query_for(array.last)
  end if program_path?
  # ======================================================================= #
  # === Program version:
  # ======================================================================= #
  array << 'Program version:'
  array << dataset.query_for(array.last)
  # ======================================================================= #
  # === Program path:
  # ======================================================================= #
  array << 'Program path:'
  array << dataset.query_for(array.last)
  # ======================================================================= #
  # === configure options:
  #
  # These will only be shown when not empty. Since as of 24.10.2022
  # we will default to showing one row per configure option. 
  # ======================================================================= #
  configure_options = return_configure_options_or_meson_options_or_no_options
  unless configure_options.empty?
    array << 'configure options:'
    array << configure_options
  end if configure_options
  # ======================================================================= #
  # === Will be extracted towards:
  #
  # Note that this must show the FULL path to the extracted target,
  # not just the base directory.
  # ======================================================================= #
  array << 'Will be extracted towards:'
  array << extract_to_which_directory?.to_s
  # ======================================================================= #
  # === Keep the archive extracted:
  #
  # This information is not shown if we work on a .gem file, though.
  # ======================================================================= #
  unless is_it_a_gem?
    array << 'Keep the archive extracted:'
    array << keep_the_extracted_archive?
  end
  # ======================================================================= #
  # === Will ccache be used:
  #
  # This entry point will show whether ccache will be used or whether
  # it will not be used.
  # ======================================================================= #
  array << 'Will ccache be used:'
  array << dataset.query_for(array.last)
  # ======================================================================= #
  # === Compiler to be used:
  #
  # This will show the compiler that is to be used in the current run.
  # It only makes sense to display these if the program at hand has to
  # be compiled, though; so we will first check for that via the 
  # following code.
  #
  # This should come before "CFLAGS in use".
  # ======================================================================= #
  if does_the_program_have_to_be_compiled?
    array << 'Compiler to be used:'
    array << compiler_to_use?
  end
  # ======================================================================= #
  # === CFLAGS in use:
  #
  # These will only be shown if the program at hand has to be compiled,
  # as otherwise they do not appear to be relevant for programs that
  # are NOT to be compiled.
  # ======================================================================= #
  if does_the_program_have_to_be_compiled?
    array << 'CFLAGS in use:'
    array << dataset.query_for(array.last)
  end
  # ======================================================================= #
  # === Show if we try to use a static build
  #
  # This should come shortly before the display of the build-directory.
  # ======================================================================= #
  if dataset.build_static?
    array << 'Compile statically:'
    array << "#{vt(dataset.build_static?.to_s)}."
  end
  # ======================================================================= #
  # === Query whether we will use a build directory or whether we will not:
  #
  # We will also show the path to it IF it exists. If the path to the
  # build directory does NOT exist then we will not shown it, logically.
  # ======================================================================= #
  array << 'Use a build directory:'
  _ = dataset.query_for(array.last)
  if _
    _ = "#{verbose_truth(_.to_s)}, at #{build_directory?}"
  elsif _.is_a? FalseClass
    _ = verbose_truth(_.to_s)+'.'
  end
  array << _
  # ======================================================================= #
  # === Display preinstallation steps, but only if this entry exists
  # ======================================================================= #
  preinstall = preinstall?
  if preinstall and preinstall.is_a?(Array) and !preinstall.empty?
    array << 'Preinstallation action:'
    _ = preinstall.join(', ').strip
    _.chop! if _.end_with? ','
    array << _
  end
  # ======================================================================= #
  # === Display postinstallation steps, but only if this entry exists
  #
  # This entry point will query whether postinstallation steps are
  # used by the program at hand. If so then it will be displayed;
  # otherwise we will not display it. (Most programs do not have a
  # post-installation step, so nothing will be shown normally in
  # these cases.)
  # ======================================================================= #
  postinstall = postinstall?
  if postinstall and postinstall.is_a?(Array) and !postinstall.empty?
    array << 'Postinstallation action:'
    _ = postinstall.join(', ').strip
    _.chop! if _.end_with? ','
    array << _
  end
  # ======================================================================= #
  # === Host architecture in use:
  #
  # Display the x86 or x64 type of the computer at hand.
  #
  # This is put right before the required dependencies and autogen.
  # ======================================================================= #
  array << 'Host architecture in use'
  array << host_architecture?
  # ======================================================================= #
  # === Show whether we will use autogen, but only if we really do
  #
  # This should come after the required-dependencies and the host
  # architecture in user, but before the build system in use.
  # ======================================================================= #
  use_autogen = use_autogen?
  if use_autogen
    array << 'Use autogen:'
    array << "#{verbose_truth(use_autogen)}."
  end
  # ======================================================================= #
  # === Build system to be used:
  #
  # We need to do an additional check here, since there are situations
  # where the .yml file at hand may have a "run_configure: no" entry,
  # so it makes no sense to insinuate that the build system type is
  # based on configure.
  # ======================================================================= #
  array << 'Build system to be used:'
  use_this_build_system = use_which_build_system?
  if (run_configure? == false) and (use_this_build_system == 'configure')
    # ===================================================================== #
    # In this case the program does not use configure at all, so it
    # does not make a whole lot of sense to insinuate that 'configure'
    # is used, naturally, as that option was specifically disabled,
    # e. g. through the corresponding .yml file.
    # ===================================================================== #
    use_this_build_system = '(unknown / unspecified)'
  end
  array << use_this_build_system
  # ======================================================================= #
  # === Parameters for make
  #
  # These come right before "Compiler to be used".
  # ======================================================================= #
  parameters_to_make = parameters_to_make?
  if parameters_to_make.respond_to? :reject
    unless parameters_to_make.reject {|entry| entry.nil? or entry.empty? }.empty?
      joined = parameters_to_make
      if joined.is_a? Array
        joined = joined.join(',').strip
      end
      joined.chop! if joined.end_with? ','
      array << 'Parameters for make:'
      array << parameters_to_make # :seagreen
    end
  end
  array << 'Type in use:'
  array << type_in_use?
  # ======================================================================= #
  # Show the remote URLs but only if this functionality has been enabled.
  # ======================================================================= #
  if @show_remote_urls
    # ===================================================================== #
    # === URL to the source archive:
    #
    # This entry point is also called "url1".
    # ===================================================================== #
    url1 = url1?
    if url1 and ((url1.size+1) > right_padding_size?)
      add_n = ( url1.size - right_padding_size? )+1
      if (add_n + right_padding?) > MAX_VALUE_FOR_PADDING
        add_n = (MAX_VALUE_FOR_PADDING - right_padding?) - 1
      end
      add_this_to_the_right_padding(
        add_n
      )
    end
    array << 'URL to the source archive:'
    array << url1
    # ===================================================================== #
    # Next, add the BLFS entry, should it exist:
    # ===================================================================== #
    blfs_URL = blfs?
    if blfs_URL and !blfs_URL.empty?
      array << 'BLFS entry:'
      array << blfs_URL
    end
    # ===================================================================== #
    # === Then finally add the homepage:
    #
    # If the homepage entry does not exist we will show this as well.
    # ===================================================================== #
    value_for_the_homepage_entry = dataset.query_for('Homepage:')
    if value_for_the_homepage_entry and !value_for_the_homepage_entry.empty?
      array << 'Homepage:'
      homepage = value_for_the_homepage_entry
      if homepage.nil? or homepage.empty?
        homepage = '[No homepage entry has been registered for this program.]'
      end
      array << homepage
    end
  end
  # ======================================================================= #
  # === Handle the required dependencies next
  #
  # This entry-point should come right after the host architecture, and
  # is optional. Since as of November 2020 the entry is now shown
  # after the homepage is displayed.
  #
  # The instance variable @show_required_dependencies determines
  # whether we will show the required dependencies.
  # ======================================================================= #
  if @show_required_dependencies
    _ = 'Required dependencies on:'
    deps = dataset.query_for(_)
    if deps and !deps.empty?
      array << _
      if deps.respond_to? :join
        array << deps.join(', ').strip.to_s
      end
    end
  end
  fill_with_this_array(array) # This array was built up within this method.
  use_default_colour_for_the_border
  colourize_right_side_with_these_colours :default
  sanitize_right_side
end

#extract_only?Boolean

#

extract_only?

#

Returns:

  • (Boolean)


1308
1309
1310
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1308

def extract_only?
  @compile_dataset.send(__method__)
end

#extract_to_which_directory?Boolean Also known as: extract_to?, extracted_towards?, extract_to_this_directory?

#

extract_to_which_directory?

#

Returns:

  • (Boolean)


1602
1603
1604
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1602

def extract_to_which_directory?
  @compile_dataset.query_for(__method__)
end

#extracting_compiling_or_installing?Boolean Also known as: extracting_compiling_or_installing

#

extracting_compiling_or_installing?

This method will return one of three possible, different strings.

#

Returns:

  • (Boolean)


664
665
666
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 664

def extracting_compiling_or_installing?
  @do_this_action
end

#fill_the_table(i) ⇒ Object Also known as: fill, fill_with_this_array, <<

#

fill_the_table (fill tag)

The input to this method should be an Array.

This is the main “fill” method for passing data into the flexbox-table.

The input can be a String as well, in which case this method may process the input String and turn it into an Array.

#


1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1543

def fill_the_table(i)
  clear_hash # We will always reset the main hash when invoking this method.
  # ======================================================================= #
  # === Transform Strings given next
  # ======================================================================= #
  if i.is_a?(String) and
     (i.count("\n") > 1) and # Has at the least two newlines.
     i.include?(VERTICAL_ASCII_BAR) # And has at the least one '|' token.
    i = i.split(VERTICAL_ASCII_BAR).map {|entry| entry.strip }
  end
  even = i.select.with_index { |_, entry| entry.even? }
  odd  = i.select.with_index { |_, entry| entry.odd? }
  # ======================================================================= #
  # Push it into the main-hash next:
  # ======================================================================= #
  @hash[:left_side]  << even
  @hash[:right_side] << odd
  flatten_the_main_hash
  autoexpand if @shall_we_autoexpand
end

#flatten_the_main_hashObject

#

flatten_the_main_hash

#


441
442
443
444
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 441

def flatten_the_main_hash
  @hash[:left_side].flatten!
  @hash[:right_side].flatten!
end

#has_to_be_compiled?Boolean

#

has_to_be_compiled?

#

Returns:

  • (Boolean)


922
923
924
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 922

def has_to_be_compiled?
  @compile_dataset.send(__method__)
end

#host_architecture?Boolean

#

host_architecture?

#

Returns:

  • (Boolean)


901
902
903
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 901

def host_architecture?
  @compile_dataset.send(__method__)
end

#is_it_a_gem?Boolean

#

is_it_a_gem?

#

Returns:

  • (Boolean)


943
944
945
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 943

def is_it_a_gem?
  program_path? and program_path?.end_with?('.gem')
end

#keep_the_extracted_archive?Boolean Also known as: keep_extracted?

#

keep_the_extracted_archive?

#

Returns:

  • (Boolean)


915
916
917
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 915

def keep_the_extracted_archive?
  @compile_dataset.send(__method__)
end

#left_pad?Boolean

#

left_pad?

#

Returns:

  • (Boolean)


687
688
689
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 687

def left_pad?
  @n_left_pad
end

#left_side?Boolean

#

left_side?

#

Returns:

  • (Boolean)


1529
1530
1531
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1529

def left_side?
  @hash[:left_side]
end

#location_to_the_build_directory?Boolean Also known as: build_directory?

#

location_to_the_build_directory?

#

Returns:

  • (Boolean)


843
844
845
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 843

def location_to_the_build_directory?
  @compile_dataset.send(__method__)
end
#

menu (menu tag)

#


1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1332

def menu(
    i = @commandline_arguments
  )
  if i.is_a? Array
    i.each {|entry| menu(entry) }
  else
    if Object.const_defined?(:RBT) and
       (
         RBT.const_defined?(:Installer) or
         RBT.const_defined?(:Compile)
       )
      # =================================================================== #
      # Delegate to enable RBT support next.
      # =================================================================== #
      prepare_the_flexbox_for_displaying_this_program(i)
    end
  end
end

#middle_eclinerObject

#

middle_ecliner

#


560
561
562
563
564
565
566
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 560

def middle_ecliner
  result = cliner(:default, ' ') { :middle }
  if colourize_border?
    result = Colours::HtmlColoursMethods.send(@use_this_colour_for_the_border, result)
  end
  e " #{result}"
end

#parameters_to_make?Boolean

#

parameters_to_make?

#

Returns:

  • (Boolean)


971
972
973
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 971

def parameters_to_make?
  @compile_dataset.parameters_to_make?
end

#postinstall?Boolean

#

postinstall?

Note that this will typically be an Array.

#

Returns:

  • (Boolean)


859
860
861
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 859

def postinstall?
  @compile_dataset.send(__method__)
end

#preinstall?Boolean

#

preinstall?

#

Returns:

  • (Boolean)


850
851
852
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 850

def preinstall?
  @compile_dataset.send(__method__)
end

#prepare_the_compile_dataset(i = @compile_this_program) ⇒ Object Also known as: set_use_this_as_dataset

#

prepare_the_compile_dataset

This very important method will initialize the @compile_dataset object. This dataset is the one that will be displayed by class Flexbox ultimately.

#


1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1573

def prepare_the_compile_dataset(
    i = @compile_this_program
  )
  # ======================================================================= #
  # First check if the input is a RBT::Installer class.
  # ======================================================================= #
  if Object.const_defined?(:RBT) # and
    # (i.is_a?(RBT::Installer) || i.is_a?(RBT::Installer))
    @compile_dataset = i.dup
    enable_rbt_specific_behaviour
  elsif i.is_a?(String) and RBT.is_this_program_included?(i)
    @compile_dataset = RBT::Installer.new(i) { :do_not_run_yet }
  elsif i.is_a?(String) # Bit pointless checks but still.
    # ===================================================================== #
    # Turn strings into the corresponding dataset.
    # ===================================================================== #
    i = RBT::Cookbooks::SanitizeCookbook.new(i)
  else
    if i
      @compile_dataset = i
    else
      e "Unhandled state: #{i}"
    end
  end
end

#prepare_the_flexbox_for_displaying_this_program(i) ⇒ Object

#

prepare_the_flexbox_for_displaying_this_program

This method can be used to prepare data fed into the Flexbox from the RBT project, for display purposes on the commandline. This data may typically describe how a certain application is to be installed/compiled.

In fact - this was the primary use case for creating the Flexbox class to begin with.

#


1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1294

def prepare_the_flexbox_for_displaying_this_program(i)
  # ======================================================================= #
  # This entry point here is for displaying the dataset from the RBT 
  # project.
  # ======================================================================= #
  require 'rbt/requires/require_the_cookbook_class.rb'
  require 'rbt/requires/require_the_installer_class.rb'
  set_compile_this_program(i)
  enable_rbt_specific_behaviour
end

#program_path?Boolean

#

program_path?

#

Returns:

  • (Boolean)


908
909
910
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 908

def program_path?
  @compile_dataset.send(__method__)
end

#really_use_unicode?Boolean

#

really_use_unicode?

#

Returns:

  • (Boolean)


427
428
429
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 427

def really_use_unicode?
  use_unicode? and Object.const_defined?(:Roebe)
end

#resetObject

#

reset (reset tag)

#


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
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 204

def reset
  super()
  # ======================================================================= #
  # === @namespace
  # ======================================================================= #
  @namespace = NAMESPACE
  # ======================================================================= #
  # === @compile_dataset
  #
  # This variable must be nil initially.
  # ======================================================================= #
  @compile_dataset = nil
  # ======================================================================= #
  # === @show_required_dependencies
  #
  # If the variable @show_required_dependencies is set to true then
  # dependencies will be shown, unless there are no dependencies
  # (aka when they are empty or nil).
  #
  # This value has been set to true since as of November 2019.
  # ======================================================================= #
  @show_required_dependencies = true
  # ======================================================================= #
  # === @use_unicode_or_ascii
  #
  # This can either just use "-" or the equivalent unicode symbol.
  #
  # The only two allowed ways are :unicode and :ascii.
  # ======================================================================= #
  if TRY_TO_USE_UNICODE_SYMBOLS_FOR_THE_COMMANDLINE_USER_INTERFACE
    @use_unicode_or_ascii = :unicode
  else
    @use_unicode_or_ascii = :ascii
  end
  # ======================================================================= #
  # === @n_left_pad
  #
  # This variable determines how much we will pad to the left-hand
  # side (the left column).
  # ======================================================================= #
  @n_left_pad  = 15
  # ======================================================================= #
  # === @n_right_pad
  #
  # This variable determines how much we will pad to the left-hand
  # side (the left column).
  # ======================================================================= #
  @n_right_pad = 25
  # ======================================================================= #
  # === @vertical
  # ======================================================================= #
  @vertical = return_vertical_bar
  # ======================================================================= #
  # === @do_this_action
  # ======================================================================= #
  @do_this_action = 'Compiling'
  # ======================================================================= #
  # === @show_remote_urls
  # ======================================================================= #
  @show_remote_urls = SHOW_REMOTE_URLS_BY_DEFAULT
  # ======================================================================= #
  # === @use_colours
  # ======================================================================= #
  @use_colours = true
  # ======================================================================= #
  # === @shall_we_autoexpand
  # ======================================================================= #
  @shall_we_autoexpand = true
  # ======================================================================= #
  # === @array_colourize_right_side_with_these_colours
  # ======================================================================= #
  @array_colourize_right_side_with_these_colours = []
  # ======================================================================= #
  # === @use_this_colour_for_the_border
  # ======================================================================= #
  @use_this_colour_for_the_border = nil
  # ======================================================================= #
  # === @use_this_title
  #
  # If this variable is set to a non-nil value then it will be used
  # to show a title for the flexbox. By default this is nil, thus we
  # will not use a title by default.
  # ======================================================================= #
  @use_this_title = nil
  # ======================================================================= #
  # === @hash
  #
  # This variable will keep the "left side" and the "right side" of the 
  # flexbox-table.
  # ======================================================================= #
  @hash = {}
  @hash[:left_side]  = []
  @hash[:right_side] = []
end

#return_combined_value_from_both_padding_valuesObject

#

return_combined_value_from_both_padding_values

#


468
469
470
471
472
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 468

def return_combined_value_from_both_padding_values
  @n_left_pad+
  @n_right_pad+
  5
end

#return_configure_options_or_meson_options_or_no_optionsObject

#

return_configure_options_or_meson_options_or_no_options

#


1611
1612
1613
1614
1615
1616
1617
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1611

def return_configure_options_or_meson_options_or_no_options
  if @compile_dataset.use_configure_options?
    @compile_dataset.query_for_configure_options_or_meson_options('configure options:')
  else
    false
  end
end

#return_default_colour_for_this_input(i) ⇒ Object

#

return_default_colour_for_this_input

#


302
303
304
305
306
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 302

def return_default_colour_for_this_input(i)
  colourize_this_in_that_colour(
    i, DEFAULT_COLOURS_FOR_RBT[:default_colour]
  )
end

#return_potentially_colourized_vertical_tokenObject

#

return_potentially_colourized_vertical_token

#


644
645
646
647
648
649
650
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 644

def return_potentially_colourized_vertical_token
  _ = @vertical
  if colourize_border?
    _ = Colours::HtmlColoursMethods.send(@use_this_colour_for_the_border, _)
  end
  _
end

#return_vertical_barObject

#

return_vertical_bar

This will return a vertical bar, e. g. either ‘|’, or the corresponding Unicode representation - the latter of which is done through the Roebe namespace.

#


416
417
418
419
420
421
422
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 416

def return_vertical_bar
  if really_use_unicode?
    Roebe.vertical_block
  else
    VERTICAL_ASCII_BAR
  end
end

#revObject

#

rev

#


792
793
794
795
796
797
798
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 792

def rev
  if @use_colours
    Colours.rev
  else
    ''
  end
end

#right_pad?Boolean Also known as: right_padding_size?, right_padding?

#

right_pad?

#

Returns:

  • (Boolean)


751
752
753
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 751

def right_pad?
  @n_right_pad
end

#right_side?Boolean

#

right_side?

#

Returns:

  • (Boolean)


477
478
479
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 477

def right_side?
  @hash[:right_side]
end

#runObject

#

run (run tag)

#


1622
1623
1624
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1622

def run
  menu
end

#run_configure?Boolean

#

run_configure?

#

Returns:

  • (Boolean)


873
874
875
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 873

def run_configure?
  @compile_dataset.send(__method__)
end

#sanitize_right_sideObject

#

sanitize_right_side

This method is currently only used to replace true/false boolean values with verbose “Yes.” or “No.” strings.

#


603
604
605
606
607
608
609
610
611
612
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 603

def sanitize_right_side
  @hash[:right_side].map! {|entry|
    if entry.is_a? TrueClass
      entry = 'Yes.'
    elsif entry.is_a? FalseClass
      entry = 'No.'
    end
    entry
  }
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


484
485
486
487
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 484

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end

#set_compile_this_program(i = '') ⇒ Object

#

set_compile_this_program

This will assign to the program to be used; it should be an instance of the main data-loader class.

#


1357
1358
1359
1360
1361
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1357

def set_compile_this_program(i = '')
  i = i.first if i.is_a? Array
  i = i.dup
  @compile_this_program = i
end

#set_do_this_action(i) ⇒ Object Also known as: set_do_what

#

set_do_this_action

#


964
965
966
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 964

def set_do_this_action(i)
  @do_this_action = i
end

#set_left_padding(i) ⇒ Object

#

set_left_padding

#


694
695
696
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 694

def set_left_padding(i)
  @n_left_pad = i.to_i
end

#set_proper_padding_for_the_rbt_projectObject

#

set_proper_padding_for_the_rbt_project

#


978
979
980
981
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 978

def set_proper_padding_for_the_rbt_project
  @n_left_pad  = N_LEFT_PAD_FOR_THE_RBT_PROJECT
  @n_right_pad = N_RIGHT_PAD_FOR_THE_RBT_PROJECT
end

#set_right_padding(i) ⇒ Object

#

set_right_padding

#


701
702
703
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 701

def set_right_padding(i)
  @n_right_pad = i.to_i
end

#set_show_required_dependencies(i) ⇒ Object

#

set_show_required_dependencies

#


957
958
959
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 957

def set_show_required_dependencies(i)
  @show_required_dependencies = i
end

#set_use_this_title(i) ⇒ Object Also known as: set_use_title, set_title, title=

#

set_use_this_title

#


635
636
637
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 635

def set_use_this_title(i)
  @use_this_title = i
end

#title?Boolean

#

title?

#

Returns:

  • (Boolean)


708
709
710
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 708

def title?
  @use_this_title
end

#top_eclinerObject

#

top_ecliner (top tag)

#


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
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 571

def top_ecliner
  result = cliner { :top }
  # ======================================================================= #
  # Next see whether we will use a title or not.
  # ======================================================================= #
  title = title?
  if title
    result[1, title.size+2] = " #{title} "
  end
  if colourize_border?
    if title # Colourize the title next.
      # =================================================================== #
      # In this case we will colourize this differently.
      # =================================================================== #
      splitted = result.split(' ')
      splitted[0] = Colours::HtmlColoursMethods.send(@use_this_colour_for_the_border, splitted[0])
      splitted[1] = Colours::HtmlColoursMethods.send(COLOUR_FOR_THE_TITLE, splitted[1])
      splitted[2] = Colours::HtmlColoursMethods.send(@use_this_colour_for_the_border, splitted[2])
      result = splitted.join(' ')
    else
      result = Colours::HtmlColoursMethods.send(@use_this_colour_for_the_border, result)
    end
  end
  e " #{rev}#{result}" 
end

#try_to_require_external_dependenciesObject

#

try_to_require_external_dependencies

#


456
457
458
459
460
461
462
463
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 456

def try_to_require_external_dependencies
  begin
    require 'roebe/toplevel_methods/unicode/popular_unicode_symbols.rb'
  rescue LoadError; end
  begin
    require 'rbt/toplevel_methods/available_programs.rb'
  rescue LoadError; end
end

#type_in_use?Boolean

#

type_in_use?

This is a bit special in that it will display a fake “Symbol”.

#

Returns:

  • (Boolean)


1317
1318
1319
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 1317

def type_in_use?
  ":#{@compile_dataset.send(__method__).to_s}"
end

#url1?Boolean

#

url1?

#

Returns:

  • (Boolean)


887
888
889
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 887

def url1?
  @compile_dataset.send(__method__)
end

#use_autogen?Boolean

#

use_autogen?

#

Returns:

  • (Boolean)


929
930
931
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 929

def use_autogen?
  @compile_dataset.send(__method__)
end

#use_colours?Boolean

#

use_colours?

#

Returns:

  • (Boolean)


374
375
376
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 374

def use_colours?
  @use_colours
end

#use_default_colour_for_the_borderObject

#

use_default_colour_for_the_border

This method can be used to use the default colour for the border, which is currently :slateblue.

#


769
770
771
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 769

def use_default_colour_for_the_border
  colourize_border :default
end

#use_unicode?Boolean Also known as: try_to_use_unicode_symbols_for_the_commandline_user_interface?

#

use_unicode?

#

Returns:

  • (Boolean)


434
435
436
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 434

def use_unicode?
  @use_unicode_or_ascii == :unicode
end

#use_which_build_system?Boolean

#

use_which_build_system?

#

Returns:

  • (Boolean)


894
895
896
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 894

def use_which_build_system?
  @compile_dataset.send(__method__)
end

#verbose_truth(i) ⇒ Object Also known as: vt

#

verbose_truth

#


400
401
402
403
404
405
406
407
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 400

def verbose_truth(i)
  case i.to_s
  when 'true'
    'Yes'
  when 'false'
    'No'
  end
end

#vertical_bar?Boolean

#

vertical_bar?

#

Returns:

  • (Boolean)


655
656
657
# File 'lib/ascii_paradise/flexbox/flexbox.rb', line 655

def vertical_bar?
  @vertical
end