hoe-git 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG.rdoc +4 -0
  2. data/lib/hoe/git.rb +35 -4
  3. metadata +2 -2
@@ -1,3 +1,7 @@
1
+ === 1.2.0 / 2009-07-01
2
+
3
+ * Add git-svn support for git:tag and git:changelog.
4
+
1
5
  === 1.1.3 / 2009-06-27
2
6
 
3
7
  * Changelog should use author, not committer.
@@ -13,7 +13,7 @@ class Hoe #:nodoc:
13
13
  module Git
14
14
 
15
15
  # Duh.
16
- VERSION = "1.1.3"
16
+ VERSION = "1.2.0"
17
17
 
18
18
  # What do you want at the front of your release tags?
19
19
  # [default: <tt>"v"</tt>]
@@ -31,10 +31,11 @@ class Hoe #:nodoc:
31
31
  end
32
32
 
33
33
  def define_git_tasks #:nodoc:
34
+ return unless File.exist? ".git"
34
35
 
35
36
  desc "Print the current changelog."
36
37
  task "git:changelog" do
37
- tags = `git tag -l '#{git_release_tag_prefix}*'`.split "\n"
38
+ tags = git_tags
38
39
  tag = ENV["FROM"] || tags.last
39
40
  range = [tag, "HEAD"].compact.join ".."
40
41
  cmd = "git log #{range} '--format=tformat:%s|||%aN|||%aE'"
@@ -65,8 +66,7 @@ class Hoe #:nodoc:
65
66
  tag = ENV["TAG"]
66
67
  tag ||= "#{git_release_tag_prefix}#{ENV["VERSION"] || version}"
67
68
 
68
- sh "git tag -f #{tag}"
69
- git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" }
69
+ git_tag_and_push tag
70
70
  end
71
71
 
72
72
  task :release_sanity do
@@ -78,5 +78,36 @@ class Hoe #:nodoc:
78
78
  task :release => "git:tag"
79
79
 
80
80
  end
81
+
82
+ def git_svn?
83
+ File.exist? ".git/svn"
84
+ end
85
+
86
+ def git_tag_and_push tag
87
+ if git_svn?
88
+ sh "git svn tag #{tag} -m 'Tagging #{tag} release.'"
89
+ else
90
+ sh "git tag -f #{tag}"
91
+ git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" }
92
+ end
93
+ end
94
+
95
+ def git_tags # FIX: order by date, not alpha!
96
+ if git_svn?
97
+ source = `git config svn-remote.svn.tags`.strip
98
+
99
+ unless source =~ %r{refs/remotes/(.*)/\*$}
100
+ abort "Can't discover git-svn tag scheme from #{source}"
101
+ end
102
+
103
+ prefix = $1
104
+
105
+ `git branch -r`.split("\n").
106
+ collect { |t| t.strip }.
107
+ select { |t| t =~ %r{^#{prefix}/#{git_release_tag_prefix}} }
108
+ else
109
+ `git tag -l '#{git_release_tag_prefix}*'`.split "\n"
110
+ end
111
+ end
81
112
  end
82
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-27 00:00:00 -07:00
12
+ date: 2009-07-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency