defunkt-github 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,17 +1,17 @@
1
1
  bin/github
2
2
  commands/commands.rb
3
3
  commands/helpers.rb
4
+ lib/github/extensions.rb
4
5
  lib/github/command.rb
5
6
  lib/github/helper.rb
6
7
  lib/github.rb
7
8
  LICENSE
9
+ Manifest
8
10
  README
9
11
  spec/command_spec.rb
10
- spec/helpers/owner_spec.rb
11
- spec/helpers/project_spec.rb
12
- spec/helpers/public_url_for_spec.rb
13
- spec/helpers/repo_for_spec.rb
14
- spec/helpers/user_and_repo_from_spec.rb
15
- spec/helpers/user_for_spec.rb
12
+ spec/extensions_spec.rb
13
+ spec/github_spec.rb
14
+ spec/helper_spec.rb
16
15
  spec/spec_helper.rb
17
- Manifest
16
+ spec/ui_spec.rb
17
+ spec/windoze_spec.rb
data/README CHANGED
@@ -9,7 +9,7 @@ Catch us in the #github room on freenode if you want to get involved. Or just f
9
9
  Getting started
10
10
  ===========
11
11
 
12
- $ gem install github
12
+ $ gem install defunkt-github -s http://gems.github.com
13
13
 
14
14
  Run it:
15
15
 
@@ -51,3 +51,4 @@ Contributors
51
51
  - defunkt
52
52
  - maddox
53
53
  - halorgium
54
+ - kballard
data/commands/commands.rb CHANGED
@@ -1,54 +1,108 @@
1
- GitHub.register :helper do |name, comma_args|
2
- comma_args ||= ''
3
- puts helper.send(name, comma_args.split(/,/))
1
+ desc "Open this repo's master branch in a web browser."
2
+ command :home do |user|
3
+ if helper.project
4
+ helper.open helper.homepage_for(user || helper.owner, 'master')
5
+ end
4
6
  end
5
7
 
6
- GitHub.describe :home => "Open this repo's master branch in a web browser."
7
- GitHub.register :home do
8
+ desc "Open this repo in a web browser."
9
+ command :browse do |user, branch|
8
10
  if helper.project
9
- exec "#{helper.open} #{helper.homepage_for(helper.owner, 'master')}"
11
+ # if one arg given, treat it as a branch name
12
+ # unless it maches user/branch, then split it
13
+ # if two args given, treat as user branch
14
+ # if no args given, use defaults
15
+ user, branch = user.split("/", 2) if branch.nil? unless user.nil?
16
+ branch = user and user = nil if branch.nil?
17
+ user ||= helper.branch_user
18
+ branch ||= helper.branch_name
19
+ helper.open helper.homepage_for(user, branch)
10
20
  end
11
21
  end
12
22
 
13
- GitHub.describe :browse => "Open this repo in a web browser."
14
- GitHub.register :browse do
23
+ desc "Open the network page for this repo in a web browser."
24
+ command :network do |user|
15
25
  if helper.project
16
- exec "#{helper.open} #{helper.homepage_for(helper.branch_user, helper.branch_name)}"
26
+ user ||= helper.owner
27
+ helper.open helper.network_page_for(user)
17
28
  end
18
29
  end
19
30
 
20
- GitHub.describe :info => "Info about this project."
21
- GitHub.register :info do
31
+ desc "Info about this project."
32
+ command :info do
22
33
  puts "== Info for #{helper.project}"
23
34
  puts "You are #{helper.owner}"
24
- puts "Currently tracking: "
25
- helper.tracking.each do |(name,user_or_url)|
35
+ puts "Currently tracking:"
36
+ helper.tracking.sort { |(a,),(b,)| a == :origin ? -1 : b == :origin ? 1 : a.to_s <=> b.to_s }.each do |(name,user_or_url)|
26
37
  puts " - #{user_or_url} (as #{name})"
27
38
  end
28
39
  end
29
40
 
30
- GitHub.describe :track => "Track another user's repository."
31
- GitHub.register :track do |user|
41
+ desc "Track another user's repository."
42
+ flags :private => "Use git@github.com: instead of git://github.com/."
43
+ flags :ssh => 'Equivalent to --private'
44
+ command :track do |remote, user|
45
+ # track remote user
46
+ # track remote user/repo
47
+ # track user
48
+ # track user/repo
49
+ user, remote = remote, nil if user.nil?
32
50
  die "Specify a user to track" if user.nil?
