class RBT::Ntrad
Public Class Methods
[](i = ARGV)
click to toggle source
new( these_programs = ARGV, additional_parameters = nil, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/ntrad.rb, line 28 def initialize( these_programs = ARGV, additional_parameters = nil, run_already = true ) reset @original_base_directory = return_pwd set_compile_these_programs_in_a_non_traditional_manner( these_programs ) set_additional_parameters( additional_parameters ) run if run_already end
Public Instance Methods
compile_these_programs_in_a_non_traditional_manner?()
click to toggle source
original_base_directory?()
click to toggle source
remote_url?()
click to toggle source
#¶ ↑
remote_url?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/ntrad.rb, line 162 def remote_url? @object_handling_the_installation_or_compilation.remote_url? end
Also aliased as: url1?
reset()
click to toggle source
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/ntrad.rb, line 101 def run @compile_these_programs_in_a_non_traditional_manner.each {|this_program| original_input = this_program.dup if this_program.start_with?('http') and !RBT.is_this_a_registered_program?(this_program) # =================================================================== # # Assume that a remote URL was given in this case. On January 2023 # it was discovered that this is too simplistic, because there # may be programs such as "httpd" (apache's httpd webserver). Thus, # we had to improve the check made above. # =================================================================== # action(:update_entry, this_program) this_program = ProgramInformation[this_program].program_name? end @object_handling_the_installation_or_compilation = RBT::Installer.new(this_program, :do_not_run_yet) { :do_not_check_whether_the_program_exists } # ===================================================================== # # Check whether the input is an existing file - in this case we will # use it. This, however had, can lead to problems, as the given # input may also be a local directory, e. g. rbt/log_directory/mpfr # if the input given was "ntrad input". In that case the calls # below to ProgramInformation[] would also fail, as we cd-ed into # the log directory. Thus, since as of March 2023, we will actually # check the input for the original base directory. # ===================================================================== # target_at_the_original_base_directory = original_base_directory?+ File.basename(this_program) if File.exist? target_at_the_original_base_directory program_name = ::ProgramInformation[target_at_the_original_base_directory].program_name? program_version = ::ProgramInformation[target_at_the_original_base_directory].program_version? @object_handling_the_installation_or_compilation.set_program_name(program_name) @object_handling_the_installation_or_compilation.initialize_dataset(program_name) # Set it explicitely here. @object_handling_the_installation_or_compilation.cookbook_dataset.set_program_name(program_name) # =================================================================== # # Let's assume the URL next. # =================================================================== # use_this_guessed_url = RBT.guess_the_url_from_this( remote_url?, original_input ) @object_handling_the_installation_or_compilation.cookbook_dataset.set_url1(use_this_guessed_url) @object_handling_the_installation_or_compilation.set_program_version(program_version) @object_handling_the_installation_or_compilation.set_program_name_and_program_version(:default) @object_handling_the_installation_or_compilation.set_archive_type(this_program) @object_handling_the_installation_or_compilation.set_base_dir return_pwd @object_handling_the_installation_or_compilation.set_program_full_name @object_handling_the_installation_or_compilation.rebuild_path end @object_handling_the_installation_or_compilation.determine_which_programs_to_compile if @additional_parameters @object_handling_the_installation_or_compilation.menu(@additional_parameters) end @object_handling_the_installation_or_compilation.compile_in_a_non_traditional_manner @object_handling_the_installation_or_compilation.run } end
set_additional_parameters(i)
click to toggle source
set_compile_these_programs_in_a_non_traditional_manner( i = '' )
click to toggle source
#¶ ↑
set_compile_these_programs_in_a_non_traditional_manner
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/ntrad.rb, line 62 def set_compile_these_programs_in_a_non_traditional_manner( i = '' ) i = [i].flatten.compact # ======================================================================= # # === Handle pwd usage next (it is assumed to be a shortcut): # ======================================================================= # case i.first when 'pwd' i[0] = File.basename(return_pwd) end if i.empty? opne 'No input has been provided. We will attempt to obtain a' opne 'local file, as program instead.' # ===================================================================== # # Try to grab a random entry in this case, as the user has not # passed in any arguments. # ===================================================================== # random_entry = Dir['*'].sample i << ProgramInformation.return_program_name(random_entry) end if i.is_a? Array i.map! {|entry| entry.delete('-') } end @compile_these_programs_in_a_non_traditional_manner = i end