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.
5 6 7 8 9 10 11 |
# File 'lib/ninny/project_config.rb', line 5 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.
3 4 5 |
# File 'lib/ninny/project_config.rb', line 3 def config @config end |
Class Method Details
.config ⇒ Object
44 45 46 |
# File 'lib/ninny/project_config.rb', line 44 def self.config new end |
Instance Method Details
#deploy_branch ⇒ Object
25 26 27 |
# File 'lib/ninny/project_config.rb', line 25 def deploy_branch config.fetch(:deploy_branch) end |
#gitlab_endpoint ⇒ Object
33 34 35 |
# File 'lib/ninny/project_config.rb', line 33 def gitlab_endpoint config.fetch(:gitlab_endpoint, default: "https://gitlab.com/api/v4") end |
#gitlab_project_id ⇒ Object
29 30 31 |
# File 'lib/ninny/project_config.rb', line 29 def gitlab_project_id config.fetch(:gitlab_project_id) end |
#repo ⇒ Object
37 38 39 40 41 42 |
# File 'lib/ninny/project_config.rb', line 37 def repo return unless repo_type repo_class = { gitlab: Repository::Gitlab }[repo_type.to_sym] repo_class && repo_class.new end |
#repo_type ⇒ Object
21 22 23 |
# File 'lib/ninny/project_config.rb', line 21 def repo_type config.fetch(:repo_type) end |
#set(*args) ⇒ Object
17 18 19 |
# File 'lib/ninny/project_config.rb', line 17 def set(*args) config.set(*args) end |
#write(*args) ⇒ Object
13 14 15 |
# File 'lib/ninny/project_config.rb', line 13 def write(*args) config.write(*args) end |