Sha256: 28c79a8b95132f100dad49787a0915025aa9b55373e1fc5fda7a3a4357884e2c

Contents?: true

Size: 857 Bytes

Versions: 9

Compression:

Stored size: 857 Bytes

Contents

module Ninny
  class ProjectConfig
    attr_reader :config

    def initialize
      @config = TTY::Config.new
      @config.filename = '.ninny'
      @config.extname = '.yml'
      @config.prepend_path Dir.pwd
      @config.read
    end

    def write(*args)
      config.write(*args)
    end

    def set(*args)
      config.set(*args)
    end

    def repo_type
      config.fetch(:repo_type)
    end

    def deploy_branch
      config.fetch(:deploy_branch)
    end

    def gitlab_project_id
      config.fetch(:gitlab_project_id)
    end

    def gitlab_endpoint
      config.fetch(:gitlab_endpoint, default: "https://gitlab.com/api/v4")
    end

    def repo
      return unless repo_type

      repo_class = { gitlab: Repository::Gitlab }[repo_type.to_sym]
      repo_class && repo_class.new
    end

    def self.config
      new
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ninny-0.1.9 lib/ninny/project_config.rb
ninny-0.1.8 lib/ninny/project_config.rb
ninny-0.1.6 lib/ninny/project_config.rb
ninny-0.1.5 lib/ninny/project_config.rb
ninny-0.1.4 lib/ninny/project_config.rb
ninny-0.1.3 lib/ninny/project_config.rb
ninny-0.1.2 lib/ninny/project_config.rb
ninny-0.1.1 lib/ninny/project_config.rb
ninny-0.1.0 lib/ninny/project_config.rb