runcoderun 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,8 @@ Usage:
22
22
  or
23
23
  rcr [command] [options]
24
24
 
25
- Right now we just support open. Open opens up your project homepage on RunCodeRun in your default browser.
25
+ Right now we just support open. This opens up your project homepage on RunCodeRun in your default browser. It is smart enough to make a best guess at the correct owner and project name from your git config.
26
+
26
27
  Try it out:
27
28
 
28
29
  $ git clone git://github.com/floehopper/mocha.git
@@ -31,21 +31,23 @@ describe RunCodeRun do
31
31
 
32
32
  describe "guess owner" do
33
33
  it "should grab owner for private repos" do
34
- output =<<EOL
35
- origin git@github.com:relevance/runcoderun.git (fetch)
36
- origin git@github.com:relevance/runcoderun.git (push)
37
- EOL
34
+ output = "git@github.com:relevance/zeus.git"
38
35
  RunCodeRun.stubs(:run).returns(output)
39
36
  RunCodeRun.guess_owner.should == "relevance"
40
37
  end
41
38
 
42
39
  it "should grab owner for public repos" do
43
- output =<<EOL
44
- origin git://github.com/defunkt/github.git (fetch)
45
- origin git://github.com/defunkt/github.git (push)
46
- EOL
40
+ output = "git://github.com/runcoderun/core.git"
47
41
  RunCodeRun.stubs(:run).returns(output)
48
- RunCodeRun.guess_owner.should == "defunkt"
42
+ RunCodeRun.guess_owner.should == "runcoderun"
43
+ end
44
+
45
+ it "should fail fast when it can't determine owner" do
46
+ output = "/src/some/local/path"
47
+ RunCodeRun.stubs(:run).returns(output)
48
+ lambda {
49
+ RunCodeRun.guess_owner.should == "runcoderun"
50
+ }.should raise_error(ArgumentError, %r{/src/some/local/path} )
49
51
  end
50
52
  end
51
53
  end
@@ -39,8 +39,12 @@ module RunCodeRun
39
39
  end
40
40
 
41
41
  def guess_owner
42
- output = run("git remote -v")
43
- output.match(%r{github.com[:/](\w+)})[1]
42
+ output = run("git config --get remote.origin.url")
43
+ output[/github.com[:\/](\w+)/, 1] || raise_if_no_owner(output)
44
+ end
45
+
46
+ def raise_if_no_owner(output)
47
+ raise(ArgumentError, "Could not determine owner from git remote url: #{output}")
44
48
  end
45
49
 
46
50
  def run(cmd)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{runcoderun}
8
- s.version = "0.2.2"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Sanheim"]
12
- s.date = %q{2009-09-29}
12
+ s.date = %q{2009-10-01}
13
13
  s.description = %q{runcoderun command line gem}
14
14
  s.email = %q{rsanheim@gmail.com}
15
15
  s.executables = ["rcr", "runcoderun"]
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
- :patch: 2
3
+ :minor: 3
4
+ :patch: 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcoderun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-29 00:00:00 -04:00
12
+ date: 2009-10-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency