reviewr 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,21 @@
1
+ === 0.2.1 / 2010-06-17
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Change the review request email to show information about the
6
+ requested review from the commit message
7
+ * Default rake task to run all the tests
8
+
9
+ * 1 Bug fix:
10
+
11
+ * Let accept use remote repositories other than 'origin'
12
+
13
+ === 0.2.0 / 2010-04-28
14
+
15
+ * 1 major enhancement:
16
+
17
+ * Accept command
18
+
1
19
  === 0.1.3 / 2010-04-13
2
20
 
3
21
  * 1 minor enhancement:
@@ -7,6 +7,7 @@ lib/reviewr.rb
7
7
  lib/reviewr/cli.rb
8
8
  lib/reviewr/git.rb
9
9
  lib/reviewr/mailer.rb
10
+ lib/reviewr/pretend_git.rb
10
11
  lib/reviewr/project.rb
11
12
  lib/reviewr/version.rb
12
13
  lib/reviewr/cli/accept.rb
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
 
3
3
  require 'reviewr/cli'
4
4
  require 'reviewr/git'
5
+ require 'reviewr/pretend_git'
5
6
  require 'reviewr/mailer'
6
7
  require 'reviewr/project'
7
8
  require 'reviewr/version'
@@ -8,7 +8,7 @@ module Reviewr
8
8
  prompt_for_user
9
9
  project.fetch_review_branch
10
10
  project.fetch_master
11
- project.create_review_branch("origin/#{arguments.first}")
11
+ project.create_review_branch("#{project.remote_repo}/#{arguments.first}")
12
12
 
13
13
  unless project.rebase_review
14
14
  output.print "Branch '#{arguments.first}' won't merge cleanly"
@@ -8,6 +8,10 @@ module Reviewr
8
8
 
9
9
  def initialize(args, input = STDIN, output = STDOUT)
10
10
  @command = args.shift
11
+ if @command == "-p"
12
+ Git.instance = PretendGit.new(output)
13
+ @command = args.shift
14
+ end
11
15
  @arguments = args
12
16
  @input, @output = input, output
13
17
  end
@@ -12,12 +12,20 @@ module Reviewr
12
12
 
13
13
  attr_writer :remote_repo
14
14
 
15
- def remote_repo
16
- @remote_repo ||= "origin"
15
+ def last_commit_sha
16
+ execute(%(git show --pretty=format:"%H" HEAD)).split("\n").first
17
+ end
18
+
19
+ def last_commit_subject
20
+ execute(%(git show --pretty=format:"%s" HEAD^)).split("\n").first
17
21
  end
18
22
 
19
- def last_commit
20
- execute('git show --pretty=format:"%H" HEAD').split("\n")[0]
23
+ def last_commit_body
24
+ execute(%(git show --pretty=format:"%b:::::" HEAD^)).split(":::::").first
25
+ end
26
+
27
+ def remote_repo
28
+ @remote_repo ||= "origin"
21
29
  end
22
30
 
23
31
  def rebase(base, branch)
@@ -12,7 +12,7 @@ module Reviewr
12
12
  Pony.mail(:from => @project.user_email,
13
13
  :to => @project.to,
14
14
  :body => body,
15
- :subject => "Code review request from #{@project.user_email}",
15
+ :subject => "Code review request: #{@project.review_subject}",
16
16
  :via => :smtp,
17
17
  :smtp => {
18
18
  :host => 'smtp.gmail.com',
@@ -0,0 +1,47 @@
1
+ module Reviewr
2
+ class PretendGit < Git
3
+ attr_reader :output
4
+
5
+ def initialize(output)
6
+ @output = output
7
+ end
8
+
9
+ def rebase(base, branch)
10
+ pretend_execute("git rebase #{base} #{branch}")
11
+ true
12
+ end
13
+
14
+ def create_branch(branch_name, base)
15
+ pretend_execute("git branch #{branch_name} #{base}")
16
+ end
17
+
18
+ def commit(msg)
19
+ pretend_execute("git commit --allow-empty -m \"#{msg}\"")
20
+ end
21
+
22
+ def change_branch(branch_name)
23
+ pretend_execute("git checkout #{branch_name}")
24
+ end
25
+
26
+ def fetch(branch_name)
27
+ pretend_execute("git fetch #{remote_repo} #{branch_name}")
28
+ end
29
+
30
+ def push_branch(branch_name)
31
+ pretend_execute("git push #{remote_repo} #{branch_name}")
32
+ end
33
+
34
+ def cherry_pick(commit)
35
+ pretend_execute("git cherry-pick -s #{commit}")
36
+ end
37
+
38
+ def execute(cmd)
39
+ output.puts(cmd)
40
+ super(cmd)
41
+ end
42
+
43
+ def pretend_execute(cmd)
44
+ output.puts(cmd)
45
+ end
46
+ end
47
+ end
@@ -41,7 +41,15 @@ module Reviewr
41
41
  end
42
42
 
43
43
  def review_sha
44
- @review_sha ||= git.last_commit.slice(0, 8)
44
+ @review_sha ||= git.last_commit_sha.slice(0, 8)
45
+ end
46
+
47
+ def review_subject
48
+ @review_subject ||= git.last_commit_subject
49
+ end
50
+
51
+ def review_body
52
+ @review_body ||= git.last_commit_body
45
53
  end
46
54
 
47
55
  def master_sha
@@ -1,12 +1,10 @@
1
- Hi,
2
-
3
- Could you please code review and comment on the following changes:
1
+ <%= project.review_body %>
4
2
 
5
3
  <%= compare_url %>
6
4
 
7
- If you find the changes acceptable please run:
5
+ Accept:
8
6
  reviewr accept <%= project.review_branch %>
9
- If you think more work needs to be done please run:
7
+ Reject:
10
8
  reviewr reject <%= project.review_branch %>
11
9
 
12
10
  Thanks!
@@ -1,3 +1,3 @@
1
1
  module Reviewr
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Burrows
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-28 00:00:00 -07:00
17
+ date: 2010-06-17 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -83,6 +83,7 @@ files:
83
83
  - lib/reviewr/cli.rb
84
84
  - lib/reviewr/git.rb
85
85
  - lib/reviewr/mailer.rb
86
+ - lib/reviewr/pretend_git.rb
86
87
  - lib/reviewr/project.rb
87
88
  - lib/reviewr/version.rb
88
89
  - lib/reviewr/cli/accept.rb