Class: DockerManager::Config
- Inherits:
-
Object
- Object
- DockerManager::Config
- Defined in:
- lib/dockermanager/config.rb
Constant Summary collapse
- KEYS =
{ env: { required: i[host docker_user remote_directory remote_postgres_db_container local_postgres_db_container git_branch] }, registry: { required: i[login password], optional: i[server] }, required: i[git_repository], optional: i[containers_to_restart] }
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
-
#initialize(env:, config_file:) ⇒ Config
constructor
A new instance of Config.
- #local_deploy_path ⇒ Object
- #local_docker_path ⇒ Object
- #local_git_tmp_path ⇒ Object
- #project_root_path ⇒ Object
Constructor Details
#initialize(env:, config_file:) ⇒ Config
Returns a new instance of Config.
17 18 19 20 |
# File 'lib/dockermanager/config.rb', line 17 def initialize(env:, config_file:) self.env = env self.config = YAML.load_file(config_file) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
15 16 17 |
# File 'lib/dockermanager/config.rb', line 15 def config @config end |
#env ⇒ Object
Returns the value of attribute env.
15 16 17 |
# File 'lib/dockermanager/config.rb', line 15 def env @env end |
Instance Method Details
#local_deploy_path ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/dockermanager/config.rb', line 45 def local_deploy_path return @local_deploy_path if defined?(@local_deploy_path) @local_deploy_path = "#{local_docker_path}/deploy" unless Dir.exist?(@local_deploy_path) puts "invalid local deploy path : #{@local_deploy_path}" exit 5 end @local_deploy_path end |
#local_docker_path ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/dockermanager/config.rb', line 35 def local_docker_path return @local_docker_path if defined?(@local_docker_path) @local_docker_path = "#{project_root_path}/docker" unless Dir.exist?(@local_docker_path) puts "invalid local docker path : #{@local_docker_path}" exit 4 end @local_docker_path end |
#local_git_tmp_path ⇒ Object
55 56 57 |
# File 'lib/dockermanager/config.rb', line 55 def local_git_tmp_path @local_git_tmp_path ||= "#{local_deploy_path}/tmp" end |
#project_root_path ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dockermanager/config.rb', line 22 def project_root_path return @project_root_path if defined?(@project_root_path) if @project_root_path = value(key: :project_root_path, required: false) unless Dir.exist?(@project_root_path) puts "invalid project_root_path : #{@project_root_path}" exit 3 end else @project_root_path = "./" end @project_root_path end |