Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib/tasks/changelog.rake
blob: c652a35dbbd3386601d092275880f151e3b0c0eb (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require File.join(File.dirname(__FILE__), "../gitorious")

def each_version
  pattern = /^v(\d+\.\d+\.\d+)/

  `#{ENV["GIT"] || "git"} tag -n`.split("\n").reverse.each do |line|
    next unless line =~ pattern
    nothing, version, *description = line.split(pattern)
    yield version, description.join
  end
end

def list_versions
  puts "\nAvailable versions"
  newest = true

  each_version do |version, description|
    color = newest ? "32" : "31"
    newest = false

    if Gitorious::VERSION == version
      print "-> \033[1m\033[#{color}mv#{version}\033[0m"
    else
      print "   v#{version}"
    end

    puts "    #{description}"
  end
end

def describe_version(version)
  puts "\nChanges between v#{Gitorious::VERSION} and v#{version}:"

  each_version do |v, description|
    next if v <= Gitorious::VERSION || v > version
    puts v
    puts `#{ENV['GIT'] || 'git'} tag -l v#{v} -n9999`.split("\n")[2..-1].join("\n")
  end
end

def show_changelog
  system("#{ENV['GIT'] || 'git'} fetch git://gitorious.org/gitorious/mainline.git 2> /dev/null")

  if ENV["VERSION"]
    describe_version(ENV["VERSION"])
  else
    list_versions
  end
end


task :changelog do
  show_changelog
end

namespace :versioning do
  desc "List commits not versioned yet"
  task :unreleased do
    log_spec = "v#{Gitorious::VERSION}..HEAD"
    command = %Q[#{ENV['GIT'] || "git"} log #{log_spec}]
    header = "Commits not yet versioned in Gitorious:"
    puts "\n#{header}"
    puts "=" * header.size + "\n"
    exec command
  end

  desc "Show current and available Gitorious versions and details about individual versions"
  task :changelog do
    show_changelog
  end
end