Class: Config

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



2
3
4
# File 'lib/config.rb', line 2

def initialize
    
end

Class Method Details

.Bin_Repo_PathObject



47
48
49
# File 'lib/config.rb', line 47

def self.Bin_Repo_Path
    @@bin_repo_path
end

.Bin_Repo_UrlObject



59
60
61
# File 'lib/config.rb', line 59

def self.Bin_Repo_Url
    @@bin_repo_url
end

.Bin_Spec_PathObject



51
52
53
# File 'lib/config.rb', line 51

def self.Bin_Spec_Path
    @@bin_spec_path
end

.config_fileObject



20
21
22
# File 'lib/config.rb', line 20

def self.config_file
    self.Home + "/thktool_config.yml"
end

.create_config_file_if_needObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/config.rb', line 6

def self.create_config_file_if_need
    yaml = nil
    
    if File.exist?(Config.config_file)
        yaml = YAML.load_file(Config.config_file)
        Config.load_yaml(yaml)
    else
        yml_file = File.join(File.dirname(File.expand_path(__FILE__)), 'thktool_config.yml')
        yaml = YAML.load_file(yml_file)
        File.open(Config.config_file,"w") { |f| YAML.dump(yaml,f) }
    end
    yaml
end

.HomeObject



35
36
37
# File 'lib/config.rb', line 35

def self.Home
    ('/Users/'+`whoami`).chomp
end

.load_yaml(yaml) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/config.rb', line 24

def self.load_yaml(yaml)
    @@source_repo_path = yaml['SOURCE_REPO_PATH'].trans_home_path!
    @@source_spec_path = yaml['SOURCE_SPEC_PATH'].trans_home_path!
    @@bin_repo_path = yaml['BIN_REPO_PATH'].trans_home_path!
    @@bin_spec_path = yaml['BIN_SPEC_PATH'].trans_home_path!
    @@source_repo_url = yaml['SOURCE_REPO_URL']
    @@bin_repo_url = yaml['BIN_REPO_URL']
    @@package_enable = yaml['PACKAGE_ENABLE']
    @@package_source_repo = yaml['PACKAGE_SOURCE_REPO']
end

.Package_EnableObject



63
64
65
# File 'lib/config.rb', line 63

def self.Package_Enable
    @@package_enable == 1
end

.Package_Source_repoObject



67
68
69
# File 'lib/config.rb', line 67

def self.Package_Source_repo
    @@package_source_repo
end

.Source_Repo_PathObject



39
40
41
# File 'lib/config.rb', line 39

def self.Source_Repo_Path
    @@source_repo_path
end

.Source_Repo_UrlObject



55
56
57
# File 'lib/config.rb', line 55

def self.Source_Repo_Url
    @@source_repo_url
end

.Source_Spec_PathObject



43
44
45
# File 'lib/config.rb', line 43

def self.Source_Spec_Path
    @@source_spec_path
end