changes_since 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b890338bd4aada0e0e9b68b47b139e4d901b2dc3
4
- data.tar.gz: ee3e6c35489896cba7d5a511d0f4c17a6318d748
3
+ metadata.gz: bd00ae0f3ab4d177cb56ff9618a7128792ce3022
4
+ data.tar.gz: 8777633088042b5d38fc646ac7e80a3122413600
5
5
  SHA512:
6
- metadata.gz: 6424f13bc414ca403a439d81b5df1396da03cb2a0ab52fd019445b666aa2eed987d246cd98673f058c35bb10cf92b38223315ef6922f5f17202318da7d3c85b5
7
- data.tar.gz: b951f9aa4b28fd17cb375aa10b27b9ae67cd0549efcaaecd0a7b20c34cee2634b59621a15afb8ead093ddac091687e3939fff2b2d3dd5837983fbd6fdb52fe9e
6
+ metadata.gz: 5023be7e52096c8fdee3a9e5859362e37cc22acc32a147de5c92473129147465c5f7e38f2582be568d6a651b0e123eb01764b88ec3d3a58ff6cac7813afcab33
7
+ data.tar.gz: 2d6eac7fa678b56392f443fea7057728283d02feb0ba3bc500b76a5f74a98288e500a6a206ee599e6c981a7968d63f014299f8018c2dab949de10bcce883e0b9
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in changes_since.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ashwin Hegde
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.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ changes_since
2
+ =============
3
+ A Changelog tool that helps you display a neat changelog of all pull requests merged since a certain tag.
4
+ This works well if you use a pull request based process, i.e. every commit made to master is via a pull request.
5
+
6
+ Example:
7
+
8
+ From https://github.com/resque/resque
9
+
10
+ `ChangesSince.fetch('v1.25.2')`
11
+ ```
12
+ Unclassified:
13
+
14
+ * won't be needing rack-test as well (Dan Buch)
15
+ * Extracted a new WorkerQueueList class out of Rescue::Worker (Einar Jonsson)
16
+ * implementation of Backend connection with Hash (Ryan Biesemeyer)
17
+ * update readme.md with hooks link (Ryan Biesemeyer)
18
+ * speed up test suite (Ryan Biesemeyer)
19
+ * Added worker_registry_tests (Ryan Biesemeyer)
20
+ * add info about queue priority to readme (Ryan Biesemeyer)
21
+ * Fix line and file endings. (Ryan Biesemeyer)
22
+ * increase coverage for process coordinator (Ryan Biesemeyer)
23
+ * Add Resque.configure documentation to README (Ryan Biesemeyer)
24
+ ...
25
+ ```
26
+ If you want to use enhanced functionality, you can tag pull requests with #bug, #internal, or #public
27
+ The 'Unclassified' would then change to Bug, Internal or Public respectively.
28
+
29
+ There are some additional options you can use
30
+
31
+ Author filter:
32
+
33
+ `ChangesSince.fetch('v1.25.2', { :author_filter => ["Dan Buch", "Steve Klabnik"] })`
34
+ ```
35
+ Unclassified:
36
+
37
+ * won't be needing rack-test as well (Dan Buch)
38
+ * Fixed typos (Steve Klabnik)
39
+ * Make sure the filicide is justified (Steve Klabnik)
40
+ * Spelling mistake correction. (Steve Klabnik)
41
+ * Fix spelling of "languages" in readme (Steve Klabnik)
42
+ * Fix daemonize option (Steve Klabnik)
43
+ * Add wrapper for JSON encoding exceptions because yay consistency (Steve Klabnik)
44
+ * The resque-2.0 tests are so noisy! (Steve Klabnik)
45
+ ...
46
+ ```
47
+
48
+ `ChangesSince.fetch('v1.25.2', { :all => true })` - Tries to extract additional interesting commits
49
+
50
+ You can also pass in some team logic.
51
+
52
+ Example:
53
+
54
+ `TEAMS = {
55
+ "Team 1" => ["Dan Buch", "Einar Jonsson"],
56
+ "Team 2" => ["Ryan Biesemeyer", "Steve Klabnik"]
57
+ }`
58
+
59
+ `ChangesSince.fetch('v1.25.2', {}, TEAMS)`
60
+ ```
61
+ *Team 1*
62
+
63
+ Unclassified:
64
+
65
+ * won't be needing rack-test as well (Dan Buch)
66
+ * Extracted a new WorkerQueueList class out of Rescue::Worker (Einar Jonsson)
67
+
68
+ *Team 2*
69
+
70
+ Unclassified:
71
+
72
+ * update readme.md with hooks link (Ryan Biesemeyer)
73
+ * speed up test suite (Ryan Biesemeyer)
74
+ * add info about queue priority to readme (Ryan Biesemeyer)
75
+ * Added worker_registry_tests (Ryan Biesemeyer)
76
+ * Add Resque.configure documentation to README (Ryan Biesemeyer)
77
+ * Typo in comment (Ryan Biesemeyer)
78
+ * Attempt to infer queue from worker class (Ryan Biesemeyer)
79
+ * increase coverage for process coordinator (Ryan Biesemeyer)
80
+ * Fix line and file endings. (Ryan Biesemeyer)
81
+ * implementation of Backend connection with Hash (Ryan Biesemeyer)
82
+ * Feature/exits for real (Steve Klabnik)
83
+ * Make sure the filicide is justified (Steve Klabnik)
84
+ ```
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task :default => :spec
8
+ task :test => :spec
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'changes_since/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "changes_since"
8
+ spec.version = ChangesSince::VERSION
9
+ spec.authors = ["Ashwin Hegde"]
10
+ spec.email = ["ahegde@zendesk.com"]
11
+ spec.summary = "Git Changes since a tag"
12
+ spec.description = "Shows you all the merged pull requests since a certain git tag in a nice format"
13
+ spec.homepage = "http://rubygems.org/gems/changes_since"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake", '10.1.1'
23
+ spec.add_development_dependency 'test-unit'
24
+ spec.add_dependency "git"
25
+ end
@@ -1,10 +1,17 @@
1
1
  class ChangesSince::ChangelogPrinter
