Module: ArchiveUploader::Git

Defined in:
lib/archive_uploader/git.rb

Class Method Summary collapse

Class Method Details

.dataObject



24
25
26
27
28
29
30
31
32
# File 'lib/archive_uploader/git.rb', line 24

def data
  {
    :commit => get_commit,
    :timestamp => get_timestamp,
    :branch => get_branch,
    :author_name => get_author_name,
    :author_email => get_author_email
  }
end

.get_author_emailObject



12
13
14
# File 'lib/archive_uploader/git.rb', line 12

def get_author_email
  `git --no-pager show -s --format='%ae' #{get_commit}`.strip
end

.get_author_nameObject



8
9
10
# File 'lib/archive_uploader/git.rb', line 8

def get_author_name
  `git --no-pager show -s --format='%an' #{get_commit}`.strip
end

.get_branchObject



20
21
22
# File 'lib/archive_uploader/git.rb', line 20

def get_branch
  `git rev-parse --abbrev-ref HEAD`.strip
end

.get_commitObject



16
17
18
# File 'lib/archive_uploader/git.rb', line 16

def get_commit
  `git rev-parse HEAD`.strip
end

.get_timestampObject



4
5
6
# File 'lib/archive_uploader/git.rb', line 4

def get_timestamp
  `git --no-pager show -s --format='%ai' #{get_commit} | awk '{print $1, $2}' | sed 's/-//g;s/://g;s/ //g'`.strip
end