class Object

Public Instance Methods

get_config() click to toggle source
# File lib/git/contest/common.rb, line 44
def get_config
  config_path = File.expand_path($git_contest_config)
  res = YAML.load_file(config_path) || {}
  res["sites"] ||= {}
  res
end
init() click to toggle source
# File lib/git/contest/common.rb, line 14
def init
  init_global
  init_home
end
init_global() click to toggle source
# File lib/git/contest/common.rb, line 19
def init_global
  $git_contest_home   = File.expand_path(ENV['GIT_CONTEST_HOME'] || File.join("~", ".git-contest"))
  $git_contest_config = File.expand_path(ENV['GIT_CONTEST_CONFIG'] || File.join($git_contest_home, "config.yml"))
  if Git.do_no_echo 'branch'
    $MASTER = Git.do 'config --get git.contest.branch.master'
    $PREFIX = Git.do 'config --get git.contest.branch.prefix'
    $ORIGIN = Git.do 'config --get git.contest.origin'
    if $ORIGIN == ''
      $ORIGIN = 'origin'
    end
    $GIT_CONTEST_GIT_OK = true
  else
    $GIT_CONTEST_GIT_OK = false
  end
end
init_home() click to toggle source
# File lib/git/contest/common.rb, line 35
def init_home
  if ! FileTest.exists? $git_contest_home
    FileUtils.mkdir $git_contest_home
  end
  if ! FileTest.exists? $git_contest_config
    FileUtils.touch $git_contest_config
  end
end
is_test_mode?() click to toggle source

test.rb

Copyright © 2013 Hiroyuki Sano <sh19910711 at gmail.com> Licensed under the MIT-License.

# File lib/git/contest/test.rb, line 8
def is_test_mode?
  ENV['TEST_MODE'] === 'TRUE'
end