class DeployChanges::Commit

Attributes

repo[R]

Public Class Methods

new(repo) click to toggle source
# File lib/deploy_changes/commit.rb, line 5
def initialize(repo)
  @repo = repo
end

Public Instance Methods

last_commit() click to toggle source
# File lib/deploy_changes/commit.rb, line 17
def last_commit
  return unless File.exist?(last_deploy_commit_file)

  File.read(last_deploy_commit_file).strip
end
write_head!(sha1 = nil) click to toggle source
# File lib/deploy_changes/commit.rb, line 9
def write_head!(sha1 = nil)
  system("mkdir -p #{dir}")

  sha1 ||= repo.head.target_id

  File.write(last_deploy_commit_file, sha1)
end

Private Instance Methods

dir() click to toggle source
# File lib/deploy_changes/commit.rb, line 25
def dir
  ".deploy_changes"
end
last_deploy_commit_file() click to toggle source
# File lib/deploy_changes/commit.rb, line 29
def last_deploy_commit_file
  "#{dir}/last-deploy-commit"
end