51
+ user, repo = user.split("/", 2)
33
52
  die "Already tracking #{user}" if helper.tracking?(user)
53
+ repo = @helper.project if repo.nil?
54
+ repo.chomp!(".git")
55
+ remote ||= user
34
56
 
35
- git "remote add #{user} #{helper.public_url_for(user)}"
57
+ if options[:private] || options[:ssh]
58
+ git "remote add #{remote} #{helper.private_url_for_user_and_repo(user, repo)}"
59
+ else
60
+ git "remote add #{remote} #{helper.public_url_for_user_and_repo(user, repo)}"
61
+ end
36
62
  end
37
63
 
38
- GitHub.describe :pull => "Pull from a remote. Pass --merge to automatically merge remote's changes into your master."
39
- GitHub.register :pull do |user, branch|
64
+ desc "Pull from a remote."
65
+ flags :merge => "Automatically merge remote's changes into your master."
66
+ command :pull do |user, branch|
40
67
  die "Specify a user to pull from" if user.nil?
41
- GitHub.invoke(:track, user) unless helper.tracking?(user)
68
+ user, branch = user.split("/", 2) if branch.nil?
42
69
  branch ||= 'master'
43
-
44
- puts "Switching to #{user}/#{branch}"
45
- git "checkout #{user}/#{branch}" if git("checkout -b #{user}/#{branch}").error?
70
+ GitHub.invoke(:track, user) unless helper.tracking?(user)
46
71
 
47
72
  if options[:merge]
48
- git "pull #{user} #{branch}"
49
- git "checkout master"
50
- git_exec "merge #{user}/#{branch}"
73
+ git_exec "pull #{user} #{branch}"
51
74
  else
75
+ puts "Switching to #{user}/#{branch}"
76
+ git "checkout #{user}/#{branch}" if git("checkout -b #{user}/#{branch}").error?
52
77
  git_exec "pull #{user} #{branch}"
53
78
  end
54
79
  end
80
+
81
+ desc "Clone a repo."
82
+ flags :ssh => "Clone using the git@github.com style url."
83
+ command :clone do |user, repo, dir|
84
+ die "Specify a user to pull from" if user.nil?
85
+ if user.include? ?/
86
+ die "Expected user/repo dir, given extra argument" if dir
87
+ (user, repo), dir = [user.split('/', 2), repo]
88
+ end
89
+ die "Specify a repo to pull from" if repo.nil?
90
+
91
+ if options[:ssh]
92
+ git_exec "clone git@github.com:#{user}/#{repo}.git" + (dir ? " #{dir}" : "")
93
+ else
94
+ git_exec "clone git://github.com/#{user}/#{repo}.git" + (dir ? " #{dir}" : "")
95
+ end
96
+ end
97
+
98
+ desc "Generate the text for a pull request."
99
+ command :'pull-request' do |user, branch|
100
+ if helper.project
101
+ die "Specify a user for the pull request" if user.nil?
102
+ user, branch = user.split('/', 2) if branch.nil?
103
+ branch ||= 'master'
104
+ GitHub.invoke(:track, user) unless helper.tracking?(user)
105
+
106
+ git_exec "request-pull #{user}/#{branch} origin"
107
+ end
108
+ end
data/commands/helpers.rb CHANGED
@@ -1,58 +1,69 @@
1
- GitHub.helper :user_and_repo_from do |url|
1
+ helper :user_and_repo_from do |url|
2
2
  case url
