Class: Environment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/environment.rb

Instance Method Summary collapse

Instance Method Details

#current_branchObject



10
11
12
# File 'app/models/environment.rb', line 10

def current_branch
  last_successful_deployment.andand.branch
end

#pending_changes(branch = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/environment.rb', line 14

def pending_changes(branch = nil)
  branch ||= current_branch
  return nil unless current_branch

  @pending_changes ||= begin
    commits = []
    current_rev = last_successful_deployment.revision
    latest_rev = branch.current_revision

    project.git.log.between(current_rev, latest_rev).each do |commit|
      commits << commit
    end
    commits
  end
end