Class: GitFonky::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/git_fonky/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_envObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/git_fonky/parser.rb', line 5

def self.parse_env
  new.parse_gfonk_repos_env_var
rescue NoMethodError
  warn "The $GFONK_REPOS environment variable is not properly set."
  warn "Please set the variable to point to a string list of repository names separated only by commas (NO SPACES)."
  warn "You can optionally specify the branch, origin remote and fork remote to use for a given repository by separating each with a colon."
  warn "EXAMPLE:"
  warn "export GFONK_REPOS='repo1,repo2:branch,repo3:branch_name:origin_remote_name:fork_remote_name'"
  exit 1
end

Instance Method Details

#parse_gfonk_repos_env_varObject



16
17
18
19
20
21
22
# File 'lib/git_fonky/parser.rb', line 16

def parse_gfonk_repos_env_var
  keys = [:repo, :branch, :origin_remote, :fork_remote]

  split_repo_details.map do |values|
    keys.zip(values).to_h
  end
end