Class: Bozo::Hooks::Teamcity

Inherits:
Object
  • Object
show all
Includes:
ClassNameHelpers
Defined in:
lib/bozo/hooks/teamcity.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/bozo/hooks/teamcity.rb', line 32

def method_missing(method, *args)
  if method.to_s =~ /^(pre|post)_(.+)/
    send "log_#{$1}_step".to_sym, $2
  else
    super
  end
end

Class Method Details

.hosted_in_teamcity?Boolean

Returns whether teamcity is hosting bozo

Returns:

  • (Boolean)


45
46
47
# File 'lib/bozo/hooks/teamcity.rb', line 45

def self.hosted_in_teamcity?
  not ENV['TEAMCITY_VERSION'].nil?
end

Instance Method Details

#post_compileObject



17
18
19
20
21
# File 'lib/bozo/hooks/teamcity.rb', line 17

def post_compile
  return unless Teamcity.hosted_in_teamcity?
  puts "##teamcity[compilationFinished compiler='Bozo']"
  log_post_step :compile
end

#post_testObject



23
24
25
26
27
28
29
30
# File 'lib/bozo/hooks/teamcity.rb', line 23

def post_test
  return unless Teamcity.hosted_in_teamcity?

  report
  report_dotnetcoverage

  log_post_step :test
end

#pre_compileObject



7
8
9
10
11
12
13
14
15
# File 'lib/bozo/hooks/teamcity.rb', line 7

def pre_compile
  return unless Teamcity.hosted_in_teamcity?
  log_pre_step :compile

  puts "##teamcity[buildNumber '#{version}']"
  # currently a general compiler which wraps everything. Once a compiler hook is added can distinguish
  # each specific compiler
  puts "##teamcity[compilationStarted compiler='Bozo']"
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/bozo/hooks/teamcity.rb', line 40

def respond_to?(method)
  method.to_s =~ /^(pre|post)_(.+)/ or super
end