Class: Yoda::Store::Project::FileFinder
- Inherits:
-
Object
- Object
- Yoda::Store::Project::FileFinder
- Defined in:
- lib/yoda/store/project/file_finder.rb
Overview
Find registry file for the current project settings.
Instance Attribute Summary collapse
- #project ⇒ Project readonly
Instance Method Summary collapse
- #cache_dir_path ⇒ String?
- #clear_dir ⇒ Object
- #config_file_path ⇒ String?
- #gemfile_lock_path ⇒ String?
-
#initialize(project) ⇒ FileFinder
constructor
A new instance of FileFinder.
- #library_local_yardoc_dir_path ⇒ String?
- #library_local_yardoc_path(name:, version:) ⇒ String?
- #library_registry_dir_path ⇒ String?
- #library_registry_path(name:, version:) ⇒ String?
- #make_dir ⇒ Object
- #present? ⇒ true, false
- #project_load_paths ⇒ Array<String>
- #project_registry_path ⇒ String?
- #project_source_paths ⇒ Array<String>
- #readable_config_file_path ⇒ String?
- #yoda_dir_path ⇒ String?
Constructor Details
#initialize(project) ⇒ FileFinder
Returns a new instance of FileFinder.
13 14 15 |
# File 'lib/yoda/store/project/file_finder.rb', line 13 def initialize(project) @project = project end |
Instance Attribute Details
#project ⇒ Project (readonly)
10 11 12 |
# File 'lib/yoda/store/project/file_finder.rb', line 10 def project @project end |
Instance Method Details
#cache_dir_path ⇒ String?
28 29 30 |
# File 'lib/yoda/store/project/file_finder.rb', line 28 def cache_dir_path ('.yoda/cache') end |
#clear_dir ⇒ Object
93 94 95 |
# File 'lib/yoda/store/project/file_finder.rb', line 93 def clear_dir yoda_dir_path && File.exist?(yoda_dir_path) && FileUtils.rm_rf(yoda_dir_path) end |
#config_file_path ⇒ String?
48 49 50 |
# File 'lib/yoda/store/project/file_finder.rb', line 48 def config_file_path ('.yoda.yml') end |
#gemfile_lock_path ⇒ String?
43 44 45 |
# File 'lib/yoda/store/project/file_finder.rb', line 43 def gemfile_lock_path ('Gemfile.lock') end |
#library_local_yardoc_dir_path ⇒ String?
38 39 40 |
# File 'lib/yoda/store/project/file_finder.rb', line 38 def library_local_yardoc_dir_path (File.join('.yoda', 'yardoc', RUBY_VERSION)) end |
#library_local_yardoc_path(name:, version:) ⇒ String?
71 72 73 |
# File 'lib/yoda/store/project/file_finder.rb', line 71 def library_local_yardoc_path(name:, version:) ("#{name}-#{version}.yardoc", library_local_yardoc_dir_path) end |
#library_registry_dir_path ⇒ String?
33 34 35 |
# File 'lib/yoda/store/project/file_finder.rb', line 33 def library_registry_dir_path (File.join('.yoda', 'library_registry')) end |
#library_registry_path(name:, version:) ⇒ String?
78 79 80 |
# File 'lib/yoda/store/project/file_finder.rb', line 78 def library_registry_path(name:, version:) (Registry.registry_name, library_registry_dir_path) end |
#make_dir ⇒ Object
87 88 89 90 91 |
# File 'lib/yoda/store/project/file_finder.rb', line 87 def make_dir make_dir_at(cache_dir_path) make_dir_at(library_local_yardoc_dir_path) make_dir_at(library_registry_dir_path) end |
#present? ⇒ true, false
18 19 20 |
# File 'lib/yoda/store/project/file_finder.rb', line 18 def present? File.exist?(cache_path) end |
#project_load_paths ⇒ Array<String>
58 59 60 |
# File 'lib/yoda/store/project/file_finder.rb', line 58 def project_load_paths ["lib", "app", "ext"].map { |path| (path) }.compact end |
#project_registry_path ⇒ String?
83 84 85 |
# File 'lib/yoda/store/project/file_finder.rb', line 83 def project_registry_path (Registry.registry_name, cache_dir_path) end |
#project_source_paths ⇒ Array<String>
53 54 55 |
# File 'lib/yoda/store/project/file_finder.rb', line 53 def project_source_paths glob(["{lib,app}/**/*.rb", "ext/**/*.c", ".yoda/*.rb"]) end |
#readable_config_file_path ⇒ String?
63 64 65 66 |
# File 'lib/yoda/store/project/file_finder.rb', line 63 def readable_config_file_path path = config_file_path path && File.readable?(config_file_path) ? path : nil end |
#yoda_dir_path ⇒ String?
23 24 25 |
# File 'lib/yoda/store/project/file_finder.rb', line 23 def yoda_dir_path ('.yoda') end |