hoe-git 1.1.1 → 1.1.2

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 (4) hide show
  1. data/CHANGELOG.rdoc +5 -0
  2. data/README.rdoc +30 -12
  3. data/lib/hoe/git.rb +66 -58
  4. metadata +7 -10
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.1.2 / 2009-06-26
2
+
3
+ * Doc cleanups.
4
+ * Veto releases when the index is dirty.
5
+
1
6
  === 1.1.1 / 2009-06-23
2
7
 
3
8
  * Use git_release_tag_prefix more consistently, handle unreleased case.
data/README.rdoc CHANGED
@@ -1,37 +1,55 @@
1
- = hoe-git
1
+ = Hoe Loves Git
2
2
 
3
3
  * http://github.com/jbarnette/hoe-git
4
4
 
5
5
  == Description
6
6
 
7
- A Hoe plugin for tighter Git integration. This plugin provides a
8
- git:tag task to automate release tagging and pushing, a git:changelog
9
- task to make release notes easier, and I expect it'll learn a few more
10
- tricks in the future.
11
-
12
- See the Hoe::Git module for more docs and a few configuration options.
7
+ A set of Hoe plugins for tighter Git integration. Provides tasks to
8
+ automate release tagging and pushing and changelog generation. I
9
+ expect it'll learn a few more tricks in the future.
13
10
 
14
11
  == Examples
15
12
 
16
13
  # in your Rakefile
17
14
  Hoe.plugin :git
18
15
 
19
- # in your shell
16
+ === Autogenerating the Changelog
17
+
20
18
  $ rake git:changelog
21
19
 
22
- This will take all the commits since your last release and format 'em
23
- nicely for an RDoc changelog. Commits that weren't made by a developer
24
- will be attributed.
20
+ This takes all the commit messages since your last release and formats
21
+ 'em into a nice RDoc fragment. If you specify <tt>VERSION</tt>, it'll
22
+ be used in the changelog fragment. If you specify <tt>FROM</tt>, it'll
23
+ be used as a starting point for the changelog instead of your last
24
+ release.
25
+
26
+ Commits that weren't made by a project developer will be attributed,
27
+ like this:
28
+
29
+ * Did a thing with the stuff. [I R Contributor]
30
+
31
+ === Tagging and Sanity Checking a Release
25
32
 
26
33
  $ rake release VERSION=1.0.0
27
34
 
28
35
  In addition to the normal RubyForge release process, this will create
29
- and push a <tt>v1.0.0</tt> tag.
36
+ and push a <tt>v1.0.0</tt> tag. It'll also abort the release if your
37
+ index is dirty, or if there are untracked files present.
38
+
39
+ == Dependencies
40
+
41
+ Hoe and Git, obviously. I wouldn't be surprised if things don't quite
42
+ work for git < 1.6.3.
30
43
 
31
44
  == Installation
32
45
 
33
46
  $ gem install hoe-git
34
47
 
48
+ == TODO
49
+
50
+ * Release tags are sorted lexicographically right now, which won't
51
+ work for long.
52
+
35
53
  == License
36
54
 
37
55
  Copyright 2009 John Barnette (jbarnette@rubyforge.org)
data/lib/hoe/git.rb CHANGED
@@ -1,71 +1,79 @@
1
- # Tasks provided:
2
- #
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.
13
-
14
- module Hoe::Git
15
- VERSION = "1.1.1"
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
22
-
23
- ##
24
- # Optional: Which remotes do you want to push tags, etc. to?
25
- # [default: %w(origin)]
26
-
27
- attr_accessor :git_remotes
28
-
29
- def initialize_git
30
- self.git_release_tag_prefix = "v"
31
- self.git_remotes = %w(origin)
32
- end
1
+ class Hoe #:nodoc:
2
+
3
+ # This module is a Hoe plugin. You can set its attributes in your
4
+ # Rakefile Hoe spec, like this:
5
+ #
6
+ # Hoe.plugin :git
7
+ #
8
+ # Hoe.spec "myproj" do
9
+ # self.git_release_tag_prefix = "REL_"
10
+ # self.git_remotes << "myremote"
11
+ # end
12
+
13
+ module Git
14
+
15
+ # Duh.
16
+ VERSION = "1.1.2"
17
+
18
+ # What do you want at the front of your release tags?
19
+ # [default: <tt>"v"</tt>]
20
+
21
+ attr_accessor :git_release_tag_prefix
22
+
23
+ # Which remotes do you want to push tags, etc. to?
24
+ # [default: <tt>%w(origin)</tt>]
25
+
26
+ attr_accessor :git_remotes
27
+
28
+ def initialize_git #:nodoc:
29
+ self.git_release_tag_prefix = "v"
30
+ self.git_remotes = %w(origin)
31
+ end
32
+
33
+ def define_git_tasks #:nodoc:
34
+
35
+ desc "Print the current changelog."
36
+ task "git:changelog" do
37
+ tags = `git tag -l '#{git_release_tag_prefix}*'`.split "\n"
38
+ tag = ENV["FROM"] || tags.last
39
+ range = [tag, "HEAD"].compact.join ".."
40
+ cmd = "git log #{range} '--format=tformat:%s|||%cN|||%cE'"
33
41
 
