Class: Yade::Common::Config::AppConfig
- Inherits:
-
Settingslogic
- Object
- Settingslogic
- Yade::Common::Config::AppConfig
- Defined in:
- lib/yade/common/config/app_config.rb
Constant Summary collapse
- @@yade_home =
File.join(File.('~'), '.yade')
- @@config_path =
File.join(@@yade_home, 'yade-config.yml')
- @@project_home =
File.join(File.('~'), 'yade', 'projects')
Class Attribute Summary collapse
-
.config_path ⇒ Object
Returns the value of attribute config_path.
-
.project_home ⇒ Object
Returns the value of attribute project_home.
-
.yade_home ⇒ Object
Returns the value of attribute yade_home.
Class Method Summary collapse
Class Attribute Details
.config_path ⇒ Object
Returns the value of attribute config_path.
17 18 19 |
# File 'lib/yade/common/config/app_config.rb', line 17 def config_path @config_path end |
.project_home ⇒ Object
Returns the value of attribute project_home.
17 18 19 |
# File 'lib/yade/common/config/app_config.rb', line 17 def project_home @project_home end |
.yade_home ⇒ Object
Returns the value of attribute yade_home.
17 18 19 |
# File 'lib/yade/common/config/app_config.rb', line 17 def yade_home @yade_home end |
Class Method Details
.[](key) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/yade/common/config/app_config.rb', line 47 def self.[](key) return @@yade_home if key == :yade_home return @@config_path if key == :config_path return @@project_home if key == :project_home super end |
.load! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/yade/common/config/app_config.rb', line 20 def self.load! if no_config_file? $stderr.puts <<-HELP ******** You haven't set up your Yade settings file. ********** Please do the following: 1. Create the yade base directory and download the yade-config.yml example: mkdir -p ~/.yade cd ~/.yade curl --header 'PRIVATE-TOKEN: <your token>' \ 'http://gitlab.dzbw.de/client/v4/projects/366/repository/files/yade-config%2Eyml%2Eexample/raw?ref=master' \ -o yade-config.yml 2. Have a look at the settings in that file and change it according to your needs. HELP Process.exit(1) end super end |
.no_config_file? ⇒ Boolean
no config
41 42 43 |
# File 'lib/yade/common/config/app_config.rb', line 41 def self.no_config_file? !File.exists?(@source) end |
.write! ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/yade/common/config/app_config.rb', line 55 def self.write! d = YAML.load_file(@@config_path) d['yade_url'] = self.yade_url File.open(@@config_path, 'w') { |f| f.write d.to_yaml } end |