reviewr 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,11 +1,4 @@
1
1
 
2
- === 0.0.3 / 2010-04-09
3
-
4
- * 1 bug fix:
5
-
6
- * Make it push to the correct remote repository
7
- * Format the diff against the correct remote repository
8
-
9
2
  === 0.0.2 / 2010-04-08
10
3
 
11
4
  * 1 minor enhancement:
data/lib/reviewr.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
2
3
 
4
+ Bundler.setup
3
5
  require 'reviewr/cli'
4
6
  require 'reviewr/git'
5
7
  require 'reviewr/mailer'
@@ -1,5 +1,4 @@
1
1
  require 'termios'
2
- require 'ruby-debug'
3
2
 
4
3
  module Reviewr
5
4
  module CLI
@@ -11,10 +11,12 @@ module Reviewr
11
11
  end
12
12
 
13
13
  def call
14
+ original_branch = project.current_branch
14
15
  project.create_review_branch
15
16
  project.create_review_commit(commit_msg)
16
17
  project.push_review_branch
17
18
  Mailer.new(project).send(email_body)
19
+ project.change_branch(original_branch)
18
20
  end
19
21
 
20
22
  def compare_url
data/lib/reviewr/git.rb CHANGED
@@ -28,13 +28,22 @@ module Reviewr
28
28
  execute("git commit --allow-empty -m \"#{msg}\"")
29
29
  end
30
30
 
31
+ def current_branch
32
+ m = execute("git branch").match(/^\* +(\w+)$/)
33
+ m && m[1]
34
+ end
35
+
36
+ def change_branch(branch_name)
37
+ execute("git checkout #{branch_name}")
38
+ end
39
+
31
40
  def user_email
32
41
  email = execute('git config user.email')
33
42
  email && email.chomp
34
43
  end
35
44
 
36
45
  def push_branch(branch_name)
37
- execute("git push #{remote_repo} #{branch_name}")
46
+ execute("git push origin #{branch_name}")
38
47
  end
39
48
 
40
49
  def origin_location
@@ -43,7 +52,7 @@ module Reviewr
43
52
  end
44
53
 
45
54
  def origin_master_commit
46
- r = execute("git ls-remote #{remote_repo} refs/heads/master")
55
+ r = execute("git ls-remote origin refs/heads/master")
47
56
  r && r.split(/\s+/)[0]
48
57
  end
49
58
 
@@ -2,6 +2,8 @@ require 'pony'
2
2
 
3
3
  module Reviewr
4
4
  class Mailer
5
+ attr_reader :project
6
+
5
7
  def initialize(project)
6
8
  @project = project
7
9
  end
@@ -21,6 +23,11 @@ module Reviewr
21
23
  :auth => :plain,
22
24
  :domain => @project.email_server
23
25
  })
26
+ true
27
+ rescue => e
28
+ $stderr.puts "Error sending email:"
29
+ $stderr.puts e.inspect
30
+ false
24
31
  end
25
32
  end
26
33
  end
@@ -9,7 +9,7 @@ module Reviewr
9
9
  attr_writer :user_email
10
10
 
11
11
  def_delegators :git, :push_branch, :origin_location, :remote_repo,
12
- :remote_repo=
12
+ :remote_repo=, :current_branch, :change_branch
13
13
 
14
14
  def initialize(to, git = Git.instance)
15
15
  @to, @git = to, git
@@ -1,3 +1,3 @@
1
1
  module Reviewr
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
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-09 00:00:00 -07:00
17
+ date: 2010-04-12 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency