Class: Push

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
app/models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parsed_payloadObject

Returns the value of attribute parsed_payload.



34
35
36
# File 'app/models.rb', line 34

def parsed_payload
  @parsed_payload
end

Class Method Details

.deployedObject



92
93
94
# File 'app/models.rb', line 92

def self.deployed
  Push.all(:status=>:deployed)
end

Instance Method Details

#[](property) ⇒ Object



68
69
70
# File 'app/models.rb', line 68

def [](property)
  parse_payload[property]
end

#branchObject



80
81
82
# File 'app/models.rb', line 80

def branch
  self['ref'].split('/').last
end

#find_repositoryObject



96
97
98
# File 'app/models.rb', line 96

def find_repository
  Repository.first(:name=>repo_name, :branch=>branch)
end

#master?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'app/models.rb', line 84

def master?
  branch == 'master'
end

#repo_nameObject



76
77
78
# File 'app/models.rb', line 76

def repo_name
  self['repository']['name']
end

#repo_urlObject



72
73
74
# File 'app/models.rb', line 72

def repo_url
  self['repository']['url']
end

#short_commit_hashObject



88
89
90
# File 'app/models.rb', line 88

def short_commit_hash
  self['after'][0..6]
end

#tracked?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'app/models.rb', line 64

def tracked?
  Repository.ordered.any? { |r| r.name == repo_name && r.branch == branch }
end