Class: BuilderPlugin

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

Overview

BuilderPlugin is the superclass of all CC.rb plugins. It does not provide any functionality except a basic initializer that accepts as an argument the current project.

CC.rb plugins offer a rich notification system for tracking every aspect of the build lifecycle. In rough order, they are:

  • polling_source_control

  • no_new_revisions_detected OR new_revisions_detected(revisions)

  • build_requested

  • queued

  • timed_out

  • build_initiated

  • configuration_modified

  • build_started

  • build_finished

  • build_broken OR build_fixed

  • build_loop_failed

  • sleeping

Direct Known Subclasses

BuildReaper, BuilderStatus, EmailNotifier, LogPublisher, MinimalConsoleLogger, ProjectLogger

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (BuilderPlugin) initialize(project)

A new instance of BuilderPlugin



22
23
24
# File 'lib/builder_plugins/builder_plugin.rb', line 22

def initialize(project)
  @project = project
end

Instance Attribute Details

- (Object) project (readonly)

Returns the value of attribute project



20
21
22
# File 'lib/builder_plugins/builder_plugin.rb', line 20

def project
  @project
end

Class Method Details

+ (Boolean) known_event?(event_name)

Returns:

  • (Boolean)


27
28
29
# File 'lib/builder_plugins/builder_plugin.rb', line 27

def known_event?(event_name)
  self.instance_methods(false).map { |m| m.to_s }.include? event_name.to_s
end

+ (Object) load_all



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/builder_plugins/builder_plugin.rb', line 31

def load_all
  plugins_to_load.each do |plugin|
    if can_load_immediately?(plugin)
      load_plugin(File.basename(plugin))
    elsif File.directory?(plugin)
      init_path = File.join(plugin, 'init.rb')
      if File.file?(init_path)
        load_plugin(init_path)
      else
        log.error("No init.rb found in plugin directory #{plugin}")
      end
    end
  end
end

Instance Method Details

- (Object) build_broken(build, previous_build)

Called by Project after the completion of a build if the previous build was successful and this one is a failure.



117
118
# File 'lib/builder_plugins/builder_plugin.rb', line 117

def build_broken(build, previous_build)
end

- (Object) build_finished(build)

Called by Project immediately after the build has finished running.



113
114
# File 'lib/builder_plugins/builder_plugin.rb', line 113

def build_finished(build)
end

- (Object) build_fixed(build, previous_build)

Called by Project after the completion of a build if the previous build was a failure and this one was successful.



121
122
# File 'lib/builder_plugins/builder_plugin.rb', line 121

def build_fixed(build, previous_build)
end

- (Object) build_initiated

Called by Project at the start of a new build before any other build events.



100
101
# File 'lib/builder_plugins/builder_plugin.rb', line 100

def build_initiated
end

- (Object) build_loop_failed(exception)

Called by Project if the build fails internally with a CC.rb exception.



125
126
# File 'lib/builder_plugins/builder_plugin.rb', line 125

def build_loop_failed(exception)
end

- (Object) build_requested

Called by Project to indicate that a build has explicitly been requested by the user.



86
87
# File 'lib/builder_plugins/builder_plugin.rb', line 86

def build_requested
end

- (Object) build_started(build)

Called by Project after some basic logging and the configuration_modified check and just before the build begins running,



109
110
# File 'lib/builder_plugins/builder_plugin.rb', line 109

def build_started(build)
end

- (Object) configuration_modified

Called by Project at the start of a new build to indicate that the configuration has been modified, after which the build is aborted.



105
106
# File 'lib/builder_plugins/builder_plugin.rb', line 105

def configuration_modified
end

- (Object) new_revisions_detected(revisions)

Called by ChangeInSourceControlTrigger to indicate that new revisions were detected.



82
83
# File 'lib/builder_plugins/builder_plugin.rb', line 82

def new_revisions_detected(revisions)
end

- (Object) no_new_revisions_detected

Called by ChangeInSourceControlTrigger to indicate that no new revisions have been detected.



78
79
# File 'lib/builder_plugins/builder_plugin.rb', line 78

def no_new_revisions_detected
end

- (Object) polling_source_control

Called by ChangeInSourceControlTrigger to indicate that it is about to poll source control.



74
75
# File 'lib/builder_plugins/builder_plugin.rb', line 74

def polling_source_control
end

- (Object) queued

Called by BuildSerializer if it another build is still running and it cannot acquire the build serialization lock. It will retry until it times out. Occurs only if build serialization is enabled in your CC.rb configuration.



91
92
# File 'lib/builder_plugins/builder_plugin.rb', line 91

def queued
end

- (Object) sleeping

Called by Project at the end of a build to indicate that the build loop is once again sleeping.



129
130
# File 'lib/builder_plugins/builder_plugin.rb', line 129

def sleeping
end

- (Object) timed_out

Called by BuildSerializer if it times out attempting to acquire the build serialization lock due to another build still running. Occurs only if build serialization is enabled in your CC.rb configuration.



96
97
# File 'lib/builder_plugins/builder_plugin.rb', line 96

def timed_out
end