anchorman 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ Copyright © 2013 infews
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,70 @@
1
+ # Anchorman
2
+ [![Build Status](https://travis-ci.org/infews/anchorman.png)](https://travis-ci.org/infews/anchorman)
3
+
4
+ _When you need trusted news, you turn to an anchorman._
5
+
6
+ Simply put, Anchorman scans your commit log and builds release notes for your project.
7
+
8
+ These notes are build in [Markdown][md] and live in a `release_notes` directory off of your project root. When viewed locally they will be readable. When viewed on Github they will be rendered as nice HTML.
9
+
10
+ There is also an option to generate HTML versions of these files using [Github Flavored Markdown][gfm] for posting/hosting elsewhere.
11
+
12
+ If the repo is cloned from Github commit SHAs will be linked to Github's commits page.
13
+
14
+ If a commit message includes syntax for manipulating a story at [Pivotal Tracker's][pt] via a post-commit hook, the story id will be linked to Tracker.
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ gem 'anchorman'
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install anchorman
29
+
30
+ ## Usage
31
+
32
+ Anchorman is fairly simple-minded. It generates files with a little bit of formatting, but not much. The resulting files are meant as good starting points for more human-readable release notes.
33
+
34
+ $ anchorman notes
35
+
36
+ Generates a `release_notes/release_notes.md` off of the root of your project. Has a simple header and will have a bullet list of commit information from your entire repo.
37
+
38
+ $ anchorman notes --from=<ref> --to=<ref>
39
+
40
+ Builds notes only for commits between two git refs. If not supplied, `to` defaults to `HEAD`. Can be combined with other options.
41
+
42
+ $ anchorman notes --name=<filename>
43
+
44
+ Writes out notes to `release_notes/<filename>.md`.Can be combined with other options.
45
+
46
+ ### coming soon
47
+
48
+ $ anchorman html
49
+
50
+ Builds `release_notes/html` with html versions of all Markdown files in `release_notes`
51
+
52
+ Samples can be found in this repository.
53
+
54
+
55
+
56
+
57
+ ## Contributing
58
+
59
+ 1. Checkout the [backlog at Pivotal Tracker][backlog]
60
+ 1. Fork it
61
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 1. Push to the branch (`git push origin my-new-feature`)
64
+ 1. Create new Pull Request
65
+
66
+
67
+ [pt]: http://www.pivotaltracker.com
68
+ [md]: http://daringfireball.net/projects/markdown/
69
+ [gfm]: https://help.github.com/articles/github-flavored-markdown
70
+ [backlog]: https://www.pivotaltracker.com/projects/776269
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'anchorman'
3
+
4
+ Anchorman::CLI.start
@@ -0,0 +1,7 @@
1
+ require "thor"
2
+ require "git"
3
+
4
+ require "anchorman/repo"
5
+ require "anchorman/commit_formatter"
6
+ require "anchorman/version"
7
+ require "anchorman/cli"
@@ -0,0 +1,47 @@
1
+ module Anchorman
2
+ class CLI < Thor
3
+
4
+ include Thor::Actions
5
+
6
+ desc "notes", "Generates a draft release notes document"
7
+ method_options from: :string, to: :string, name: "release_notes"
8
+ def notes
9
+ git = open_repo
10
+
11
+ commits = if options[:from]
12
+ git.log.between options[:from], options[:to]
13
+ else
14
+ git.log
15
+ end
16
+
17
+ return unless commits.size
18
+
19
+ say "#{commits.size} commit(s) found - building notes", :green
20
+
21
+ empty_directory 'release_notes'
22
+
23
+ header = "# Release Notes\n\n## Summary\n\n## Changes\n\n"
24
+ formatter = CommitFormatter.new(Repo.new(git))
25
+ notes = commits.collect {|c| formatter.format(c) }.join("\n\n")
26
+
27
+ create_file "release_notes/#{options[:name]}.md" do
28
+ header + notes
29
+ end
30
+
31
+ end
32
+
33
+ no_tasks do
34
+
35
+ def open_repo
36
+ git = Git.open('.')
37
+ git.log.size # this will raise if no repo or no commits
38
+ git
39
+ rescue ArgumentError
40
+ say 'No git repo found', :red
41
+ rescue Git::GitExecuteError
42
+ say 'No git log found', :red
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ module Anchorman
2
+ class CommitFormatter < Struct.new(:repo)
3
+
4
+ def format(commit)
5
+ note = "* SHA: #{repo.commit_url(commit.sha)}\n"
6
+ note << " * #{format_message(commit.message)}\n"
7
+ note << " * #{commit.author.name}, #{commit.author.email}\n"
8
+ note
9
+ end
10
+
11
+ private
12
+
13
+ def format_message(msg)
14
+ link_tracker_stories(msg)
15
+ end
16
+
17
+ def link_tracker_stories(msg)
18
+ msg.gsub(/\[(.*)#(\d+)\]/) do
19
+ "[#{$1}##{$2}](http://www.pivotaltracker.com/story/#{$2})"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ module Anchorman
2
+ class Repo < Struct.new(:git_repo)
3
+
4
+ def remote
5
+ git_repo.remote
6
+ end
7
+
8
+ def is_github?
9
+ remote &&
10
+ remote.name == "origin" &&
11
+ remote.url &&
12
+ remote.url.match(/github\.com/)
13
+ end
14
+
15
+ def commit_url(sha)
16
+ return sha unless is_github?
17
+
18
+ "[#{sha}](#{github_url_for 'commit', sha})"
19
+ end
20
+
21
+ private
22
+
23
+ def github_url_for(*components)
24
+ [remote.url[0..-5], *components].join('/')
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module Anchorman
2
+ VERSION = "0.5.0"
3
+ end
@@ -0,0 +1,17 @@
1
+ # Anchorman Release Notes
2
+
3
+ ## Summary
4
+
5
+ First Release. A real MVP.
6
+
7
+ ## v 0.5.0
8
+
9
+ * First Release
10
+ * Support for `anchorman notes --from=<ref> --to=<ref> --name=<output file>`
11
+ * The commit history is a mess due to misuse of `git config` for the git repos under test
12
+ * Adding [Travis](http://travis-ci.org) builds.
13
+ * SHA: [ca66e8240b7cf1a86412e3463bc54c6d96fb7a34](https://github.com/infews/anchorman/commit/ca66e8240b7cf1a86412e3463bc54c6d96fb7a34)
14
+ * Davis W. Frank, dwfrank+github@infe.ws
15
+ * Building wrong Github URL to the commit [Fixes #45905835](http://www.pivotaltracker.com/story/45905835)
16
+ * SHA: [01946ca9bf3d0752ee48a0f3247d0f120bee6214](https://github.com/infews/anchorman/commit/01946ca9bf3d0752ee48a0f3247d0f120bee6214)
17
+ * Davis W. Frank, dwfrank+github@infe.ws
@@ -0,0 +1,9 @@
1
+ # Release Notes
2
+
3
+ ## Summary
4
+
5
+ ## Changes
6
+
7
+ * SHA: a8dbf3a2fd044e57655113801df1a20d932e4270
8
+ * This is another commit
9
+ * Ron, scotchyscotch@example.com
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anchorman
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - infews
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: git
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: cucumber
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: aruba
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Extract release notes from your git log
111
+ email:
112
+ - dwfrank+github@infe.ws
113
+ executables:
114
+ - anchorman
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - bin/anchorman
119
+ - lib/anchorman/cli.rb
120
+ - lib/anchorman/commit_formatter.rb
121
+ - lib/anchorman/repo.rb
122
+ - lib/anchorman/version.rb
123
+ - lib/anchorman.rb
124
+ - release_notes/release_notes.md
125
+ - release_notes/sample.md
126
+ - LICENSE.md
127
+ - README.md
128
+ homepage: http://github.com/infews/anchorman
129
+ licenses: []
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ segments:
141
+ - 0
142
+ hash: -963451566946939241
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
150
+ - 0
151
+ hash: -963451566946939241
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 1.8.25
155
+ signing_key:
156
+ specification_version: 3
157
+ summary: Executable that scans your git log for specific release tags and builds a
158
+ directory of nicely formatted set of Markdown files ready for detailed editing into
159
+ release notes.
160
+ test_files: []