Module: WatchTower::Project::PathBased
- Extended by:
- PathBased
- Includes:
- AnyBased
- Included in:
- PathBased
- Defined in:
- lib/watch_tower/project/path_based.rb
Overview
The module contains Path specific project methods, methods like name, path The module can be included into another module/class or used on it’s own, it does extend itself so any methods defined here is available to both class and instance level
Constant Summary collapse
- @@working_cache =
Cache for working_directory by path The key is the path to a file, the value is the working directory of this path
Hash.new
- @@project_name_cache =
Cache for project_name by path The key is the path to a file, the value is the project’s name
Hash.new
- @@project_path_part_cache =
Cache for project path parts The key is the path to a file, the value is the project’s parts
Hash.new
Instance Method Summary collapse
-
#project_name(path, options = {}) ⇒ String
Return the project’s name from a path to any file inside the project.
-
#working_directory(path, options = {}) ⇒ String
Return the working directory (the project’s path if you will) from a path to any file inside the project.
Methods included from AnyBased
Instance Method Details
#project_name(path, options = {}) ⇒ String
Return the project’s name from a path to any file inside the project
46 47 48 49 50 51 52 |
# File 'lib/watch_tower/project/path_based.rb', line 46 def project_name(path, = {}) return @@project_name_cache[path] if @@project_name_cache.key?(path) @@project_name_cache[path] = project_name_from_nested_path(code_path(), path, nested_project_layers()) @@project_name_cache[path] end |
#working_directory(path, options = {}) ⇒ String
Return the working directory (the project’s path if you will) from a path to any file inside the project
32 33 34 35 36 37 38 39 |
# File 'lib/watch_tower/project/path_based.rb', line 32 def working_directory(path, = {}) return @@working_cache[path] if @@working_cache.key?(path) @@working_cache[path] = project_path_from_nested_path(code_path(), path, nested_project_layers()) @@working_cache[path] end |