class RBT::CreateShellScriptContainingTheseProgramsVersions
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true )
click to toggle source
Public Instance Methods
add(i)
click to toggle source
#¶ ↑
add (add tag)¶ ↑
#¶ ↑
# File lib/rbt/shell/create_shell_script_containing_these_program_versions.rb, line 176 def add(i) case i # ======================================================================= # # === :newline # ======================================================================= # when :newline i = "\n" end @_ << i end
determine_all_programs_versions( i = @array_work_on_these_programs )
click to toggle source
#¶ ↑
determine_all_programs_versions
¶ ↑
#¶ ↑
# File lib/rbt/shell/create_shell_script_containing_these_program_versions.rb, line 114 def determine_all_programs_versions( i = @array_work_on_these_programs ) # ======================================================================= # # Obtain a handle to a file such as: # # "/usr/lib/ruby/site_ruby/3.0.0/rbt/yaml/programs_version/available_programs_versions.md" # # ======================================================================= # _ = RBT.file_available_programs_versions if File.exist? _ dataset = File.readlines(_).reject {|line| line.strip.empty? } end if is_on_roebe? and i.empty? opne rev+'Assuming that, as input, '+steelblue('--everything')+ rev+' was meant.' i << return_all_programs end if i.empty? opne 'No program was passed. Thus, as no dataset has been given,' opne 'no file will be created. Please supply the programs that' opne 'you wish to generate shell-variables for (or use '+ steelblue('--lfs')+')' else i.flatten.compact.each {|this_program| selection = dataset.select {|line| line.start_with? "#{this_program} " } first_line = selection.first # ===================================================================== # # Next, skip entries we can not find: # ===================================================================== # next unless first_line # program_version = RBT.swift_return_version_of_this_program( # this_program.to_s.delete('_').to_sym # ) program_version = first_line.split(' ')[1].to_s.strip # ===================================================================== # # === export MY_GAWKV="gawk-5.0.1" # # But also: # # export MY_GAWK="${MY_GAWKV}.tar.xz" # # We need to remove '+' chars, though, as these are not valid for # the shell. # ===================================================================== # add( "export #{this_program.delete('+').upcase}V=\"#{this_program.downcase}-#{program_version}\"\n" ) add( "export #{this_program.delete('+').upcase}=\"\$\{#{this_program.upcase}V\}.tar.xz\"\n" ) add :newline } save_our_findings_into_a_file end end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/shell/create_shell_script_containing_these_program_versions.rb, line 38 def reset super() infer_the_namespace # ======================================================================= # # === @_ # # We will store into this String. # ======================================================================= # @_ = ''.dup # ======================================================================= # # === @array_work_on_these_programs # ======================================================================= # @array_work_on_these_programs = [] end
return_all_programs()
click to toggle source
run()
click to toggle source
save_our_findings_into_a_file()
click to toggle source
#¶ ↑
save_our_findings_into_a_file
¶ ↑
#¶ ↑
# File lib/rbt/shell/create_shell_script_containing_these_program_versions.rb, line 190 def save_our_findings_into_a_file into = 'shell_script_containing_the_program_versions.sh' e "#{rev}Now storing into `#{sfile(into)}#{rev}`." write_what_into(@_, into) if is_on_roebe? into = '/home/x/programming/ruby/src/rbt/lib/rbt/shell/'+ File.basename(into) e "#{rev}Now storing into `#{sfile(into)}#{rev}`." write_what_into(@_, into) end end
set_work_on_these_programs(i)
click to toggle source
#¶ ↑
set_work_on_these_programs
¶ ↑
#¶ ↑
# File lib/rbt/shell/create_shell_script_containing_these_program_versions.rb, line 63 def set_work_on_these_programs(i) i = [i].flatten.compact # Work on an Array past that point here. i.each {|entry| unless @array_work_on_these_programs.include? entry @array_work_on_these_programs << entry end } end
Also aliased as: add_work_on_these_programs