git-review-branch 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in git-review-branch.gemspec
4
+ gemspec
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'git_review_branch/cli'
5
+
6
+ GitReviewBranch::CLI.new.review
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "git_review_branch/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "git-review-branch"
7
+ s.version = GitReviewBranch::VERSION
8
+ s.authors = ["Aleksei Gusev"]
9
+ s.email = ["aleksei.gusev@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = "Adds git review-branch command."
12
+ s.description = <<-DSC
13
+ git review-branch will add note for each commit in current branch
14
+ with 'Reviewed-By: Reviewer <reviewer@example.com>.'
15
+ DSC
16
+
17
+ s.rubyforge_project = "git-review-branch"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+
24
+ # specify any dependencies here; for example:
25
+ # s.add_development_dependency "rspec"
26
+ # s.add_runtime_dependency "rest-client"
27
+ s.add_runtime_dependency 'git'
28
+ s.add_runtime_dependency 'thor'
29
+ end
@@ -0,0 +1,33 @@
1
+ require 'thor'
2
+ require 'git_review_branch/git_ext'
3
+
4
+ module GitReviewBranch
5
+ class CLI < Thor
6
+ desc "review", "Add note with Reviewed-By: for each commit in current branch."
7
+ def review
8
+ raise "Current branch is master. Exiting..." if git.current_branch == 'master'
9
+
10
+ commits_to_review = git.log.between("master", git.current_branch)
11
+ commits_to_review.each do |commit|
12
+ note = "".tap do |msg|
13
+ msg << 'Reviewed-By: '
14
+ msg << "#{git.config('user.name')} <#{git.config('user.email')}>"
15
+ end
16
+
17
+ git.lib.add_note(commit, note)
18
+ end
19
+
20
+ system "git push origin refs/notes/*"
21
+ system "git log master..#{git.current_branch}"
22
+ puts
23
+ say "#{commits_to_review.size} commits are marked as reviewed by you.", :green
24
+ end
25
+
26
+ private
27
+
28
+ def git
29
+ # @git ||= Git.open(".", :log => Logger.new(STDOUT))
30
+ @git ||= Git.open(".")
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,11 @@
1
+ require 'git'
2
+
3
+ module GitReviewBranch
4
+ module GitLibExt
5
+ def add_note(commit, note)
6
+ command('notes add -f', ["-m", note, commit.sha])
7
+ end
8
+ end
9
+ end
10
+
11
+ Git::Lib.send(:include, GitReviewBranch::GitLibExt)
@@ -0,0 +1,3 @@
1
+ module GitReviewBranch
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "git_review_branch/version"
2
+ require 'git_review_branch/git_ext'
3
+
4
+ module GitReviewBranch
5
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-review-branch
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Aleksei Gusev
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-18 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: git
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: thor
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: " git review-branch will add note for each commit in current branch\n with 'Reviewed-By: Reviewer <reviewer@example.com>.'\n"
49
+ email:
50
+ - aleksei.gusev@gmail.com
51
+ executables:
52
+ - git-review-branch
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - .gitignore
59
+ - Gemfile
60
+ - README
61
+ - Rakefile
62
+ - bin/git-review-branch
63
+ - git-review-branch.gemspec
64
+ - lib/git_review_branch.rb
65
+ - lib/git_review_branch/cli.rb
66
+ - lib/git_review_branch/git_ext.rb
67
+ - lib/git_review_branch/version.rb
68
+ homepage: ""
69
+ licenses: []
70
+
71
+ post_install_message:
72
+ rdoc_options: []
73
+
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project: git-review-branch
97
+ rubygems_version: 1.8.7
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Adds git review-branch command.
101
+ test_files: []
102
+