Sha256: 0d80908fe69e877e531997f4221a8a5e81b5c53022263a5fb7b4236b6f9cf4d3

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

# coding: utf-8

require 'rinfo/engine'
require 'git'

class Rinfo
  autoload :VERSION, 'rinfo/version'

  class << self
    def info
      <<-RINFO.gsub(/^ {6}/, '')
      {
        "Deployed By": "#{author}",
        "Deployed At": "#{date}",
        "Rails Env": "#{Rails.env}",
        "Branch": "#{branch}",
        "Rev": "#{rev}"
      }
      RINFO
    end

    private

    def git
      @git ||= Git.open(root)
    end

    def root
      Rails.root
    end

    def author
      git.config('user.name')
    end

    def date
      git.log.first.date
    end

    def branch
      git.lib.branch_current
    end

    def rev
      git.revparse('HEAD')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rinfo-0.1.0 lib/rinfo.rb