2
- attr_reader :teams, :options
2
+ attr_reader :teams, :options, :repo
3
3
 
4
- def initialize(commits, teams, options)
4
+ TAGS = {
5
+ :public => 'Public',
6
+ :bug => 'Bugs',
7
+ :internal => 'Internal'
8
+ }
9
+
10
+ def initialize(commits, teams, options, repo)
5
11
  @commits = commits
6
12
  @teams = teams
7
13
  @options = options
14
+ @repo = repo
8
15
  end
9
16
 
10
17
  def print!
@@ -26,43 +33,54 @@ class ChangesSince::ChangelogPrinter
26
33
  end
27
34
  next if team_commits.empty?
28
35
  @commits -= team_commits
29
- puts "\n*#{team}*\n"
36
+ if options[:markdown]
37
+ puts "||*#{team}*||Author||PR||"
38
+ else
39
+ puts "\n*#{team}*\n"
40
+ end
30
41
  print_commits!(team_commits)
31
42
  end
32
43
 
33
44
  return if @commits.empty?
34
45
  puts "\n*Other*\n\n"
35
- @commits.each { |commit| print_message(commit, nil, options) }
46
+ @commits.each { |commit| print_message(commit, nil) }
36
47
  end
37
48
 
38
49
  def print_commits!(output_commits)
39
50
  output_commits.sort! { |a, b| a.author.name <=> b.author.name }
40
- {
41
- public: 'Public',
42
- bug: 'Bugs',
43
- internal: 'Internal'
44
- }.each do |type, title|
45
- tagged_commits = output_commits.select { |commit| commit.message.include?("##{type}") }
46
- next if tagged_commits.empty?
47
51
 
48
- puts "\n#{title}:\n\n"
49
- tagged_commits.each { |commit| print_message(commit, type, options) }
50
- output_commits -= tagged_commits
52
+ if options[:tags]
53
+ TAGS.each do |type, title|
54
+ tagged_commits = output_commits.select { |commit| commit.message.include?("##{type}") }
55
+ next if tagged_commits.empty?
56
+
57
+ puts "\n#{title}:\n\n"
58
+ tagged_commits.each { |commit| print_message(commit, type) }
59
+ output_commits -= tagged_commits
60
+ end
61
+ return if output_commits.empty?
62
+ puts "\nUnclassified:\n\n"
51
63
  end
52
64
 
53
- puts "\nUnclassified:\n\n"
54
- output_commits.each { |commit| print_message(commit, nil, options) }
65
+ output_commits.each { |commit| print_message(commit, nil) }
55
66
  end
56
67
 
57
- def print_message(commit, type, options)
68
+ def print_message(commit, type)
58
69
  message_lines = commit.message.split("\n\n")
59
70
  if message_lines.first =~ /Merge pull request/
