class TripAdvisor::BuildInfo

Attributes

author[RW]
branch[RW]
date[R]
sha1[RW]
version[RW]

Public Class Methods

new(repo) click to toggle source
# File lib/trip_advisor/build.rb, line 10
def initialize(repo)
  @date = Time.now
  @branch = repo.branches.detect { |b| b.canonical_name == repo.head.name }.name
  name = repo.config['user.name']
  email = repo.config['user.email']
  @author = "#{name} <#{email}>"
  @sha1 = repo.head.target
end

Public Instance Methods

timestamp() click to toggle source
# File lib/trip_advisor/build.rb, line 19
def timestamp
  date.utc.strftime("%Y%m%d%H%M%S")
end
to_hash() click to toggle source
# File lib/trip_advisor/build.rb, line 23
def to_hash
  Hash.new.tap do |info|
    info['version'] = self.version
    info['branch'] = self.branch
    info['sha1'] = self.sha1
    info['author'] = self.author
    info['date'] = self.date.utc.iso8601
  end
end