Class: RBT::Action::Cookbooks::ShowConfigurationOptions
- Inherits:
-
RBT::Action
show all
- Defined in:
- lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb
Overview
RBT::Action::Cookbooks::ShowConfigurationOptions
Constant Summary
collapse
- DEFAULT_PROGRAM_NAME =
#
DEFAULT_PROGRAM_NAME
This constant is no longer in use.
#
'glibc'
- VERSION_REGEX =
#
VERSION_REGEX
This constant is also no longer in use, but it may be necessary in the future, so we’ll keep it here for the time being.
#
/\d{1,2}\.?\d{1,3}\.?\d{1,3}/
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::Action::Cookbooks::ShowConfigurationOptions[] ========================================================================= #.
Instance Method Summary
collapse
-
#are_we_in_a_build_directory? ⇒ Boolean
# === are_we_in_a_build_directory? ========================================================================= #.
-
#assume_build_directory? ⇒ Boolean
# === assume_build_directory? ========================================================================= #.
-
#assumed_prefix?(user_prefix = user_prefix? ) ⇒ Boolean
(also: #prefix_to_use?, #return_insert_prefix_to_use, #insert_prefix_to_use)
# === assumed_prefix? ========================================================================= #.
-
#assumed_version? ⇒ Boolean
(also: #program_version?)
# === assumed_version? ========================================================================= #.
-
#configure_options? ⇒ Boolean
-
#cookbook_dataset? ⇒ Boolean
(also: #dataset?, #dataset, #data?, #data)
# === cookbook_dataset? ========================================================================= #.
-
#cookbook_dataset_program_name? ⇒ Boolean
# === cookbook_dataset_program_name? ========================================================================= #.
-
#dataset_prefix? ⇒ Boolean
# === dataset_prefix? ========================================================================= #.
-
#do_assume_that_the_user_wanted_to_work_with_the_current_working_directory ⇒ Object
# === do_assume_that_the_user_wanted_to_work_with_the_current_working_directory ========================================================================= #.
-
#feedback_help_then_exit ⇒ Object
(also: #show_help)
# === feedback_help_then_exit (help tag).
-
#find_cookbook_alias_for(i) ⇒ Object
# === find_cookbook_alias_for ========================================================================= #.
-
#found?(cookbook_dataset = cookbook_dataset? ) ⇒ Boolean
# === found? ========================================================================= #.
-
#initialize(i = ARGV, run_already = true, &block) ⇒ ShowConfigurationOptions
constructor
# === initialize ========================================================================= #.
-
#initialize_the_cookbook_dataset(i = work_on_which_program? ) ⇒ Object
(also: #determine_cookbook)
# === initialize_the_cookbook_dataset ========================================================================= #.
-
#menu(i = commandline_arguments? ) ⇒ Object
-
#notify_the_user_that_the_given_input_was_not_found(i = input?) ) ⇒ Object
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#reset_the_internal_variables ⇒ Object
# === reset_the_internal_variables ========================================================================= #.
-
#return_proper_configure_command(cookbook_dataset = cookbook_dataset? ) ⇒ Object
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#set_new_xorg_buffer(i = data?.join(' ')) ⇒ Object
# === set_new_xorg_buffer ========================================================================= #.
-
#set_user_defined_program_version(i) ⇒ Object
(also: #set_program_version)
# === set_user_defined_program_version ========================================================================= #.
-
#set_user_prefix(i) ⇒ Object
(also: #set_prefix)
# === set_user_prefix ========================================================================= #.
-
#set_work_on_this_program(i) ⇒ Object
(also: #set_for_this_program)
# === set_work_on_this_program ========================================================================= #.
-
#show_the_command? ⇒ Boolean
# === show_the_command? ========================================================================= #.
-
#show_the_configure_options ⇒ Object
(also: #show_configuration_options, #report)
-
#store_last_configuration_options(i, into = RBT.store_the_last_configuration_options_in_this_file) ⇒ Object
# === store_last_configuration_options.
-
#use_this_build_system?(cookbook_dataset = cookbook_dataset? ) ⇒ Boolean
(also: #build_type?)
# === use_this_build_system?.
-
#use_xorg_buffer? ⇒ Boolean
# === use_xorg_buffer? ========================================================================= #.
-
#user_defined_program_version? ⇒ Boolean
# === user_defined_program_version? ========================================================================= #.
-
#user_defined_use_this_build_system? ⇒ Boolean
# === user_defined_use_this_build_system? ========================================================================= #.
-
#user_prefix? ⇒ Boolean
(also: #prefix?)
# === user_prefix? ========================================================================= #.
-
#uses_cmake? ⇒ Boolean
# === uses_cmake? ========================================================================= #.
-
#uses_meson? ⇒ Boolean
# === uses_meson? ========================================================================= #.
-
#we_are_in_a_build_directory ⇒ Object
# === we_are_in_a_build_directory ========================================================================= #.
-
#work_on_this_program? ⇒ Boolean
(also: #this_program?, #program_name?, #work_on_which_program?, #input?, #for_this_program?)
# === work_on_this_program? ========================================================================= #.
#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_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, #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_information, #return_program_name_for_gobolinux_systems, #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, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #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 = ARGV, run_already = true, &block) ⇒ ShowConfigurationOptions
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 59
def initialize(
i = ARGV,
run_already = true,
&block
)
reset
set_commandline_arguments(i)
case run_already
when :do_not_run_yet
run_already = false
end
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
RBT::Action::Cookbooks::ShowConfigurationOptions[]
#
776
777
778
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 776
def self.[](i = ARGV)
new(i)
end
|
Instance Method Details
#are_we_in_a_build_directory? ⇒ Boolean
#
are_we_in_a_build_directory?
#
174
175
176
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 174
def are_we_in_a_build_directory?
@internal_hash[:are_we_in_a_build_directory]
end
|
#assume_build_directory? ⇒ Boolean
#
assume_build_directory?
#
142
143
144
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 142
def assume_build_directory?
@internal_hash[:assume_build_directory]
end
|
#assumed_prefix?(user_prefix = user_prefix?
) ⇒ Boolean
Also known as:
prefix_to_use?, return_insert_prefix_to_use, insert_prefix_to_use
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 270
def assumed_prefix?(
user_prefix = user_prefix?
)
_ = dataset_prefix? if user_prefix
case user_prefix
when :appdir_prefix
_ = return_appdir_prefix(
"#{work_on_which_program?}-#{assumed_version?}"
)
else
_ = user_prefix unless user_prefix.nil?
end
elsif user_prefix.nil? and !user_defined_program_version?.nil?
_ = return_appdir_prefix(
"#{work_on_which_program?}-#{user_defined_program_version?}"
)
end
return _
end
|
#assumed_version? ⇒ Boolean
Also known as:
program_version?
619
620
621
622
623
624
625
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 619
def assumed_version?
_ = dataset.program_version?
if @internal_hash[:user_defined_program_version]
_ = @internal_hash[:user_defined_program_version]
end
return _
end
|
630
631
632
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 630
def configure_options?
dataset?.meson_or_cmake_or_configure_options?
end
|
#cookbook_dataset? ⇒ Boolean
Also known as:
dataset?, dataset, data?, data
230
231
232
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 230
def cookbook_dataset?
@internal_hash[:cookbook_dataset]
end
|
#cookbook_dataset_program_name? ⇒ Boolean
#
cookbook_dataset_program_name?
#
503
504
505
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 503
def cookbook_dataset_program_name?
cookbook_dataset.program_name?
end
|
#dataset_prefix? ⇒ Boolean
249
250
251
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 249
def dataset_prefix?
dataset.prefix?
end
|
#do_assume_that_the_user_wanted_to_work_with_the_current_working_directory ⇒ Object
#
do_assume_that_the_user_wanted_to_work_with_the_current_working_directory
#
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 579
def do_assume_that_the_user_wanted_to_work_with_the_current_working_directory
pwd = return_pwd.dup
if pwd.include? '-' if pwd.include? 'BUILD'
pwd.sub!(/BUILD_DIRECTORY/,'')
pwd.sub!(/BUILD/,'')
we_are_in_a_build_directory
end
_ = File.basename(pwd)
if _.include? '-'
set_work_on_this_program(
ProgramInformation.return_program_name(_)
)
set_program_version(
ProgramInformation.return_program_version(_)
)
else
opne _+' can not be evaluated by ProgramInformation; '\
'the input must include a '+tomato('-')+' token.'
end
else
opne 'Can not work on '+pwd+' - the input must '\
'contain at the least one - character.'
set_work_on_this_program(nil)
end
end
|
#feedback_help_then_exit ⇒ Object
Also known as:
show_help
#
feedback_help_then_exit (help tag)
This will show some help options, then exit.
Invocation example:
sco --help
#
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 202
def feedback_help_then_exit
opnn { :no_trailing}
e
e
eparse ' XORG # Set the xorg buffer here as well, silently.'
eparse ' PWD # Use the current working directory via PWD or --pwd.'
eparse ' --ntrad # Make use of an AppDir prefix. Example: sco htop --ntrad'
eparse ' --appdir # as ^^^ above'
eparse ' --use-configure # specifically use the configure options'
eparse ' --use-extended-configure # as ^^^ above, but also show the leading ./configure string'
eparse ' --use-meson # specifically use meson and its configure options'
eparse ' --usr # use the /usr/ prefix'
e
exit
end
|
#find_cookbook_alias_for(i) ⇒ Object
#
find_cookbook_alias_for
#
#found?(cookbook_dataset = cookbook_dataset?
) ⇒ Boolean
221
222
223
224
225
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 221
def found?(
cookbook_dataset = cookbook_dataset?
)
cookbook_dataset and cookbook_dataset.found?
end
|
#initialize_the_cookbook_dataset(i = work_on_which_program?
) ⇒ Object
Also known as:
determine_cookbook
#
initialize_the_cookbook_dataset
#
736
737
738
739
740
741
742
743
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 736
def initialize_the_cookbook_dataset(
i = work_on_which_program?
)
@internal_hash[:cookbook_dataset] = action(:cookbook_for, i) end
|
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 330
def (
i = commandline_arguments?
)
if i.is_a? Array
if i.empty?
do_assume_that_the_user_wanted_to_work_with_the_current_working_directory
else
i.each {|entry| (entry) }
end
else
case i when /^-?-?use(-|_)?extended(-|_)?configure$/i,
/^-?-?use(-|_)?extended(-|_)?configure(-|_)?options$/i,
/^-?-?full$/i
@internal_hash[:use_this_build_system] = :configure
@internal_hash[:show_the_command] = true
when /^-?-?use(-|_)?configure$/i,
/^-?-?use(-|_)?configure(-|_)?options$/i
@internal_hash[:use_this_build_system] = :configure
when /^-?-?assume(-|_)?build(-|_)?directory$/i,
/^-?-?assume$/i,
'..',
' ..'
@internal_hash[:assume_build_directory] = true
when /^-?-?use(-|_)?meson$/i
@internal_hash[:use_this_build_system] = :meson
when /^-?-?usr$/i
set_prefix('/usr/')
when /^-?-?XORG$/i,
/^-?-?BUFFER$/i
@internal_hash[:use_xorg_buffer] = true
when /-?-?appdir$/i,
/-?-?appconf$/i,
/-?-?ntrad$/i,
/^-?-?app?dir$/i,
/^app/i
set_user_prefix(:appdir_prefix)
when /-?-?pwd$/i,
/-?-?BUILD$/i,
''
do_assume_that_the_user_wanted_to_work_with_the_current_working_directory
when /^-?-?help$/i
show_help
else
if i
unless i.start_with?('--') set_work_on_this_program(i)
end
end
end
end
end
|
748
749
750
751
752
753
754
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 748
def notify_the_user_that_the_given_input_was_not_found(i = input?)
opne "#{rev}The given input `#{sfancy(i)}#{rev}` was not found."
opne 'This means that no program called that way could'
opne 'be found to be registered.'
opne 'Another reason why it failed may be a typo, so '
opne 'make sure to check the above input.'
end
|
#reset ⇒ Object
79
80
81
82
83
84
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 79
def reset
super()
reset_the_internal_variables
infer_the_namespace
try_to_require_the_xorg_buffer
end
|
#reset_the_internal_variables ⇒ Object
#
reset_the_internal_variables
#
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 89
def reset_the_internal_variables
@internal_hash[:use_xorg_buffer] = true
@internal_hash[:work_on_this_program] = nil
@internal_hash[:user_prefix] = nil
@internal_hash[:are_we_in_a_build_directory] = false
@internal_hash[:user_defined_program_version] = nil
@internal_hash[:use_this_build_system] = nil
@internal_hash[:assume_build_directory] = false
@internal_hash[:show_the_command] = false
end
|
#
This method will honour the entry configure_command: in the respective .yml file. We can return ‘configure’ or ‘cmake’ or ‘scons’.
Since as of December 2019, we will also check for the explicit option for “use_this_build_system”.
#
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 536
def return_proper_configure_command(
cookbook_dataset = cookbook_dataset?
)
result = ''.dup
use_this_build_system = use_this_build_system?
case use_this_build_system.to_s
when 'cmake'
result << use_this_build_system
when 'meson'
result << 'meson'
when 'configure'
else end
case result
when 'configure'
result.prepend './' result.prepend '.' if are_we_in_a_build_directory?
end
result << ' ' unless result.end_with? ' '
return result
end
|
#run ⇒ Object
759
760
761
762
763
764
765
766
767
768
769
770
771
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 759
def run
initialize_the_cookbook_dataset
if found?
show_the_configure_options
else
notify_the_user_that_the_given_input_was_not_found(input?)
end
end
|
#set_new_xorg_buffer(i = data?.join(' ')) ⇒ Object
240
241
242
243
244
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 240
def set_new_xorg_buffer(
i = data?.join(' ')
)
set_xorg_buffer(i) end
|
#set_user_defined_program_version(i) ⇒ Object
Also known as:
set_program_version
#
set_user_defined_program_version
#
612
613
614
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 612
def set_user_defined_program_version(i)
@internal_hash[:user_defined_program_version] = i
end
|
#set_user_prefix(i) ⇒ Object
Also known as:
set_prefix
156
157
158
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 156
def set_user_prefix(i)
@internal_hash[:user_prefix] = i
end
|
#set_work_on_this_program(i) ⇒ Object
Also known as:
set_for_this_program
#
set_work_on_this_program
#
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 436
def set_work_on_this_program(i)
if i.is_a? Array
i = i.first
end
i = i.dup if i
if i and i.end_with?('.yml')
i.delete_suffix!('.yml')
end
if RBT.is_included? i, :do_not_check_for_aliases
result = i
else result = find_cookbook_alias_for(i)
end
if result.nil? and RBT.include_this_program?("lib#{i}")
result = "lib#{i}"
end
if result
unless result == i
opne 'Using the alias name `'+sfancy(result)+
rev+'` for the input `'+simp(i)+rev+'` instead.'
i = result
end
end
@internal_hash[:work_on_this_program] = i
end
|
#show_the_command? ⇒ Boolean
135
136
137
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 135
def show_the_command?
@internal_hash[:show_the_command]
end
|
#
Commandline usage example:
sco gnutls
#
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
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 642
def show_the_configure_options
cwd = return_pwd
cwd = File.basename(cwd)
if cwd.include? '-'
assumed_version_from_the_cwd = ProgramInformation.return_version(cwd)
else
assumed_version_from_the_cwd = program_version?
end
opnn { :no_trailing }; e; e
e "#{rev}These are the #{steelblue('raw')} #{rev}configure options for "\
"#{sfancy(for_this_program?)}"
e "#{rev}(the xorg buffer will also be modified):#{N}"
cmd = ' '.dup
if show_the_command?
if assume_build_directory?
cmd << '.'
end
cmd << './configure'
end
cmd << return_proper_configure_command.strip.squeeze(' ')
cmd << " --prefix="
assumed_prefix = assumed_prefix?.dup
if assumed_prefix.include? programs_dir? use_this_regex = /(\d{1,4}\.?\d{0,4}\.?\d{0,4})/ assumed_prefix.sub!(use_this_regex, assumed_version_from_the_cwd)
end
cmd << assumed_prefix
if uses_cmake?
cmd.sub!(/-prefix/, 'DCMAKE_INSTALL_PREFIX')
end
assumed_configure_options = dataset?.meson_or_cmake_or_configure_options?(build_type?.to_sym)
if assumed_configure_options.nil?
assumed_configure_options = dataset?.meson_or_cmake_or_configure_options?
end
cmd << " #{assumed_configure_options}"
if uses_meson?
cmd << ' BUILD_DIRECTORY/'
end
if assume_build_directory?
cmd << ' ..'
end
e
e mediumpurple(cmd)
e
if use_xorg_buffer?
set_new_xorg_buffer(cmd)
store_last_configuration_options(cmd)
shell_file = work_on_which_program?.to_s+'.sh'
write_what_into(cmd.strip, shell_file)
e "#{rev}The above was assigned to the #{teal('xorg-buffer')} "\
"#{rev}as well, so you can"
e 'very easily copy-paste this. Additionally it was also stored'
e 'into a shell file, at `'+sfile(shell_file)+rev+'`.'
end
end
|
#store_last_configuration_options(i, into = RBT.store_the_last_configuration_options_in_this_file) ⇒ Object
#
store_last_configuration_options
Use this method to store the last configure options used in a specific file, so that it can be read lateron.
Note that the target directory must exist, for this method to properly work.
#
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 312
def store_last_configuration_options(
i,
into = RBT.store_the_last_configuration_options_in_this_file
)
base_directory = File.dirname(into)
if File.directory? base_directory
write_what_into(
i.strip, into
)
else
opnn; no_directory_exists_at(base_directory)
end
end
|
#use_this_build_system?(cookbook_dataset = cookbook_dataset?
) ⇒ Boolean
Also known as:
build_type?
#
use_this_build_system?
This query method is a bit hackish. In theory we should rely on the code showing us the real value, but there is presently (April 2021) a bug, which explains the work around used here. At a later time we may have to re-evaluate the code here, but for now this has to suffice.
Since as of September 2022 the user can ignore this, via the –use-configure flag.
#
479
480
481
482
483
484
485
486
487
488
489
490
491
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 479
def use_this_build_system?(
cookbook_dataset = cookbook_dataset?
)
_ = cookbook_dataset.use_this_build_system?
case cookbook_dataset.raw_cookbook?.use_this_build_system?
when 'meson'
_ = 'meson'
end
if user_defined_use_this_build_system?
_ = user_defined_use_this_build_system?
end
return _
end
|
#use_xorg_buffer? ⇒ Boolean
149
150
151
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 149
def use_xorg_buffer?
@internal_hash[:use_xorg_buffer]
end
|
#user_defined_program_version? ⇒ Boolean
#
user_defined_program_version?
#
263
264
265
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 263
def user_defined_program_version?
@internal_hash[:user_defined_program_version]
end
|
#user_defined_use_this_build_system? ⇒ Boolean
#
user_defined_use_this_build_system?
#
496
497
498
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 496
def user_defined_use_this_build_system?
@internal_hash[:use_this_build_system]
end
|
#user_prefix? ⇒ Boolean
Also known as:
prefix?
256
257
258
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 256
def user_prefix?
@internal_hash[:user_prefix]
end
|
#uses_cmake? ⇒ Boolean
523
524
525
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 523
def uses_cmake?
use_this_build_system? == 'cmake'
end
|
#uses_meson? ⇒ Boolean
510
511
512
513
514
515
516
517
518
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 510
def uses_meson?
use_this_build_system?.to_s == 'meson'
end
|
#we_are_in_a_build_directory ⇒ Object
#
we_are_in_a_build_directory
#
181
182
183
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 181
def we_are_in_a_build_directory
@internal_hash[:are_we_in_a_build_directory] = true
end
|
#work_on_this_program? ⇒ Boolean
Also known as:
this_program?, program_name?, work_on_which_program?, input?, for_this_program?
#
work_on_this_program?
#
163
164
165
|
# File 'lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb', line 163
def work_on_this_program?
@internal_hash[:work_on_this_program]
end
|