34
- def define_git_tasks
35
- desc "Print the current changelog."
36
- task "git:changelog" do
37
- tags = `git tag -l '#{git_release_tag_prefix}*'`.split "\n"
38
- tag = ENV["FROM"] || tags.last
39
- range = [tag, "HEAD"].compact.join ".."
40
- cmd = "git log #{range} '--format=tformat:%s|||%cN|||%cE'"
42
+ changes = `#{cmd}`.split("\n").map do |line|
43
+ msg, author, email = line.split("|||").map { |e| e.empty? ? nil : e }
41
44
 
42
- changes = `#{cmd}`.split("\n").map do |line|
43
- msg, author, email = line.split("|||").map { |e| e.empty? ? nil : e }
45
+ developer = author.include?(author) || email.include?(email)
46
+ change = [msg]
47
+ change << "[#{author || email}]" unless developer
44
48
 
45
- developer = author.include?(author) || email.include?(email)
46
- change = [msg]
47
- change << "[#{author || email}]" unless developer
49
+ change.join " "
50
+ end
48
51
 
49
- change.join " "
52
+ puts "=== #{ENV["VERSION"] || 'NEXT'} / #{Time.new.strftime '%Y-%m-%d'}"
53
+ puts
54
+
55
+ changes.each { |change| puts "* #{change}" }
50
56
  end
51
57
 
52
- puts "=== #{ENV["VERSION"] || 'NEXT'} / #{Time.new.strftime '%Y-%m-%d'}"
53
- puts
58
+ desc "Create and push a TAG " +
59
+ "(default #{git_release_tag_prefix}#{version})."
60
+
61
+ task "git:tag" do
62
+ tag = ENV["TAG"]
63
+ tag ||= "#{git_release_tag_prefix}#{ENV["VERSION"] || version}"
54
64
 
55
- changes.each do |change|
56
- puts "* #{change}"
65
+ sh "git tag -f #{tag}"
66
+ git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" }
67
+ end
68
+
69
+ task :release_sanity do
70
+ unless `git status` =~ /^nothing to commit/
71
+ abort "Won't release: Dirty index or untracked files present!"
72
+ end
57
73
  end
58
- end
59
74
 
60
- desc "Create and push a TAG (default v#{version})."
61
- task "git:tag" do
62
- tag = ENV["TAG"]
63
- tag ||= "#{git_release_tag_prefix}#{ENV["VERSION"] || version}"
75
+ task :release => "git:tag"
64
76
 
65
- sh "git tag -f #{tag}"
66
- git_remotes.each { |remote| sh "git push -f #{remote} tag #{tag}" }
67
77
  end
68
-
69
- task :release => "git:tag"
70
78
  end
71
79
  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.1
4
+ version: 1.1.2
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-23 00:00:00 -07:00
12
+ date: 2009-06-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,15 +30,12 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.0
33
+ version: 2.3.1
34
34
  version:
35
35
  description: |-
36
- A Hoe plugin for tighter Git integration. This plugin provides a
37
- git:tag task to automate release tagging and pushing, a git:changelog
38
- task to make release notes easier, and I expect it'll learn a few more
39
- tricks in the future.
40
-
41
- See the Hoe::Git module for more docs and a few configuration options.
36
+ A set of Hoe plugins for tighter Git integration. Provides tasks to
37
+ automate release tagging and pushing and changelog generation. I
38
+ expect it'll learn a few more tricks in the future.
42
39
  email:
43
40
  - jbarnette@rubyforge.org
44
41
  executables: []
@@ -84,6 +81,6 @@ rubyforge_project: hoe-git
84
81
  rubygems_version: 1.3.4
85
82
  signing_key:
86
83
  specification_version: 3
87
- summary: A Hoe plugin for tighter Git integration
84
+ summary: A set of Hoe plugins for tighter Git integration
88
85
  test_files: []
89
86