module GGSM::Token

Public Instance Methods

check_token() click to toggle source
# File lib/ggsm/mr/token.rb, line 3
def check_token
  ggsm_path = '.git/ggsm'
  unless File.exist?(ggsm_path)
    Dir.mkdir(ggsm_path)
  end

  config_path = "#{ggsm_path}/TOKEN"

  if !File.exist?(config_path) || '' == IO.read(config_path).strip || IO.readlines(config_path)[0].strip == ''
    file = File.new(config_path, 'w')
    file << "\n# 请输入GitLab private-token"
    file.close
    return false
  end

  return true
end