class Bindgen::FindPath
- Bindgen::FindPath
- Reference
- Object
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.crbindgen/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
-
#create_match_collector(config)
Returns a new
MatchCollector
decided by config. -
#create_match_finder(search_paths, config, checkers)
Returns a new
MatchFinder
decided by config. -
#find(config : PathConfig, additional = nil) : String | Nil
Finds a path for config.
-
#find_all(config : Configuration, &) : Array(Error)
Finds all paths of config, yielding for each successful find.
-
#find_all!(config : Configuration) : Array(Error)
Finds all paths of config, and adds missing ones to
#variables
. -
#root : String
Root path of the project.
-
#variables : Hash(String, String) | ENV.class
Target variables hash.
Constructor Detail
Instance Method Detail
Returns a new MatchFinder
decided by config.
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.
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.
Finds all paths of config, and adds missing ones to #variables
.
Returns a list of all encountered errors.
Target variables hash. Will be read from and written to.