Class: Backlog::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/backlog/config.rb

Constant Summary collapse

@@path =

internal variables

nil

Class Method Summary collapse

Class Method Details

.archive_dirObject



31
32
33
# File 'lib/backlog/config.rb', line 31

def self.archive_dir
  return File.join(Config.base_dir, "archive")
end

.base_dirObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/backlog/config.rb', line 10

def self.base_dir
  if @@path != nil 
    return @@path
  end
  if ENV.has_key? "BACKLOG_DIR"

    if ENV['BACKLOG_DIR'].start_with? "/" or ENV['BACKLOG_DIR'].start_with? "~/" or ENV['BACKLOG_DIR'].start_with? "$HOME"
      @@path = ENV['BACKLOG_DIR']
    else
      @@path = File.join(ENV['HOME'], ENV['BACKLOG_DIR'])
    end
  else
    @@path = File.join(ENV['HOME'], ".backlog")
  end
  @@path = File.expand_path @@path
end

.current_dirObject



27
28
29
# File 'lib/backlog/config.rb', line 27

def self.current_dir
  return File.join(Config.base_dir, "current")
end

.template_pathObject



35
36
37
38
39
40
41
42
# File 'lib/backlog/config.rb', line 35

def self.template_path
  custom_entry_path = File.join(ENV['HOME'], ".backlog.md")
  if File.exists?(custom_entry_path)
    return custom_entry_path
  end

  return File.join(Config.base_dir, "template.md")
end