Class: CaptainHook::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/captain_hook/base.rb', line 5

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

#repoObject

Returns the value of attribute repo.



3
4
5
# File 'lib/captain_hook/base.rb', line 3

def repo
  @repo
end

Instance Method Details

#handle_post_commit(&block) ⇒ Object



17
18
19
20
21
22
# File 'lib/captain_hook/base.rb', line 17

def handle_post_commit(&block)
  post_commit = CaptainHook::Events::PostCommit.new(:repo => self.repo)
  if block_given?
    CaptainHook::DSL::HandlePostCommit.new(post_commit).run(&block)
  end
end

#handle_post_receive(data = nil, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/captain_hook/base.rb', line 9

def handle_post_receive(data = nil, &block)
  data = data || $stdin
  post_receive = post_receive_from_data(data)
  
  dsl = CaptainHook::DSL::HandlePostReceive.new(post_receive)
  dsl.run(&block) if block_given?
end