github 0.1.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/History.txt +37 -0
  2. data/Manifest +33 -12
  3. data/README.md +187 -0
  4. data/Rakefile +44 -0
  5. data/bin/gh +8 -0
  6. data/bin/github +4 -1
  7. data/github.gemspec +29 -34
  8. data/lib/commands/commands.rb +249 -0
  9. data/lib/commands/helpers.rb +486 -0
  10. data/lib/commands/issues.rb +17 -0
  11. data/lib/commands/network.rb +110 -0
  12. data/lib/github.rb +117 -29
  13. data/lib/github/command.rb +69 -14
  14. data/lib/github/extensions.rb +39 -0
  15. data/lib/github/ui.rb +19 -0
  16. data/setup.rb +1551 -0
  17. data/spec/command_spec.rb +82 -0
  18. data/spec/commands/command_browse_spec.rb +36 -0
  19. data/spec/commands/command_clone_spec.rb +87 -0
  20. data/spec/commands/command_create-from-local_spec.rb +7 -0
  21. data/spec/commands/command_fetch_spec.rb +56 -0
  22. data/spec/commands/command_fork_spec.rb +44 -0
  23. data/spec/commands/command_helper.rb +170 -0
  24. data/spec/commands/command_home_spec.rb +20 -0
  25. data/spec/commands/command_info_spec.rb +23 -0
  26. data/spec/commands/command_issues_spec.rb +97 -0
  27. data/spec/commands/command_network_spec.rb +30 -0
  28. data/spec/commands/command_pull-request_spec.rb +51 -0
  29. data/spec/commands/command_pull_spec.rb +82 -0
  30. data/spec/commands/command_search_spec.rb +34 -0
  31. data/spec/commands/command_track_spec.rb +82 -0
  32. data/spec/commands_spec.rb +49 -0
  33. data/spec/extensions_spec.rb +36 -0
  34. data/spec/github_spec.rb +85 -0
  35. data/spec/helper_spec.rb +368 -0
  36. data/spec/spec_helper.rb +160 -4
  37. data/spec/windoze_spec.rb +38 -0
  38. metadata +114 -47
  39. data/README +0 -49
  40. data/commands/commands.rb +0 -54
  41. data/commands/helpers.rb +0 -79
  42. data/spec/helpers/owner_spec.rb +0 -12
  43. data/spec/helpers/project_spec.rb +0 -12
  44. data/spec/helpers/public_url_for_spec.rb +0 -12
  45. data/spec/helpers/repo_for_spec.rb +0 -12
  46. data/spec/helpers/user_and_repo_from_spec.rb +0 -15
  47. data/spec/helpers/user_for_spec.rb +0 -12
data/commands/helpers.rb DELETED
@@ -1,79 +0,0 @@
1
- GitHub.helper :user_and_repo_from do |url|
2
- case url
3
- when %r|^git://github\.com/(.*)$|: $1.split('/')
4
- when %r|^git@github\.com:(.*)$|: $1.split('/')
5
- end
6
- end
7
-
8
- GitHub.helper :user_and_repo_for do |remote|
9
- user_and_repo_from(url_for(remote))
10
- end
11
-
12
- GitHub.helper :user_for do |remote|
13
- user_and_repo_for(remote).first
14
- end
15
-
16
- GitHub.helper :repo_for do |remote|
17
- user_and_repo_for(remote).last
18
- end
19
-
20
- GitHub.helper :project do
21
- repo_for(:origin).chomp('.git')
22
- end
23
-
24
- GitHub.helper :url_for do |remote|
25
- `git config --get remote.#{remote}.url`.chomp
26
- end
27
-
28
- GitHub.helper :remotes do
29
- regexp = '^remote\.(.+)\.url$'
30
- `git config --get-regexp '#{regexp}'`.split(/\n/).map do |line|
31
- name_string, url = line.split(/ /, 2)
32
- m, name = *name_string.match(/#{regexp}/)
33
- [name, url]
34
- end
35
- end
36
-
37
- GitHub.helper :tracking do
38
- remotes.map do |(name, url)|
39
- if ur = user_and_repo_from(url)
40
- [name, ur.first]
41
- else
42
- [name, url]
43
- end
44
- end
45
- end
46
-
47
- GitHub.helper :tracking? do |user|
48
- tracking.include?(user)
49
- end
50
-
51
- GitHub.helper :owner do
52
- user_for(:origin)
53
- end
54
-
55
- GitHub.helper :user_and_branch do
56
- raw_branch = `git rev-parse --symbolic-full-name HEAD`.chomp.sub(/^refs\/heads\//, '')
57
- user, branch = raw_branch.split(/\//, 2)
58
- if branch
59
- [user, branch]
60
- else
61
- [owner, user]
62
- end
63
- end
64
-
65
- GitHub.helper :branch_user do
66
- user_and_branch.first
67
- end
68
-
69
- GitHub.helper :branch_name do
70
- user_and_branch.last
71
- end
72
-
73
- GitHub.helper :public_url_for do |user|
74
- "git://github.com/#{user}/#{project}.git"
75
- end
76
-
77
- GitHub.helper :homepage_for do |user, branch|
78
- "https://github.com/#{user}/#{project}/tree/#{branch}"
79
- end
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The owner helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should return hacker" do
9
- @helper.should_receive(:url_for).with(:origin).and_return("git://github.com/hacker/project.git")
10
- @helper.owner.should == "hacker"
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The project helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should return project-awesome" do
9
- @helper.should_receive(:url_for).with(:origin).and_return("git://github.com/user/project-awesome.git")
10
- @helper.project.should == "project-awesome"
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The public_url_for helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should return git://github.com/wycats/merb-core.git" do
9
- @helper.should_receive(:url_for).with(:origin).and_return("git://github.com/user/merb-core.git")
10
- @helper.public_url_for("wycats").should == "git://github.com/wycats/merb-core.git"
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The repo_for helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should return mephisto.git" do
9
- @helper.should_receive(:url_for).with("mojombo").and_return("git@github.com:mojombo/mephisto.git")
10
- @helper.repo_for("mojombo").should == "mephisto.git"
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The user_and_repo_from helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should parse a git:// url" do
9
- @helper.user_and_repo_from("git://github.com/defunkt/github.git").should == ["defunkt", "github.git"]
10
- end
11
-
12
- it "should parse a ssh-based url" do
13
- @helper.user_and_repo_from("git@github.com:mojombo/god.git").should == ["mojombo", "god.git"]
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "The user_for helper" do
4
- before(:each) do
5
- @helper = GitHub::Helper.new
6
- end
7
-
8
- it "should return defunkt" do
9
- @helper.should_receive(:url_for).with("origin").and_return("git@github.com:defunkt/project.git")
10
- @helper.user_for("origin").should == "defunkt"
11
- end
12
- end