Class: Ninny::ProjectConfig
- Inherits:
-
Object
- Object
- Ninny::ProjectConfig
- Defined in:
- lib/ninny/project_config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #deploy_branch ⇒ Object
- #gitlab_endpoint ⇒ Object
- #gitlab_project_id ⇒ Object
-
#initialize ⇒ ProjectConfig
constructor
A new instance of ProjectConfig.
- #repo ⇒ Object
- #repo_type ⇒ Object
- #set(*args) ⇒ Object
- #write(*args) ⇒ Object
Constructor Details
#initialize ⇒ ProjectConfig
Returns a new instance of ProjectConfig.
7 8 9 10 11 12 13 |
# File 'lib/ninny/project_config.rb', line 7 def initialize @config = TTY::Config.new @config.filename = '.ninny' @config.extname = '.yml' @config.prepend_path Dir.pwd @config.read end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/ninny/project_config.rb', line 5 def config @config end |
Class Method Details
.config ⇒ Object
46 47 48 |
# File 'lib/ninny/project_config.rb', line 46 def self.config new end |
Instance Method Details
#deploy_branch ⇒ Object
27 28 29 |
# File 'lib/ninny/project_config.rb', line 27 def deploy_branch config.fetch(:deploy_branch) end |
#gitlab_endpoint ⇒ Object
35 36 37 |
# File 'lib/ninny/project_config.rb', line 35 def gitlab_endpoint config.fetch(:gitlab_endpoint, default: 'https://gitlab.com/api/v4') end |
#gitlab_project_id ⇒ Object
31 32 33 |
# File 'lib/ninny/project_config.rb', line 31 def gitlab_project_id config.fetch(:gitlab_project_id) end |
#repo ⇒ Object
39 40 41 42 43 44 |
# File 'lib/ninny/project_config.rb', line 39 def repo return unless repo_type repo_class = { gitlab: Repository::Gitlab }[repo_type.to_sym] repo_class&.new end |
#repo_type ⇒ Object
23 24 25 |
# File 'lib/ninny/project_config.rb', line 23 def repo_type config.fetch(:repo_type) end |
#set(*args) ⇒ Object
19 20 21 |
# File 'lib/ninny/project_config.rb', line 19 def set(*args) config.set(*args) end |
#write(*args) ⇒ Object
15 16 17 |
# File 'lib/ninny/project_config.rb', line 15 def write(*args) config.write(*args) end |