Sha256: e2ddf1441a0348565707b1dd3167de5bcf7d7eb69bf1c7e45c539fb226aa3b6b

Contents?: true

Size: 875 Bytes

Versions: 16

Compression:

Stored size: 875 Bytes

Contents

# frozen_string_literal: true

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&.new
    end

    def self.config
      new
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ninny-0.1.24 lib/ninny/project_config.rb
ninny-0.1.23 lib/ninny/project_config.rb
ninny-0.1.22.1 lib/ninny/project_config.rb
ninny-0.1.22 lib/ninny/project_config.rb
ninny-0.1.21 lib/ninny/project_config.rb
ninny-0.1.20 lib/ninny/project_config.rb
ninny-0.1.19 lib/ninny/project_config.rb
ninny-0.1.18 lib/ninny/project_config.rb
ninny-0.1.17 lib/ninny/project_config.rb
ninny-0.1.16 lib/ninny/project_config.rb
ninny-0.1.15 lib/ninny/project_config.rb
ninny-0.1.14 lib/ninny/project_config.rb
ninny-0.1.13 lib/ninny/project_config.rb
ninny-0.1.12 lib/ninny/project_config.rb
ninny-0.1.11 lib/ninny/project_config.rb
ninny-0.1.10 lib/ninny/project_config.rb