class RBT::BuildDetector
Public Class Methods
[](i = '')
click to toggle source
do_guess_build_type()
click to toggle source
#¶ ↑
RBT::BuildDetector.do_guess_build_type
¶ ↑
This method can be used to guess the build type of a target archive. Prefer to use the method RBT.build_type?
instead, though, since it is more convenient.
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 218 def self.do_guess_build_type self.new.build_type? end
Public Instance Methods
build_type?()
click to toggle source
determine_build_type()
click to toggle source
#¶ ↑
determine_build_type
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 136 def determine_build_type files_from_pwd = Dir[base_dir?+'*'] files_from_pwd_but_only_their_filenames = files_from_pwd.map { |entry| File.basename(entry) } # ======================================================================= # # Check for cmake build types first # ======================================================================= # if files_from_pwd_but_only_their_filenames.include? 'CMakeLists.txt' is_cmake_build_type # ======================================================================= # # Next, check for meson build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include? 'meson.build' is_meson_build_type # ======================================================================= # # Next, check for waf-based build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include? 'waf' is_waf_build_type # ======================================================================= # # Next, scheck for "scons"-based build types # ======================================================================= # elsif files_from_pwd_but_only_their_filenames.include?('SConscript') and files_from_pwd_but_only_their_filenames.include?('SConstruct') is_scons_build_type # ======================================================================= # # Next, GNU configure-based scripts # ======================================================================= # else # This is the default value. set_build_type end end
determine_whether_the_input_is_an_existing_directory()
click to toggle source
#¶ ↑
determine_whether_the_input_is_an_existing_directory
¶ ↑
By default, this class will use the current directory as the input directory that is to be checked.
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 59 def determine_whether_the_input_is_an_existing_directory if File.exist? @input and File.directory? @input # ===================================================================== # # In this case, use that input as directory. # ===================================================================== # set_main_dir(@input) end end
input?()
click to toggle source
is_cmake_build_type()
click to toggle source
is_meson_build_type()
click to toggle source
is_scons_build_type()
click to toggle source
is_waf_build_type()
click to toggle source
report()
click to toggle source
#¶ ↑
report (report tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 180 def report # ======================================================================= # # The build type is stored in the variable called @build_type. # ======================================================================= # e "The guessed build type is `#{sfancy(@build_type)}`." end
reset()
click to toggle source
run()
click to toggle source
set_build_type(i = :configure)
click to toggle source
set_input(i = '')
click to toggle source
set_use_this_base_directory( i = return_pwd )
click to toggle source
#¶ ↑
set_use_this_base_directory
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 88 def set_use_this_base_directory( i = return_pwd ) unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end @use_this_base_directory = i end
Also aliased as: set_main_dir