Module: CardanoUp::Configs
- Defined in:
- lib/cardano-up/configs.rb
Overview
Installing configs Cardano environments
Class Method Summary collapse
-
.exist?(env) ⇒ Boolean
Check all necessary config files for particular environment exist.
-
.get(env) ⇒ Object
Get all necessary config files for particular environment.
Class Method Details
.exist?(env) ⇒ Boolean
Check all necessary config files for particular environment exist.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cardano-up/configs.rb', line 9 def self.exist?(env) CardanoUp.configure_default unless CardanoUp.configured? raise CardanoUp::EnvNotSupportedError, env unless CardanoUp::ENVS.include?(env) configs = CardanoUp.config config_dir_env = FileUtils.mkdir_p(File.join(configs[:config_dir], env)) config_files = CardanoUp::CONFIG_FILES not_existing = [] config_files.each do |file| conf_file_path = File.join(config_dir_env, file) not_existing << conf_file_path unless File.exist?(conf_file_path) end not_existing.empty? end |
.get(env) ⇒ Object
Get all necessary config files for particular environment.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cardano-up/configs.rb', line 27 def self.get(env) CardanoUp.configure_default unless CardanoUp.configured? raise CardanoUp::EnvNotSupportedError, env unless CardanoUp::ENVS.include?(env) configs = CardanoUp.config config_urls = CardanoUp::Utils.config_urls(env) config_dir_env = FileUtils.mkdir_p(File.join(configs[:config_dir], env)) config_urls.each do |url| CardanoUp::Utils.wget(url, File.join(config_dir_env, File.basename(url))) end end |