class RBT::BuildDirectory
Public Class Methods
[](i = '')
click to toggle source
Public Instance Methods
do_change_directory( i = @use_this_path, be_verbose = be_verbose? ) { || ... }
click to toggle source
#¶ ↑
do_change_directory
(cd tag)¶ ↑
Use this method if you need to change directory.
The change-directory action will be silent.
#¶ ↑
# File lib/rbt/utility_scripts/build_directory.rb, line 119 def do_change_directory( i = @use_this_path, be_verbose = be_verbose? ) case i when :be_verbose i = @use_this_path be_verbose = true end if block_given? yielded = yield case yielded when :ensure_that_the_directory_exists if i # But only for non-nil values. mkdir(i) unless File.directory? i end end end if i and File.directory?(i) if be_verbose e "Now entering the directory `#{sdir(i)}`." end chdir(i) else opne "Can not change directory to non-existing "\ "path at `#{sfile(i.to_s)}`." end end
Also aliased as: change_directory, cd
name?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/build_directory.rb, line 49 def reset super() infer_the_namespace # ======================================================================= # # === @use_a_build_directory # ======================================================================= # @use_a_build_directory = true # ======================================================================= # # === :be_verbose # ======================================================================= # set_be_quiet end
run()
click to toggle source
set_use_this_path( i = return_pwd )
click to toggle source
#¶ ↑
set_use_this_path
(set tag)¶ ↑
Keep in mind that the build direcory can be nil too.
The path is the full path towards the build directory.
#¶ ↑
# File lib/rbt/utility_scripts/build_directory.rb, line 79 def set_use_this_path( i = return_pwd ) if i # ===================================================================== # # === Handle the case when the input is an Array # ===================================================================== # if i.is_a? Array i = i.join(' ').strip # ===================================================================== # # === Handle the case when the input is a Hash # ===================================================================== # elsif i.is_a? Hash # =================================================================== # # === :path_to_build_directory # =================================================================== # if i.has_key? :path_to_build_directory i = i[:path_to_build_directory] end end unless i.include? '/' i = (return_pwd+i).squeeze('/') end unless i.end_with? '/' i = i.dup if i.frozen? i << '/' unless i.empty? end end # nil values are also valid here. @use_this_path = i end
silently_make_sure_that_the_build_directory_exists()
click to toggle source
use_a_build_directory?()
click to toggle source
#¶ ↑
use_a_build_directory?¶ ↑
This method is required because the RBT::Compile
class may not always want to use a build directory.
#¶ ↑
# File lib/rbt/utility_scripts/build_directory.rb, line 68 def use_a_build_directory? @use_a_build_directory end
Also aliased as: do_we_use_a_build_directory?