Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/config.rb
Class Method Summary collapse
- .Bin_Repo_Path ⇒ Object
- .Bin_Repo_Url ⇒ Object
- .Bin_Spec_Path ⇒ Object
- .config_file ⇒ Object
- .create_config_file_if_need ⇒ Object
- .Home ⇒ Object
- .load_yaml(yaml) ⇒ Object
- .Package_Enable ⇒ Object
- .Package_Source_repo ⇒ Object
- .Source_Repo_Path ⇒ Object
- .Source_Repo_Url ⇒ Object
- .Source_Spec_Path ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
2 3 4 |
# File 'lib/config.rb', line 2 def initialize end |
Class Method Details
.Bin_Repo_Path ⇒ Object
47 48 49 |
# File 'lib/config.rb', line 47 def self.Bin_Repo_Path @@bin_repo_path end |
.Bin_Repo_Url ⇒ Object
59 60 61 |
# File 'lib/config.rb', line 59 def self.Bin_Repo_Url @@bin_repo_url end |
.Bin_Spec_Path ⇒ Object
51 52 53 |
# File 'lib/config.rb', line 51 def self.Bin_Spec_Path @@bin_spec_path end |
.config_file ⇒ Object
20 21 22 |
# File 'lib/config.rb', line 20 def self.config_file self.Home + "/thktool_config.yml" end |
.create_config_file_if_need ⇒ Object
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.(__FILE__)), 'thktool_config.yml') yaml = YAML.load_file(yml_file) File.open(Config.config_file,"w") { |f| YAML.dump(yaml,f) } end yaml end |
.Home ⇒ Object
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_Enable ⇒ Object
63 64 65 |
# File 'lib/config.rb', line 63 def self.Package_Enable @@package_enable == 1 end |
.Package_Source_repo ⇒ Object
67 68 69 |
# File 'lib/config.rb', line 67 def self.Package_Source_repo @@package_source_repo end |
.Source_Repo_Path ⇒ Object
39 40 41 |
# File 'lib/config.rb', line 39 def self.Source_Repo_Path @@source_repo_path end |
.Source_Repo_Url ⇒ Object
55 56 57 |
# File 'lib/config.rb', line 55 def self.Source_Repo_Url @@source_repo_url end |
.Source_Spec_Path ⇒ Object
43 44 45 |
# File 'lib/config.rb', line 43 def self.Source_Spec_Path @@source_spec_path end |