class Bindgen::FindPath

Overview

Finds paths to files and directories, per user-configuration. Used to find dependencies of user projects in a somewhat portable fashion.

By default this class modifies ENV directly.

Defined in:

bindgen/find_path.cr
bindgen/find_path/any_of_checker.cr
bindgen/find_path/checker.cr
bindgen/find_path/configuration.cr
bindgen/find_path/error.cr
bindgen/find_path/generic_version.cr
bindgen/find_path/kind.cr
bindgen/find_path/list_match_collector.cr
bindgen/find_path/match_collector.cr
bindgen/find_path/match_finder.cr
bindgen/find_path/path_checker.cr
bindgen/find_path/shell_checker.cr
bindgen/find_path/version_checker.cr
bindgen/find_path/versioned_match_finder.cr

Constant Summary

MULTILINE_OPTION = Regex::Options.from_value(2)

Pure multi-line option. Crystal by defaults combines multi-line with the dot-all option, which we don't want.

PATH_SEPARATOR = ':'

Constructors

Instance Method Summary

Constructor Detail

def self.new(root : String, variables : ::ENV.class | Hash(String, String) = ENV) #

[View source]

Instance Method Detail

def create_match_collector(config) #

Returns a new MatchCollector decided by config.


[View source]
def create_match_finder(search_paths, config, checkers) #

Returns a new MatchFinder decided by config.


[View source]
def find(config : PathConfig, additional = nil) : String | Nil #

Finds a path for config. On success, returns the path as string. Returns nil on error.

If the match wants to set additional variables, it'll write them into the additional hash. If no additional is given, these variables are lost.


[View source]
def find_all(config : Configuration, &) : Array(Error) #

Finds all paths of config, yielding for each successful find. Unsuccessful matches are collected into an Error array and returned afterwards. If additional is given, additional variables set by matches are stored within it. If no additional is given, these variables are lost.


[View source]
def find_all!(config : Configuration) : Array(Error) #

Finds all paths of config, and adds missing ones to #variables. Returns a list of all encountered errors.


[View source]
def root : String #

Root path of the project.


[View source]
def variables : Hash(String, String) | ENV.class #

Target variables hash. Will be read from and written to.


[View source]