class RBT::Action::Statistics::CompileStrategies
Public Class Methods
[](i = ARGV)
click to toggle source
new( i = ARGV, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 36 def initialize( i = ARGV, run_already = true, &block ) reset set_commandline_arguments(i) case run_already # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet run_already = false end # ======================================================================= # # === Handle blocks given to this class next # ======================================================================= # if block_given? _yielded = yield end run if run_already end
Public Instance Methods
colour_on_the_left_hand_side(i)
click to toggle source
dataset?()
click to toggle source
determine_how_many_programs_are_registered()
click to toggle source
load_dataset_from_the_expanded_data()
click to toggle source
#¶ ↑
load_dataset_from_the_expanded_data
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 152 def load_dataset_from_the_expanded_data reset_the_main_hash _ = RBT.directory_expanded_cookbooks? # Get a reference to the expanded cookbooks directory. # ======================================================================= # # Load all files from the expanded cookbooks dataset next: # ======================================================================= # all_files = Dir["#{_}*.yml"] if all_files.size < n_programs_are_available? # ===================================================================== # # And do a little-error check next, as revealed on June 2022. # ===================================================================== # e tomato('Note: not all programs seem to contain an expanded dataset.') e tomato('Consider running "')+steelblue('rbt --expand')+ tomato('" to generate the expanded dataset.') end all_files.each {|this_file| dataset_from_the_yaml_file = load_yaml(this_file) name_of_the_program = File.basename(this_file).sub(/\.yml$/,'') hash = {} hash[name_of_the_program] = dataset_from_the_yaml_file @internal_hash[:main_hash].update(hash) } determine_how_many_programs_are_registered end
main_hash?()
click to toggle source
n_programs_are_assumed_to_be_run_via_makefiles?()
click to toggle source
n_programs_are_registered?()
click to toggle source
#¶ ↑
n_programs_are_registered?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 293 def n_programs_are_registered? @n_programs_are_registered end
Also aliased as: n_total_programs?
n_programs_depend_on( a = 'cmake', b = cmake_deps )
click to toggle source
#¶ ↑
n_programs_depend_¶ ↑
# ¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 117 def n_programs_depend_on( a = 'cmake', b = cmake_deps ) @internal_hash[:n_programs_are_assumed_to_be_run_via_makefiles] -= b.keys.size n_percent = ( b.keys.size * 100.0 / @n_programs_are_registered ).round(1).to_s.rjust(4)+'%' # ======================================================================= # # Next append the number: # ======================================================================= # n_percent << ' ('+b.keys.size.to_s.rjust(4)+' / '+n_total_programs?.to_s+')' colourized_n_percent = mediumseagreen(n_percent) e "#{colour_on_the_left_hand_side(b.keys.size.to_s.rjust(3))} #{rev}programs "\ "depend on #{royalblue((a+'.').ljust(15))} #{colourized_n_percent}" end
program_path?()
click to toggle source
report()
click to toggle source
#¶ ↑
report (report tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 197 def report _ = main_hash? # ======================================================================= # # Seed the variable @internal_hash[:n_programs_are_assumed_to_be_run_via_makefiles] # with an initial value, which will lateron be decremented accordingly. # # Note that all keys will be guaranteed to be Symbols, such as # :required_deps_on or :use_this_build_system. # ======================================================================= # @internal_hash[:n_programs_are_assumed_to_be_run_via_makefiles] = @n_programs_are_registered check_for_this_value = :required_deps_on configure_deps = _.select {|key, inner_value| build_system = inner_value[:use_this_build_system] build_system and (build_system.to_s.strip == 'configure') } cmake_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('cmake') } python_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('python') } meson_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('meson') } ruby_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('ruby') } perl_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('perl') } scons_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('scons') } waf_deps = _.select {|key, inner_value| array_required_deps_on = inner_value[check_for_this_value] array_required_deps_on and array_required_deps_on.include?('waf') } e report_how_many_programs_are_registered_in_total e # ======================================================================= # # === configure # ======================================================================= # n_programs_depend_on('configure', configure_deps) # ======================================================================= # # === cmake # ======================================================================= # n_programs_depend_on('cmake', cmake_deps) # ======================================================================= # # === ruby # ======================================================================= # n_programs_depend_on('ruby', ruby_deps) # ======================================================================= # # === python # ======================================================================= # n_programs_depend_on('python', python_deps) # ======================================================================= # # === meson # ======================================================================= # n_programs_depend_on('meson', meson_deps) # ======================================================================= # # === perl # ======================================================================= # n_programs_depend_on('perl', perl_deps) # ======================================================================= # # === scons # ======================================================================= # n_programs_depend_on('scons', scons_deps) # ======================================================================= # # === waf # ======================================================================= # n_programs_depend_on('waf', waf_deps) e slateblue('---') e colour_on_the_left_hand_side( @n_programs_are_registered - n_programs_are_assumed_to_be_run_via_makefiles? )+rev+' programs make use of any of the above '+skyblue('^^^')+ rev+' compile-time strategies.' e e "#{sfancy(n_programs_are_assumed_to_be_run_via_makefiles?.to_s)} #{rev}programs"\ " are assumed to be compiled through #{orange('make')} #{rev}(and possibly" e ' '+lightsalmon('GNU autoconfigure')+rev+ '). Note that meson depends on python,' e ' so strictly speaking, the meson-dependencies overlap' e ' with the python-dependencies.' e end
report_how_many_programs_are_registered_in_total()
click to toggle source
#¶ ↑
report_how_many_programs_are_registered_in_total
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 144 def report_how_many_programs_are_registered_in_total e "#{rev}There are a total of #{springgreen(@n_programs_are_registered)} "\ "#{rev}registered programs in the #{royalblue('RBT project')}#{rev}." end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Action#reset
# File lib/rbt/actions/individual_actions/statistics/compile_strategies.rb, line 62 def reset super() infer_the_namespace # ======================================================================= # # === :main_hash # ======================================================================= # @internal_hash[:main_hash] = {} # ======================================================================= # # === :n_programs_are_assumed_to_be_run_via_makefiles # ======================================================================= # @internal_hash[:n_programs_are_assumed_to_be_run_via_makefiles] = 0 # ======================================================================= # # Remember if you need to know the amount of programs, within this # class the variable @n_programs_are_registered keeps track of this. # ======================================================================= # end
reset_the_main_hash()
click to toggle source
run()
click to toggle source
show_introduction()
click to toggle source