Module: Config

Extended by:
TtyIntegration
Defined in:
lib/config.rb

Class Method Summary collapse

Methods included from TtyIntegration

bar, cmd, error, green, pastel, prompt, red, success, table, yellow

Class Method Details

.initObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/config.rb', line 11

def self.init
  project_name = cmd.run!("git remote -v | grep origin | head -n1 | awk '{print $2}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//'").out
  file = "#{Dir.home}/.config/gitsflow/#{project_name.gsub("\n","")}/config.yml"
  config = TTY::Config.new
  config.filename = file

  begin
    result = config.read(file).transform_keys(&:to_sym)   
    $GITLAB_PROJECT_ID = result[:GITLAB_PROJECT_ID]
    $GITLAB_TOKEN = result[:GITLAB_TOKEN]
    $GITLAB_URL_API = result[:GITLAB_URL_API]
    $GITLAB_EMAIL = result[:GITLAB_EMAIL]
    $GITLAB_LISTS = result[:GITLAB_LISTS].split(',')
    $GITLAB_NEXT_RELEASE_LIST = result[:GITLAB_NEXT_RELEASE_LIST]
    $GIT_BRANCH_MASTER = result[:GIT_BRANCH_MASTER]
    $GIT_BRANCH_DEVELOP = result[:GIT_BRANCH_DEVELOP]
    $GIT_BRANCHES_STAGING= result[:GIT_BRANCHES_STAGING].split(',')
    $SFLOW_TEMPLATE_RELEASE= result[:SFLOW_TEMPLATE_RELEASE]
    $SFLOW_TEMPLATE_RELEASE_DATE_FORMAT= result[:SFLOW_TEMPLATE_RELEASE_DATE_FORMAT]

  rescue => e

  end
end