Module: Subtrigger

Extended by:
Subtrigger
Included in:
Subtrigger
Defined in:
lib/subtrigger.rb,
lib/subtrigger/email.rb,
lib/subtrigger/trigger.rb

Overview

testing purposes.

Defined Under Namespace

Classes: Email, Trigger

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sendmailObject

Returns the value of attribute sendmail.



92
93
94
# File 'lib/subtrigger.rb', line 92

def sendmail
  @sendmail
end

#svnObject

Returns the value of attribute svn.



92
93
94
# File 'lib/subtrigger.rb', line 92

def svn
  @svn
end

#svn_argsObject

Returns the value of attribute svn_args.



92
93
94
# File 'lib/subtrigger.rb', line 92

def svn_args
  @svn_args
end

Instance Method Details

#configure(&block) ⇒ Object



100
101
102
# File 'lib/subtrigger.rb', line 100

def configure(&block)
  yield self and return self
end

#on(pattern, &block) ⇒ Object

Define a new Trigger object – shortcut method to Trigger#define. To enable method chaining this method returns itself.



124
125
126
127
# File 'lib/subtrigger.rb', line 124

def on(pattern, &block)
  Trigger.define(pattern, &block)
  self
end

#resetObject



94
95
96
97
98
# File 'lib/subtrigger.rb', line 94

def reset
  self.svn      = nil
  self.sendmail = nil
  self.svn_args = nil
end

#run(*args) ⇒ Object

This is the main spark in the program. It runs all available triggers on the repository object created with the two command line arguments: the path to the repository and its revision number.

If an exception occurs, the program will quit with its error message.



115
116
117
118
119
# File 'lib/subtrigger.rb', line 115

def run(*args)
  Trigger.run(Repository.new(*args))
rescue Exception => e
  puts "Error: #{e}" and exit(1)
end

#versionObject

Output the version number for this gem by reading /VERSION



105
106
107
# File 'lib/subtrigger.rb', line 105

def version
  File.read(File.join(File.dirname(__FILE__), *%w{.. VERSION}))
end