hoe-git 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/CHANGELOG.rdoc +7 -1
  2. data/lib/hoe/git.rb +49 -11
  3. metadata +1 -1
@@ -1,4 +1,10 @@
1
+ === 1.1.0 / 2009-06-23
2
+
3
+ * Allow configurable release tag prefixes.
4
+ * Add git:changelog to make release notes easier.
5
+ * Make the git:tag task respect a TAG env var.
6
+ * Minor cleanups.
7
+
1
8
  === 1.0.0 / 2009-06-23
2
9
 
3
10
  * Birthday!
4
-
@@ -1,30 +1,68 @@
1
1
  # Tasks provided:
2
2
  #
3
- # * <tt>git:tag</t> -- Tag the current version and push the tag to all
4
- # the <tt>git_remotes</tt>. This task is added as a dependency of
5
- # the built-in <tt>release</tt> task.
3
+ # * <tt>git:tag</tt> -- Tag the current version and push the tag to
4
+ # all the <tt>git_remotes</tt>. This task is added as a dependency
5
+ # of the built-in <tt>release</tt> task. The tag will be
6
+ # <tt>"v#{version}"</tt> unless <tt>TAG</tt> or <tt>VERSION</tt> are
7
+ # set in the environment.
8
+ #
9
+ # * <tt>git:changelog</tt> -- Format a changelog of all the commits
10
+ # since the last release, or since the <tt>FROM</tt> env var if it's
11
+ # provided. Commits that weren't made by a project developer are
12
+ # attributed.
6
13
 
7
14
  module Hoe::Git
8
- VERSION = "1.0.0"
15
+ VERSION = "1.1.0"
16
+
17
+ ##
18
+ # Optional: What do you want at the front of your release tags?
19
+ # [default: "v"]
20
+
21
+ attr_accessor :git_release_tag_prefix
9
22
 
10
23
  ##
11
- # Optional: Which remotes do you want to push tags, etc to?
24
+ # Optional: Which remotes do you want to push tags, etc. to?
12
25
  # [default: %w(origin)]
13
26
 
14
27
  attr_accessor :git_remotes
15
28
 
16
29
  def initialize_git
17
- self.git_remotes = %w(origin)
30
+ self.git_release_tag_prefix = "v"
31
+ self.git_remotes = %w(origin)
18
32
  end
19
33
 
20
34
  def define_git_tasks
21
- desc "Create and push a v#{version} tag."
35
+ desc "Print the current changelog."
36
+ task "git:changelog" do
37
+ tags = `git tag -l 'v*'`.split "\n"
38
+ tag = ENV["FROM"] || tags.last
39
+ cmd = "git log #{tag}.. '--format=tformat:%s|||%cN|||%cE'"
40
+
41
+ changes = `#{cmd}`.split("\n").map do |line|
42
+ msg, author, email = line.split("|||").map { |e| e.empty? ? nil : e }
43
+
44
+ developer = author.include?(author) || email.include?(email)
45
+ change = [msg]
46
+ change << "[#{author || email}]" unless developer
47
+
48
+ change.join " "
49
+ end
50
+
51
+ puts "=== #{ENV["VERSION"] || 'NEXT'} / #{Time.new.strftime '%Y-%m-%d'}"
52
+ puts
53
+
54
+ changes.each do |change|
55
+ puts "* #{change}"
56
+ end
57
+ end
58
+
59
+ desc "Create and push a TAG (default v#{version})."
22
60
  task "git:tag" do
23
- t = "v#{version}"
24
- v = ENV["VERSION"] || version
61
+ tag = ENV["TAG"]
62
+ tag ||= "#{git_release_tag_prefix}#{ENV["VERSION"] || version}"
25
63
 
26
- sh "git tag -f #{t}"
27
- git_remotes.each { |r| sh "git push -f #{r} tag #{t}" }
64
+ sh "git tag -f #{tag}"
65
+ git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" }
28
66
  end
29
67
 
30
68
  task :release => "git:tag"
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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette