Module: HackBoxen::Paths

Included in:
Logging
Defined in:
lib/hackboxen/utils/paths.rb

Instance Method Summary collapse

Instance Method Details

#default_pathsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hackboxen/utils/paths.rb', line 16

def default_paths
  {
    # root directories
    :home        => ENV['HOME'],
    :data_root   => HackBoxen.dataroot,
    :code_root   => HackBoxen.coderoot,
    # local hackbox directories
    :hb_current  => [:code_root, HackBoxen.current, HackBoxen.name],
    :hb_engine   => [:hb_current, 'engine'],
    :hb_config   => [:hb_current, 'config'],
    # output directories
    :hb_dataroot => [:data_root, HackBoxen.current],
    :ripd_dir    => [:hb_dataroot, 'ripd'],
    :rawd_dir    => [:hb_dataroot, 'rawd'],
    :fixd_dir    => [:hb_dataroot, 'fixd'],
    :pkgd_dir    => [:hb_dataroot, 'pkgd'],
    :log_dir     => [:hb_dataroot, 'log'],
    :env_dir     => [:hb_dataroot, 'env'],
    :data_dir    => [:fixd_dir, 'data'],
    :code_dir    => [:fixd_dir, 'code']
}

end

#path_to(*pathsegs) ⇒ Object



11
12
13
14
# File 'lib/hackboxen/utils/paths.rb', line 11

def path_to *pathsegs
  path = Pathname.new path_to_helper(*pathsegs)
  path.absolute? ? File.expand_path(path) : path.to_s
end

#pathsObject



7
8
9
# File 'lib/hackboxen/utils/paths.rb', line 7

def paths
  @paths ||= default_paths
end