File: git.rake

package info (click to toggle)
ruby-ffi 1.0.11debian-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,488 kB
  • sloc: ansic: 6,608; ruby: 6,167; xml: 151; sh: 74; makefile: 12
file content (41 lines) | stat: -rw-r--r-- 995 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

if HAVE_GIT

namespace :git do

  # A prerequisites task that all other tasks depend upon
  task :prereqs

  desc 'Show tags from the Git repository'
  task :show_tags => 'git:prereqs' do |t|
    puts %x/git tag/
  end

  desc 'Create a new tag in the Git repository'
  task :create_tag => 'git:prereqs' do |t|
    v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
    abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version

#    tag = "%s-%s" % [PROJ.name, PROJ.version]
    tag = "%s" % [ PROJ.version ]
    msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"

    puts "Creating Git tag '#{tag}'"
    unless system "git tag -a -m '#{msg}' #{tag}"
      abort "Tag creation failed"
    end

#    if %x/git remote/ =~ %r/^origin\s*$/
#      unless system "git push origin #{tag}"
#        abort "Could not push tag to remote Git repository"
#      end
#    end
  end

end  # namespace :git

#task 'gem:release' => 'git:create_tag'

end  # if HAVE_GIT

# EOF