Top Level Namespace

Defined Under Namespace

Modules: CommandLine, Contest, Git

Instance Method Summary collapse

Instance Method Details

#get_configObject



44
45
46
47
48
49
# 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

#initObject



14
15
16
17
# File 'lib/git/contest/common.rb', line 14

def init
  init_global
  init_home
end

#init_globalObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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_homeObject



35
36
37
38
39
40
41
42
# 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?Boolean

test.rb

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

Returns:

  • (Boolean)


8
9
10
# File 'lib/git/contest/test.rb', line 8

def is_test_mode?
  ENV['TEST_MODE'] === 'TRUE'
end