Class: Ghq::Cache::Builder
- Inherits:
-
Object
- Object
- Ghq::Cache::Builder
- Defined in:
- lib/ghq/cache/builder.rb
Constant Summary collapse
- CACHE_PATH =
File.('~/.ghq-cache')
- GHQ_PATH =
ENV['GHQ'] || '/usr/local/bin/ghq'
Class Method Summary collapse
Class Method Details
.build ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ghq/cache/builder.rb', line 8 def build root = Logger.resume obsolete_paths.each do |path| root.remove_path(path) end ghq_list.each do |path| root.register_path(File.join(root.name, path)) end dirs = flatten(root).sort_by do |dir| sort_key(dir) end.reverse cache = dirs.map(&:path_from_root).join("\n").concat("\n") File.write(CACHE_PATH, cache) end |