Class: Yade::Common::Config::ComposerConfig
- Inherits:
-
Settingslogic
- Object
- Settingslogic
- Yade::Common::Config::ComposerConfig
- Defined in:
- lib/yade/common/config/composer_config.rb
Constant Summary collapse
- @@yade_home =
File.join(File.('~'), '.yade')
- @@config_path =
File.join(@@yade_home, 'yade-composer-config.yml')
- @@composer_home =
File.join(File.('~'), 'yade', 'composer')
Class Attribute Summary collapse
-
.composer_home ⇒ Object
Returns the value of attribute composer_home.
-
.config_path ⇒ Object
Returns the value of attribute config_path.
-
.yade_home ⇒ Object
Returns the value of attribute yade_home.
Class Method Summary collapse
Class Attribute Details
.composer_home ⇒ Object
Returns the value of attribute composer_home.
17 18 19 |
# File 'lib/yade/common/config/composer_config.rb', line 17 def composer_home @composer_home end |
.config_path ⇒ Object
Returns the value of attribute config_path.
17 18 19 |
# File 'lib/yade/common/config/composer_config.rb', line 17 def config_path @config_path end |
.yade_home ⇒ Object
Returns the value of attribute yade_home.
17 18 19 |
# File 'lib/yade/common/config/composer_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/composer_config.rb', line 47 def self.[](key) return @@yade_home if key == :yade_home return @@config_path if key == :config_path return @@composer_home if key == :composer_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/composer_config.rb', line 20 def self.load! if no_config_file? $stderr.puts <<-HELP ******** You haven't set up your Yade Composer settings file. ********** Please do the following: 1. Create the yade base directory and download the yade-composer-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-composer-config%2Eyml%2Eexample/raw?ref=master' \ -o yade-composer-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/composer_config.rb', line 41 def self.no_config_file? !File.exists?(@source) end |
.write! ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yade/common/config/composer_config.rb', line 55 def self.write! d = YAML.load_file(@@config_path) d['git_api_url'] = self.git_api_url d['git_username'] = self.git_username d['git_password'] = self.git_password d['git_token'] = self.git_token d['docker_registry_url'] = self.docker_registry_url d['docker_registry_username'] = self.docker_registry_username d['docker_registry_password'] = self.docker_registry_password File.open(@@config_path, 'w') { |f| f.write d.to_yaml } end |