primedia-qa_release_tasks 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/bin/git-changelog +44 -0
- data/lib/git/release_notes.rb +18 -6
- data/lib/git/tagger.rb +8 -0
- data/lib/qa_release_tasks.rb +8 -0
- metadata +6 -5
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'spec/rake/spectask'
|
|
7
7
|
require 'lib/qa_release_tasks'
|
8
8
|
|
9
9
|
GEM = "qa_release_tasks"
|
10
|
-
GEM_VERSION =
|
10
|
+
GEM_VERSION = QaReleaseTasks.version
|
11
11
|
AUTHORS = "Jason Noble", "Rein Henrichs"
|
12
12
|
SUMMARY = "A gem that provides workflow driven rake tasks for git QA branch management"
|
13
13
|
|
@@ -20,10 +20,11 @@ spec = Gem::Specification.new do |s|
|
|
20
20
|
s.summary = SUMMARY
|
21
21
|
s.description = s.summary
|
22
22
|
s.authors = AUTHORS
|
23
|
+
s.executables = ['git-changelog']
|
23
24
|
|
24
25
|
s.require_path = 'lib'
|
25
26
|
s.autorequire = GEM
|
26
|
-
s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{lib,spec}/**/*")
|
27
|
+
s.files = %w(LICENSE README.rdoc Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
|
27
28
|
end
|
28
29
|
|
29
30
|
task :default => :spec
|
data/bin/git-changelog
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
2
|
+
require File.join(File.dirname(__FILE__), '../lib/qa_release_tasks')
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Git Changelog - Show a list of changes by version."
|
8
|
+
|
9
|
+
opts.separator ''
|
10
|
+
|
11
|
+
opts.on_tail('-h', '--help', 'Displays this help message') do
|
12
|
+
puts opts
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on_tail("--version", "Show version") do
|
17
|
+
puts 'git changelog version ' + QaReleaseTasks.version
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-l', '--limit [LIMIT]', Integer, 'Maximum commits for each version, default is 20') do |limit|
|
22
|
+
options[:limit] = limit || 20
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('--no-limit', 'Show all commits for each version') do
|
26
|
+
options[:limit] = false
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on('-a', '--all', 'Show all versions') do
|
30
|
+
options[:all] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on('--from [VERSION]',
|
34
|
+
'Start changelog at this version. Defaults to most recent version.') do |from|
|
35
|
+
options[:from] = from
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on('--to [VERSION]',
|
39
|
+
'End changelog at this version. Defaults to second most recent version.') do |to|
|
40
|
+
options[:to] = to
|
41
|
+
end
|
42
|
+
end.parse!
|
43
|
+
|
44
|
+
Git::ReleaseNotes.new(options).annotate!
|
data/lib/git/release_notes.rb
CHANGED
@@ -3,17 +3,28 @@ module Git
|
|
3
3
|
require 'enumerator'
|
4
4
|
include CLI
|
5
5
|
include Commands
|
6
|
+
|
7
|
+
attr_reader :options
|
8
|
+
def initialize(options = {})
|
9
|
+
@options = options
|
10
|
+
@limit = options[:limit].nil? ? 20 : options[:limit]
|
11
|
+
end
|
6
12
|
|
7
13
|
def annotate!
|
8
14
|
assert_is_git_repo
|
9
15
|
tags = get_tags.reverse
|
10
16
|
error "No version tags available." if tags.empty?
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
if options[:all]
|
19
|
+
start_index = 0
|
20
|
+
end_index = tags.length - 1
|
21
|
+
else
|
22
|
+
start_tag = options[:from] || ask("Start at which tag?", tags[0], tags)
|
23
|
+
start_index = tags.index(start_tag)
|
24
|
+
end_tag = options[:to] || ask("End at which tag?", tags[start_index + 1] || tags[start_index], tags)
|
25
|
+
end_index = tags.index(end_tag) + 1 # include end tag
|
26
|
+
end
|
15
27
|
puts
|
16
|
-
end_index = tags.index(end_tag) + 1 # include end tag
|
17
28
|
|
18
29
|
start_index.upto(end_index-1) do |i|
|
19
30
|
start = tags[i]
|
@@ -21,11 +32,12 @@ module Git
|
|
21
32
|
range = ''
|
22
33
|
range << "refs/tags/#{finish}.." if finish # log until end tag if there is an end tag
|
23
34
|
range << "refs/tags/#{start}"
|
24
|
-
log = `git log --no-merges --pretty=format:"%h %s" #{range}`.strip
|
35
|
+
log = `git log --no-merges --pretty=format:"%h %s" #{range}`.strip.split("\n")
|
25
36
|
next if log.empty?
|
26
37
|
puts "#{start}"
|
27
38
|
puts "=" * start.length
|
28
|
-
puts log
|
39
|
+
puts @limit ? log[0,@limit] : log
|
40
|
+
puts " ... and #{log.size - @limit} more." if @limit && log.size > @limit
|
29
41
|
puts
|
30
42
|
end
|
31
43
|
end
|
data/lib/git/tagger.rb
CHANGED
@@ -42,6 +42,14 @@ module Git
|
|
42
42
|
system("git pull") &&
|
43
43
|
response = %x(git merge master)
|
44
44
|
|
45
|
+
unless $?.success?
|
46
|
+
`git reset --hard`
|
47
|
+
error <<-EOS
|
48
|
+
Conflicts when updating the QA branch from master prevented a release from being created.
|
49
|
+
Please resolve these conflicts and then re-run rake qa:release:new.
|
50
|
+
EOS
|
51
|
+
end
|
52
|
+
|
45
53
|
unless response.include?("Fast forward") || response.include?('Already up-to-date.')
|
46
54
|
warn "There are outstanding changes in qa_branch that may need to be merged into master"
|
47
55
|
end
|
data/lib/qa_release_tasks.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primedia-qa_release_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Noble
|
@@ -10,14 +10,14 @@ autorequire: qa_release_tasks
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-
|
14
|
-
default_executable:
|
13
|
+
date: 2009-04-02 00:00:00 -07:00
|
14
|
+
default_executable: git-changelog
|
15
15
|
dependencies: []
|
16
16
|
|
17
17
|
description: A gem that provides workflow driven rake tasks for git QA branch management
|
18
18
|
email:
|
19
|
-
executables:
|
20
|
-
|
19
|
+
executables:
|
20
|
+
- git-changelog
|
21
21
|
extensions: []
|
22
22
|
|
23
23
|
extra_rdoc_files:
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- LICENSE
|
28
28
|
- README.rdoc
|
29
29
|
- Rakefile
|
30
|
+
- bin/git-changelog
|
30
31
|
- lib/cli.rb
|
31
32
|
- lib/git
|
32
33
|
- lib/git/commands.rb
|