3
- when %r|^git://github\.com/(.*)$|: $1.split('/')
4
- when %r|^git@github\.com:(.*)$|: $1.split('/')
3
+ when %r|^git://github\.com/([^/]+/[^/]+)$|: $1.split('/')
4
+ when %r|^(?:ssh://)?(?:git@)?github\.com:([^/]+/[^/]+)$|: $1.split('/')
5
5
  end
6
6
  end
7
7
 
8
- GitHub.helper :user_and_repo_for do |remote|
8
+ helper :user_and_repo_for do |remote|
9
9
  user_and_repo_from(url_for(remote))
10
10
  end
11
11
 
12
- GitHub.helper :user_for do |remote|
13
- user_and_repo_for(remote).first
12
+ helper :user_for do |remote|
13
+ user_and_repo_for(remote).try.first
14
14
  end
15
15
 
16
- GitHub.helper :repo_for do |remote|
17
- user_and_repo_for(remote).last
16
+ helper :repo_for do |remote|
17
+ user_and_repo_for(remote).try.last
18
18
  end
19
19
 
20
- GitHub.helper :project do
21
- repo_for(:origin).chomp('.git')
20
+ helper :project do
21
+ repo = repo_for(:origin)
22
+ if repo.nil?
23
+ if url_for(:origin) == ""
24
+ STDERR.puts "Error: missing remote 'origin'"
25
+ else
26
+ STDERR.puts "Error: remote 'origin' is not a github URL"
27
+ end
28
+ exit 1
29
+ end
30
+ repo.chomp('.git')
22
31
  end
23
32
 
24
- GitHub.helper :url_for do |remote|
33
+ helper :url_for do |remote|
25
34
  `git config --get remote.#{remote}.url`.chomp
26
35
  end
27
36
 
28
- GitHub.helper :remotes do
37
+ helper :remotes do
29
38
  regexp = '^remote\.(.+)\.url$'
30
- `git config --get-regexp '#{regexp}'`.split(/\n/).map do |line|
39
+ `git config --get-regexp '#{regexp}'`.split(/\n/).inject({}) do |memo, line|
31
40
  name_string, url = line.split(/ /, 2)
32
41
  m, name = *name_string.match(/#{regexp}/)
33
- [name, url]
42
+ memo[name.to_sym] = url
43
+ memo
34
44
  end
35
45
  end
36
46
 
37
- GitHub.helper :tracking do
38
- remotes.map do |(name, url)|
47
+ helper :tracking do
48
+ remotes.inject({}) do |memo, (name, url)|
39
49
  if ur = user_and_repo_from(url)
40
- [name, ur.first]
50
+ memo[name] = ur.first
41
51
  else
42
- [name, url]
52
+ memo[name] = url
43
53
  end
54
+ memo
44
55
  end
45
56
  end
46
57
 
47
- GitHub.helper :tracking? do |user|
48
- tracking.include?(user)
58
+ helper :tracking? do |user|
59
+ tracking.values.include?(user)
49
60
  end
50
61
 
51
- GitHub.helper :owner do
62
+ helper :owner do
52
63
  user_for(:origin)
53
64
  end
54
65
 
55
- GitHub.helper :user_and_branch do
66
+ helper :user_and_branch do
56
67
  raw_branch = `git rev-parse --symbolic-full-name HEAD`.chomp.sub(/^refs\/heads\//, '')
57
68
  user, branch = raw_branch.split(/\//, 2)
58
69
  if branch
@@ -62,23 +73,51 @@ GitHub.helper :user_and_branch do
62
73
  end
63
74
  end
64
75
 
65
- GitHub.helper :branch_user do
76
+ helper :branch_user do
66
77
  user_and_branch.first
67
78
  end
68
79
 
69
- GitHub.helper :branch_name do
80
+ helper :branch_name do
70
81
  user_and_branch.last
71
82
  end
72
83
 
73
- GitHub.helper :public_url_for do |user|
74
- "git://github.com/#{user}/#{project}.git"
84
+ helper :public_url_for_user_and_repo do |user, repo|
85
+ "git://github.com/#{user}/#{repo}.git"
86
+ end
87
+
88
+ helper :private_url_for_user_and_repo do |user, repo|
89
+ "git@github.com:#{user}/#{repo}.git"
90
+ end
91
+
92
+ helper :public_url_for do |user|
93
+ public_url_for_user_and_repo user, project
75
94
  end
76
95
 
77
- GitHub.helper :homepage_for do |user, branch|
96
+ helper :private_url_for do |user|
97
+ private_url_for_user_and_repo user, project
98
+ end
99
+
100
+ helper :homepage_for do |user, branch|
78
101
  "https://github.com/#{user}/#{project}/tree/#{branch}"
79
102
  end
80
103
 
81
- GitHub.helper :open do
82
- WINDOZE ? 'start' : 'open'
104
+ helper :network_page_for do |user|
105
+ "https://github.com/#{user}/#{project}/network"
106
+ end
107
+
108
+ helper :has_launchy? do |blk|
109
+ begin
110
+ gem 'launchy'
111
+ require 'launchy'
112
+ blk.call
113
+ rescue Gem::LoadError
114
+ STDERR.puts "Sorry, you need to install launchy: `gem install launchy`"
115
+ end
83
116
  end
84
-
117
+
118
+ helper :open do |url|
119
+ has_launchy? proc {
120
+ Launchy::Browser.new.visit url
121
+ }
122
+ end
123
+
@@ -1,6 +1,4 @@
1
- Windoze = RUBY_PLATFORM =~ /mswin|mingw/
2
-
3
- if Windoze
1
+ if RUBY_PLATFORM =~ /mswin|mingw/
4
2
  begin
5
3
  require 'win32/open3'
6
4
  rescue LoadError
@@ -40,7 +38,9 @@ module GitHub
40
38
  end
41
39
 
42
40
  def git_exec(*command)
43
- exec ['git', command].flatten.join(' ')
41
+ cmdstr = ['git', command].flatten.join(' ')
42
+ GitHub.debug "exec: #{cmdstr}"
43
+ exec cmdstr
44
44
  end
45
45
 
46
46
  def sh(*command)
@@ -0,0 +1,28 @@
1
+ # define #try
2
+ class Object
3
+ def try
4
+ self
5
+ end
6
+ end
7
+
8
+ class NilClass
9
+ klass = Class.new
10
+ klass.class_eval do
11
+ instance_methods.each { |meth| undef_method meth.to_sym unless meth =~ /^__(id|send)__$/ }
12
+ def method_missing(*args)
13
+ self
14
+ end
15
+ end
16
+ NilProxy = klass.new
17
+ def try
18
+ NilProxy
19
+ end
20
+ end
21
+
22
+ # define #tap
23
+ class Object
24
+ def tap(&block)
25
+ block.call(self)
26
+ self
27
+ end
28
+ end
data/lib/github.rb CHANGED
@@ -1,13 +1,15 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
+ require 'github/extensions'
2
3
  require 'github/command'
3
4
  require 'github/helper'
5
+ require 'rubygems'
4
6
 
5
7
  ##
6
8
  # Starting simple.
7
9
  #
8
10
  # $ github <command> <args>
9
11
  #
10
- # GitHub.register <command> do |*args|
12
+ # GitHub.command <command> do |*args|
11
13
  # whatever
12
14
  # end
13
15
  #
@@ -20,13 +22,22 @@ module GitHub
20
22
 
21
23
  BasePath = File.expand_path(File.dirname(__FILE__) + '/..')
22
24
 
23
- def register(command, &block)
25
+ def command(command, &block)
24
26
  debug "Registered `#{command}`"
27
+ descriptions[command] = @next_description if @next_description
28
+ @next_description = nil
29
+ flag_descriptions[command].update @next_flags if @next_flags
30
+ @next_flags = nil
25
31
  commands[command.to_s] = Command.new(block)
26
32
  end
27
33
 
28
- def describe(hash)
29
- descriptions.update hash
34
+ def desc(str)
35
+ @next_description = str
36
+ end
37
+
38
+ def flags(hash)
39
+ @next_flags ||= {}
40
+ @next_flags.update hash
30
41
  end
31
42
 
32
43
  def helper(command, &block)
@@ -36,6 +47,7 @@ module GitHub
36
47
 
37
48
  def activate(args)
38
49
  @options = parse_options(args)
50
+ @debug = @options[:debug]
39
51
  load 'helpers.rb'
40
52
  load 'commands.rb'
41
53
  invoke(args.shift, *args)
@@ -55,27 +67,38 @@ module GitHub
55
67
  @descriptions ||= {}
56
68
  end
57
69
 
70
+ def flag_descriptions
71
+ @flagdescs ||= Hash.new { |h, k| h[k] = {} }
72
+ end
73
+
58
74
  def options
59
75
  @options
60
76
  end
61
77
 
62
78
  def parse_options(args)
63
- @debug = args.delete('--debug')
64
- args.inject({}) do |memo, arg|
65
- if arg =~ /^--([^=]+)=(.+)/
66
- args.delete(arg)
79
+ idx = 0
80
+ args.clone.inject({}) do |memo, arg|
81
+ case arg
82
+ when /^--(.+?)=(.*)/
83
+ args.delete_at(idx)
67
84
  memo.merge($1.to_sym => $2)
68
- elsif arg =~ /^--(.+)/
69
- args.delete(arg)
85
+ when /^--(.+)/
86
+ args.delete_at(idx)
70
87
  memo.merge($1.to_sym => true)
88
+ when "--"
89
+ args.delete_at(idx)
90
+ return memo
71
91
  else
92
+ idx += 1
72
93
  memo
73
94
  end
74
95
  end
75
96
  end
76
97
 
77
98
  def load(file)
78
- file[0] == ?/ ? super : super(BasePath + "/commands/#{file}")
99
+ file[0] == ?/ ? path = file : path = BasePath + "/commands/#{file}"
100
+ data = File.read(path)
101
+ GitHub.module_eval data, path
79
102
  end
80
103
 
81
104
  def debug(*messages)
@@ -87,13 +110,18 @@ module GitHub
87
110
  end
88
111
  end
89
112
 
90
- GitHub.register :default do
113
+ GitHub.command :default do
91
114
  puts "Usage: github command <space separated arguments>", ''
92
115
  puts "Available commands:", ''
93
116
  longest = GitHub.descriptions.map { |d,| d.to_s.size }.max
94
117
  GitHub.descriptions.each do |command, desc|
95
- command = "%-#{longest}s" % command
96
- puts " #{command} => #{desc}"
118
+ cmdstr = "%-#{longest}s" % command
119
+ puts " #{cmdstr} => #{desc}"
120
+ flongest = GitHub.flag_descriptions[command].map { |d,| "--#{d}".size }.max
121
+ GitHub.flag_descriptions[command].each do |flag, fdesc|
122
+ flagstr = "#{" " * longest} %-#{flongest}s" % "--#{flag}"
123
+ puts " #{flagstr}: #{fdesc}"
124
+ end
97
125
  end
98
126
  puts
99
127
  end
data/spec/command_spec.rb CHANGED
@@ -0,0 +1,66 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe GitHub::Command do
4
+ before(:each) do
5
+ @command = GitHub::Command.new(proc { |x| puts x })
6
+ end
7
+
8
+ it "should return a GitHub::Helper" do
9
+ @command.helper.should be_instance_of(GitHub::Helper)
10
+ end
11
+
12
+ it "should call successfully" do
13
+ @command.should_receive(:puts).with("test").once
14
+ @command.call("test")
15
+ end
16
+
17
+ it "should return options" do
18
+ GitHub.should_receive(:options).with().once.and_return({:ssh => true})
19
+ @command.options.should == {:ssh => true}
20
+ end
21
+
22
+ it "should successfully call out to the shell" do
23
+ unguard(Kernel, :fork)
24
+ unguard(Kernel, :exec)
25
+ hi = @command.sh("echo hi")
26
+ hi.should == "hi"
27
+ hi.out?.should be(true)
28
+ hi.error?.should be(false)
29
+ hi.command.should == "echo hi"
30
+ bye = @command.sh("echo bye >&2")
31
+ bye.should == "bye"
32
+ bye.out?.should be(false)
33
+ bye.error?.should be(true)
34
+ bye.command.should == "echo bye >&2"
35
+ end
36
+
37
+ it "should return the results of a git operation" do
38
+ GitHub::Command::Shell.should_receive(:new).with("git rev-parse master").once.and_return do |*cmds|
39
+ s = mock("GitHub::Commands::Shell")
40
+ s.should_receive(:run).once.and_return("sha1")
41
+ s
42
+ end
43
+ @command.git("rev-parse master").should == "sha1"
44
+ end
45
+
46
+ it "should print the results of a git operation" do
47
+ @command.should_receive(:puts).with("sha1").once
48
+ GitHub::Command::Shell.should_receive(:new).with("git rev-parse master").once.and_return do |*cmds|
49
+ s = mock("GitHub::Commands::Shell")
50
+ s.should_receive(:run).once.and_return("sha1")
51
+ s
52
+ end
53
+ @command.pgit("rev-parse master")
54
+ end
55
+
56
+ it "should exec a git command" do
57
+ @command.should_receive(:exec).with("git rev-parse master").once
58
+ @command.git_exec "rev-parse master"
59
+ end
60
+
61
+ it "should die" do
62
+ @command.should_receive(:puts).once.with("=> message")
63
+ @command.should_receive(:exit!).once
64
+ @command.die "message"
65
+ end
66
+ end
@@ -0,0 +1,36 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe "When calling #try" do
4
+ specify "objects should return themselves" do
5
+ obj = 1; obj.try.should equal(obj)
6
+ obj = "foo"; obj.try.should equal(obj)
7
+ obj = { :foo => "bar" }; obj.try.should equal(obj)
8
+ end
9
+
10
+ specify "objects should behave as if #try wasn't called" do
11
+ "foo".try.size.should == 3
12
+ { :foo => :bar }.try.fetch(:foo).should == :bar
13
+ [1, 2, 3].try.map { |x| x + 1 }.should == [2, 3, 4]
14
+ end
15
+
16
+ specify "nil should return the singleton NilClass::NilProxy" do
17
+ nil.try.should equal(NilClass::NilProxy)
18
+ end
19
+
20
+ specify "nil should ignore any calls made past #try" do
21
+ nil.try.size.should equal(NilClass::NilProxy)
22
+ nil.try.sdlfj.should equal(NilClass::NilProxy)
23
+ nil.try.one.two.three.should equal(NilClass::NilProxy)
24
+ end
25
+
26
+ specify "classes should respond just like objects" do
27
+ String.try.should equal(String)
28
+ end
29
+ end
30
+
31
+ describe "When calling #tap" do
32
+ specify "objects should behave like Ruby 1.9's #tap" do
33
+ obj = "foo"
34
+ obj.tap { |obj| obj.size.should == 3 }.should equal(obj)
35
+ end
36
+ end
@@ -0,0 +1,65 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "GitHub.parse_options" do
4
+ it "should parse --bare options" do
5
+ args = ["--bare", "--test"]
6
+ GitHub.parse_options(args).should == {:bare => true, :test => true}
7
+ args.should == []
8
+ end
9
+
10
+ it "should parse options intermixed with non-options" do
11
+ args = ["text", "--bare", "more text", "--option", "--foo"]
12
+ GitHub.parse_options(args).should == {:bare => true, :option => true, :foo => true}
13
+ args.should == ["text", "more text"]
14
+ end
15
+
16
+ it "should parse --foo=bar style options" do
17
+ args = ["--foo=bar", "--bare"]
18
+ GitHub.parse_options(args).should == {:bare => true, :foo => "bar"}
19
+ args.should == []
20
+ end
21
+
22
+ it "should stop parsing options at --" do
23
+ args = ["text", "--bare", "--", "--foo"]
24
+ GitHub.parse_options(args).should == {:bare => true}
25
+ args.should == ["text", "--foo"]
26
+ end
27
+
28
+ it "should handle duplicate options" do
29
+ args = ["text", "--foo=bar", "--bare", "--foo=baz"]
30
+ GitHub.parse_options(args).should == {:foo => "baz", :bare => true}
31
+ args.should == ["text"]
32
+ end
33
+
34
+ it "should handle duplicate --bare options surrounding --" do
35
+ args = ["text", "--bare", "--", "--bare"]
36
+ GitHub.parse_options(args).should == {:bare => true}
37
+ args.should == ["text", "--bare"]
38
+ end
39
+
40
+ it "should handle no options" do
41
+ args = ["text", "more text"]
42
+ GitHub.parse_options(args).should == {}
43
+ args.should == ["text", "more text"]
44
+ end
45
+
46
+ it "should handle no args" do
47
+ args = []
48
+ GitHub.parse_options(args).should == {}
49
+ args.should == []
50
+ end
51
+
52
+ it "should not set up debugging when --debug not passed" do
53
+ GitHub.stub!(:load)
54
+ GitHub.stub!(:invoke)
55
+ GitHub.activate(['default'])
56
+ GitHub.should_not be_debug
57
+ end
58
+
59
+ it "should set up debugging when passed --debug" do
60
+ GitHub.stub!(:load)
61
+ GitHub.stub!(:invoke)
62
+ GitHub.activate(['default', '--debug'])
63
+ GitHub.should be_debug
64
+ end
65
+ end