Sha256: ea48a685f9afe24f37ebe1937f388a46571382c24c4e886b89b36fb6a31ed3e8

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

module DeployNotes
  # Class for capistrano deployments
  class Cap
    def get
      "[#{branch_name}] - [#{deploy_time}] - [#{commit_info}]"
    end

    def branch_name
      `tail -1 #{current}/../../revisions.log | cut -d' ' -f2`
    end

    def deploy_time
      deploy_time = `stat -c '%y' #{current}/REVISION`
      deploy_time.to_time.to_s(:db)
    end

    def commit_info
      `git --git-dir=#{repo} --work-tree #{current} log #{revision} -n1 --pretty=format:[%ae:%s][%cr][%h]`
    end

    private

    def current
      Rails.root.to_s
    end

    def repo
      "#{current}/../../repo"
    end

    def revision
      `cat #{current}/REVISION | tr -d '\n'`
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deploy_notes-0.1.2 lib/deploy_notes/cap.rb