Class: JiraHook

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

Class Method Summary collapse

Class Method Details

.check(keyprefix, argv, config = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/svn_jira_hook.rb', line 25

def self.check(keyprefix, argv, config = nil)
  repo_path = argv[0]
  transaction = argv[1]
  svnlook = 'svnlook'

  #commit_dirs_changed = `#{svnlook} dirs-changed #{repo_path} -t #{transaction}`
  #commit_changed = `#{svnlook} changed #{repo_path} -t #{transaction}`
  commit_author = `#{svnlook} author #{repo_path} -t #{transaction}`.chop
  commit_log = `#{svnlook} log #{repo_path} -t #{transaction}`
  #commit_diff = `#{svnlook} diff #{repo_path} -t #{transaction}`
  #commit_date = `#{svnlook} date #{repo_path} -t #{transaction}`

  if commit_log.nil? || commit_log.empty?
    STDERR.puts("'#{commit_log}' doesn't exist as a issue on Jira")
    exit(1)
  end

  check_log(commit_author, commit_log, keyprefix, config)
end

.configurationObject



15
16
17
18
19
20
21
22
23
# File 'lib/svn_jira_hook.rb', line 15

def self.configuration
  if defined?(SVN_HOOKS_CONFIG_PATH)
    config_file = SVN_HOOKS_CONFIG_PATH
  else
    config_file = '/etc/svn_hooks.yml'
  end

  YAML::load(IO.read(config_file))
end

.init(config = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/svn_jira_hook.rb', line 7

def self.init(config = nil)
  if config
    @@config = config
  else
    @@config = nil
  end
end