class Taeval::GitCheckout::Config

Attributes

attr[R]
branch[R]
fork_parent[R]
prefix[R]
solution[R]
source[R]
tokens[R]

Public Class Methods

new(conf_h) click to toggle source
# File lib/taeval/git_checkout/config.rb, line 11
def initialize(conf_h)
  @tokens = conf_h.fetch('token', '')
  file    = open(path_of(conf_h['source']))
  @source = file.readlines
                .map { |line| line.split(';').map(&:strip) }
                .map { |e| {name: e[0], id: e[1], host: e[2], user: e[3], repo: e[4]} }

  @attr               = {}
  @attr[:private]     = conf_h.fetch('private', true)
  @attr[:fork]        = conf_h.fetch('fork', false)
  @attr[:forks_count] = conf_h.fetch('forks_count', 0).to_i
  @attr[:fork_parent] = conf_h.fetch('fork_parent', '')

  @branch      = conf_h.fetch('branch', 'main')
  @prefix      = conf_h.fetch('prefix', '')
  
  @solution    = path_of(conf_h.dig('solution', 'path'))
  if !File.exist?(@solution)
    Dir.mkdir @solution
  end
end