This repository has been archived by the owner on Dec 24, 2019. It is now read-only.
/
babushka.rb
47 lines (40 loc) · 1.47 KB
/
babushka.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module Babushka
VERSION = '0.17.2'
WORKING_PREFIX = '~/.babushka'
SOURCE_PREFIX = '~/.babushka/sources'
BUILD_PREFIX = '~/.babushka/build'
DOWNLOAD_PREFIX = '~/.babushka/downloads'
LOG_PREFIX = '~/.babushka/logs'
VARS_PREFIX = '~/.babushka/vars'
REPORT_PREFIX = '~/.babushka/runs'
def self.const_missing const_name
if %w[
WorkingPrefix
SourcePrefix
BuildPrefix
DownloadPrefix
LogPrefix
VarsPrefix
ReportPrefix
].include?(const_name.to_s)
const_case = const_name.to_s.scan(/[A-Z][a-z]+/).map(&:upcase).join('_')
Babushka::LogHelpers.deprecated! "2013-12-15", :method_name => "Babushka::#{const_name}", :instead => "Babushka::#{const_case}"
Babushka.const_get(const_case)
else
super
end
end
module Path
def self.binary() File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ end
def self.bin() File.dirname(binary) end
def self.path() File.dirname(bin) end
def self.lib() File.join(path, 'lib') end
def self.run_from_path?() ENV['PATH'].split(':').include?(File.dirname($0)) end
end
end
# First, load the component lists.
require File.join(Babushka::Path.path, 'lib', 'components')
# Load external components that babushka depends on.
Babushka::EXTERNAL_COMPONENTS.each {|c| require File.join(Babushka::Path.path, 'lib', c) }
# Next, load babushka itself.
Babushka::COMPONENTS.each {|c| require File.join(Babushka::Path.path, 'lib/babushka', c) }