60
71
  title = message_lines.last
72
+ pr = message_lines.first.split(" from ").first.split("#").last
61
73
  else
62
74
  title = message_lines.first
63
75
  end
64
76
  title.gsub!("##{type}", "") if type
65
77
  branch_author = commit.author.name
66
- puts "* #{title} (#{branch_author}) #{options[:sha] ? commit.sha[0..9] : ''}"
78
+ if options[:markdown]
79
+ text = "|#{title}|#{branch_author}|"
80
+ text << "[##{pr}|#{@repo}/pulls/#{pr}]|" if @repo
81
+ else
82
+ text = "* #{title} (#{branch_author})"
83
+ end
84
+ puts text
67
85
  end
68
86
  end
@@ -2,8 +2,8 @@ class ChangesSince::CommitParser
2
2
  attr_reader :log, :options
3
3
 
4
4
  def initialize(tag, options)
5
- git = Git.open(Dir.pwd)
6
- @log = git.log(100000).between(tag)
5
+ git = Git.open(Dir.pwd)
6
+ @log = git.log(100000).between(tag)
7
7
  @options = options
8
8
  end
9
9
 
@@ -0,0 +1,3 @@
1
+ module ChangesSince
2
+ VERSION = "0.0.6"
3
+ end
data/lib/changes_since.rb CHANGED
@@ -8,12 +8,45 @@ require 'optparse'
8
8
  require 'set'
9
9
 
10
10
  class ChangesSince
11
- def self.fetch(tag, options={}, teams=nil)
11
+ def self.fetch(tag, teams=nil, repo=nil)
12
+ options = parse_options
12
13
  parser = CommitParser.new(tag, options)
13
14
  commits = parser.parse
14
- printer = ChangelogPrinter.new(commits, teams, options)
15
+ printer = ChangelogPrinter.new(commits, teams, options, repo)
15
16
  printer.print!
16
17
  end
18
+
19
+ def self.parse_options
20
+ options = {}
21
+ OptionParser.new do |opts|
22
+ opts.banner = "Usage: script/changes_since TAG [options]"
23
+
24
+ opts.on("-a", "--all", "Consider all interesting commits ([AI-1234] or [ZD#1234] or #bug/public/internal), not just PR merges") do |a|
25
+ options[:all] = a
26
+ end
27
+
28
+ opts.on("-s", "--sha", "Include commit sha in the output") do |s|
29
+ options[:sha] = s
30
+ end
31
+
32
+ opts.on("-f", "--filter [authors]", "Limit to authors matching the passed string(s). Comma-separated list works.") do |authors|
33
+ options[:author_filter] = authors.split(",")
34
+ end
35
+
36
+ opts.on("-t", "--tags", "Group commits by public, internal or bugs") do |t|
37
+ options[:tags] = t
38
+ end
39
+
40
+ opts.on("-r", "--risk", "Group commits by high, medium or low risk") do |r|
41
+ options[:risk] = r
42
+ end
43
+
44
+ opts.on("-m", "--markdown", "Use tables in Atlassian as markdown") do |m|
45
+ options[:markdown] = m
46
+ end
47
+ end.parse!
48
+ options
49
+ end
17
50
  end
18
51
 
19
52
  require 'changes_since/commit_parser'
@@ -0,0 +1,6 @@
1
+ require 'test/unit'
2
+ require 'changes_since'
3
+
4
+ class ChangesSinceTest < Test::Unit::TestCase
5
+
6
+ end
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: changes_since
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Hegde
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-07 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 10.1.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 10.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: git
15
57
  requirement: !ruby/object:Gem::Requirement
@@ -32,9 +74,17 @@ executables: []
32
74
  extensions: []
33
75
  extra_rdoc_files: []
34
76
  files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - changes_since.gemspec
83
+ - lib/changes_since.rb
35
84
  - lib/changes_since/changelog_printer.rb
36
85
  - lib/changes_since/commit_parser.rb
37
- - lib/changes_since.rb
86
+ - lib/changes_since/version.rb
87
+ - test/changes_since_test.rb
38
88
  homepage: http://rubygems.org/gems/changes_since
39
89
  licenses:
40
90
  - MIT
@@ -59,4 +109,5 @@ rubygems_version: 2.0.14
59
109
  signing_key:
60
110
  specification_version: 4
61
111
  summary: Git Changes since a tag
62
- test_files: []
112
+ test_files:
113
+ - test/changes_since_test.rb