github 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .config
2
+ InstalledFiles
3
+ pkg
4
+ *.gem
5
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ github (0.5.0)
5
+ highline (~> 1.5.1)
6
+ json (~> 1.4.6)
7
+ launchy (~> 0.3.7)
8
+ text-format (= 1.0.0)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ activerecord (2.3.10)
14
+ activesupport (= 2.3.10)
15
+ activesupport (2.3.10)
16
+ configuration (1.1.0)
17
+ highline (1.5.2)
18
+ json (1.4.6)
19
+ launchy (0.3.7)
20
+ configuration (>= 0.0.5)
21
+ rake (>= 0.8.1)
22
+ rake (0.8.7)
23
+ rspec (1.3.1)
24
+ text-format (1.0.0)
25
+ text-hyphen (~> 1.0.0)
26
+ text-hyphen (1.0.0)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ activerecord (~> 2.3.10)
33
+ github!
34
+ highline (~> 1.5.1)
35
+ json (~> 1.4.6)
36
+ launchy (~> 0.3.7)
37
+ rake
38
+ rspec (~> 1.3.1)
39
+ text-format (= 1.0.0)
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.5.0 2011-1-17
2
+
3
+ * Support for ruby 1.9.2 [keithpitty]
4
+ * Clean fail if haven't setup github config yet [keithpitty]
5
+
6
+ == 0.4.6 2010-11-04
7
+
8
+ * Fix recent https migration of github.com [fishman]
9
+
1
10
  == 0.4.5 2010-10-25
2
11
 
3
12
  * Added "gh admin" - to open the Admin page for this project
data/Rakefile CHANGED
@@ -1,45 +1,21 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ require "bundler/setup"
2
+ Bundler::GemHelper.install_tasks
3
3
 
4
- begin
5
- require 'echoe'
4
+ require 'spec/rake/spectask'
6
5
 
7
- Echoe.new('github', '0.4.5') do |p|
8
- p.rubyforge_name = 'github'
9
- p.summary = "The official `github` command line helper for simplifying your GitHub experience."
10
- p.description = "The official `github` command line helper for simplifying your GitHub experience."
11
- p.url = "http://github.com/"
12
- p.author = ['Chris Wanstrath', 'Kevin Ballard', 'Scott Chacon', 'Dr Nic Williams']
13
- p.email = "drnicwilliams@gmail.com"
14
- p.dependencies = [
15
- "text-format >=1.0.0",
16
- "highline ~>1.5.1",
17
- "json >=1.2.0"
18
- ]
19
- end
20
-
21
- rescue LoadError => boom
22
- puts "You are missing a dependency required for meta-operations on this gem."
23
- puts "#{boom.to_s.capitalize}."
6
+ Spec::Rake::SpecTask.new("spec") do |t|
7
+ t.spec_files = FileList['spec/**/*_spec.rb']
8
+ t.spec_opts = ['--color']
24
9
  end
25
10
 
26
- # add spec tasks, if you have rspec installed
27
- begin
28
- require 'spec/rake/spectask'
29
-
30
- Spec::Rake::SpecTask.new("spec") do |t|
31
- t.spec_files = FileList['spec/**/*_spec.rb']
32
- t.spec_opts = ['--color']
33
- end
11
+ Spec::Rake::SpecTask.new("rcov_spec") do |t|
12
+ t.spec_files = FileList['spec/**/*_spec.rb']
13
+ t.spec_opts = ['--color']
14
+ t.rcov = true
15
+ t.rcov_opts = ['--exclude', '^spec,/gems/']
16
+ end
34
17
 
35
- task :test do
36
- Rake::Task['spec'].invoke
37
- end
18
+ task :test => :spec
38
19
 
39
- Spec::Rake::SpecTask.new("rcov_spec") do |t|
40
- t.spec_files = FileList['spec/**/*_spec.rb']
41
- t.spec_opts = ['--color']
42
- t.rcov = true
43
- t.rcov_opts = ['--exclude', '^spec,/gems/']
44
- end
45
- end
20
+ desc "Run specs as default activity"
21
+ task :default => :spec
data/github.gemspec CHANGED
@@ -1,40 +1,30 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "github/version"
2
4
 
3
5
  Gem::Specification.new do |s|
4
- s.name = %q{github}
5
- s.version = "0.4.5"
6
+ s.name = "github"
7
+ s.version = GitHub::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Chris Wanstrath', 'Kevin Ballard', 'Scott Chacon', 'Dr Nic Williams']
10
+ s.email = ["drnicwilliams@gmail.com"]
11
+ s.homepage = "https://github.com/defunkt/github-gem"
12
+ s.summary = "The official `github` command line helper for simplifying your GitHub experience."
13
+ s.description = "The official `github` command line helper for simplifying your GitHub experience."
6
14
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Chris Wanstrath, Kevin Ballard, Scott Chacon, Dr Nic Williams"]
9
- s.date = %q{2010-10-25}
10
- s.description = %q{The official `github` command line helper for simplifying your GitHub experience.}
11
- s.email = %q{drnicwilliams@gmail.com}
12
- s.executables = ["gh", "github"]
13
- s.extra_rdoc_files = ["LICENSE", "README.md", "bin/gh", "bin/github", "lib/commands/commands.rb", "lib/commands/helpers.rb", "lib/commands/issues.rb", "lib/commands/network.rb", "lib/github.rb", "lib/github/command.rb", "lib/github/extensions.rb", "lib/github/helper.rb", "lib/github/ui.rb"]
14
- s.files = ["History.txt", "LICENSE", "Manifest", "README.md", "Rakefile", "bin/gh", "bin/github", "lib/commands/commands.rb", "lib/commands/helpers.rb", "lib/commands/issues.rb", "lib/commands/network.rb", "lib/github.rb", "lib/github/command.rb", "lib/github/extensions.rb", "lib/github/helper.rb", "lib/github/ui.rb", "setup.rb", "spec/command_spec.rb", "spec/commands/command_browse_spec.rb", "spec/commands/command_clone_spec.rb", "spec/commands/command_create-from-local_spec.rb", "spec/commands/command_fetch_spec.rb", "spec/commands/command_fork_spec.rb", "spec/commands/command_helper.rb", "spec/commands/command_home_spec.rb", "spec/commands/command_info_spec.rb", "spec/commands/command_issues_spec.rb", "spec/commands/command_network_spec.rb", "spec/commands/command_pull-request_spec.rb", "spec/commands/command_pull_spec.rb", "spec/commands/command_search_spec.rb", "spec/commands/command_track_spec.rb", "spec/commands_spec.rb", "spec/extensions_spec.rb", "spec/github_spec.rb", "spec/helper_spec.rb", "spec/spec_helper.rb", "spec/windoze_spec.rb", "github.gemspec"]
15
- s.homepage = %q{http://github.com/}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Github", "--main", "README.md"]
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{github}
19
- s.rubygems_version = %q{1.3.7}
20
- s.summary = %q{The official `github` command line helper for simplifying your GitHub experience.}
15
+ s.rubyforge_project = "github"
21
16
 
22
- if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 3
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "text-format", "1.0.0"
23
+ s.add_dependency "highline", "~> 1.5.1"
24
+ s.add_dependency "json", "~> 1.4.6"
25
+ s.add_dependency "launchy", "~> 0.3.7"
25
26
 
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<text-format>, [">= 1.0.0"])
28
- s.add_runtime_dependency(%q<highline>, ["~> 1.5.1"])
29
- s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
30
- else
31
- s.add_dependency(%q<text-format>, [">= 1.0.0"])
32
- s.add_dependency(%q<highline>, ["~> 1.5.1"])
33
- s.add_dependency(%q<json>, [">= 1.2.0"])
34
- end
35
- else
36
- s.add_dependency(%q<text-format>, [">= 1.0.0"])
37
- s.add_dependency(%q<highline>, ["~> 1.5.1"])
38
- s.add_dependency(%q<json>, [">= 1.2.0"])
39
- end
27
+ s.add_development_dependency "rake"
28
+ s.add_development_dependency "rspec", "~>1.3.1"
29
+ s.add_development_dependency "activerecord", "~>2.3.10"
40
30
  end
@@ -46,7 +46,7 @@ end
46
46
  desc 'Open the given user/project in a web browser'
47
47
  usage 'github open [user/project]'
48
48
  command :open do |arg|
49
- helper.open "http://github.com/#{arg}"
49
+ helper.open "https://github.com/#{arg}"
50
50
  end
51
51
 
52
52
  desc "Info about this project."
@@ -54,7 +54,7 @@ command :info do
54
54
  puts "== Info for #{helper.project}"
55
55
  puts "You are #{helper.owner}"
56
56
  puts "Currently tracking:"
57
- helper.tracking.sort { |(a,),(b,)| a == helper.origin ? -1 : b == helper.origin ? 1 : a.to_s <=> b.to_s }.each do |(name,user_or_url)|
57
+ helper.tracking.sort { |a, b| a == helper.origin ? -1 : b == helper.origin ? 1 : a.to_s <=> b.to_s }.each do |(name,user_or_url)|
58
58
  puts " - #{user_or_url} (as #{name})"
59
59
  end
60
60
  end
@@ -142,7 +142,7 @@ command :clone do |user, repo, dir|
142
142
  die "Specify a user to pull from" if user.nil?
143
143
  if options[:search]
144
144
  query = [user, repo, dir].compact.join(" ")
145
- data = JSON.parse(open("http://github.com/api/v1/json/search/#{URI.escape query}").read)
145
+ data = JSON.parse(open("https://github.com/api/v1/json/search/#{URI.escape query}").read)
146
146
  if (repos = data['repositories']) && !repos.nil? && repos.length > 0
147
147
  repo_list = repos.map do |r|
148
148
  { "name" => "#{r['username']}/#{r['name']}", "description" => r['description'] }
@@ -193,7 +193,7 @@ flags :rdoc => 'Create README.rdoc'
193
193
  flags :rst => 'Create README.rst'
194
194
  flags :private => 'Create private repository'
195
195
  command :create do |repo|
196
- sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{!options[:private]}' -F 'login=#{github_user}' -F 'token=#{github_token}' http://github.com/repositories"
196
+ sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{!options[:private]}' -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/repositories"
197
197
  mkdir repo
198
198
  cd repo
199
199
  git "init"
@@ -223,7 +223,7 @@ command :fork do |user, repo|
223
223
  end
224
224
  end
225
225
 
226
- sh "curl -F 'login=#{github_user}' -F 'token=#{github_token}' http://github.com/#{user}/#{repo}/fork"
226
+ sh "curl -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/#{user}/#{repo}/fork"
227
227
 
228
228
  url = "git@github.com:#{github_user}/#{repo}.git"
229
229
  if is_repo
@@ -243,8 +243,8 @@ command :'create-from-local' do
243
243
  repo = File.basename(cwd)
244
244
  is_repo = !git("status").match(/fatal/)
245
245
  raise "Not a git repository. Use gh create instead" unless is_repo
246
- created = sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{options[:private] != true}' -F 'login=#{github_user}' -F 'token=#{github_token}' http://github.com/repositories"
247
- if created.out =~ %r{You are being <a href="http://github.com/#{github_user}/([^"]+)"}
246
+ created = sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{options[:private] != true}' -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/repositories"
247
+ if created.out =~ %r{You are being <a href="https://github.com/#{github_user}/([^"]+)"}
248
248
  git "remote add origin git@github.com:#{github_user}/#{$1}.git"
249
249
  git_exec "push origin master"
250
250
  else
@@ -257,7 +257,7 @@ desc "Search GitHub for the given repository name."
257
257
  usage "github search [query]"
258
258
  command :search do |query|
259
259
  die "Usage: github search [query]" if query.nil?
260
- data = JSON.parse(open("http://github.com/api/v1/json/search/#{URI.escape query}").read)
260
+ data = JSON.parse(open("https://github.com/api/v1/json/search/#{URI.escape query}").read)
261
261
  if (repos = data['repositories']) && !repos.nil? && repos.length > 0
262
262
  puts repos.map { |r| "#{r['username']}/#{r['name']}"}.sort.uniq
263
263
  else
@@ -2,10 +2,10 @@ DEV_NULL = File.exist?("/dev/null") ? "/dev/null" : "nul:" unless const_defined?
2
2
 
3
3
  helper :user_and_repo_from do |url|
4
4
  case url
5
- when %r|^git://github\.com/([^/]+/[^/]+)$|: $1.split('/')
6
- when %r|^http://github\.com/([^/]+/[^/]+)$|: $1.split('/')
7
- when %r|^(?:git\+ssh://)?(?:git@)?github\.com/([^/]+/[^/]+)$|: $1.split('/')
8
- when %r|^(?:ssh://)?(?:git@)?github\.com:([^/]+/[^/]+)$|: $1.split('/')
5
+ when %r|^git://github\.com/([^/]+/[^/]+)$| then $1.split('/')
6
+ when %r|^https?://github\.com/([^/]+/[^/]+)$| then $1.split('/')
7
+ when %r|^(?:git\+ssh://)?(?:git@)?github\.com/([^/]+/[^/]+)$| then $1.split('/')
8
+ when %r|^(?:ssh://)?(?:git@)?github\.com:([^/]+/[^/]+)$| then $1.split('/')
9
9
  end
10
10
  end
11
11
 
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  helper :project do
31
31
  repo = repo_for(origin)
32
- if repo.nil?
32
+ if repo.nil? || repo.empty?
33
33
  if url_for(origin) == ""
34
34
  STDERR.puts "Error: missing remote 'origin'"
35
35
  else
@@ -249,7 +249,7 @@ helper :network_page_for do |user|
249
249
  end
250
250
 
251
251
  helper :network_meta_for do |user|
252
- "http://github.com/#{user}/#{project}/network_meta"
252
+ "https://github.com/#{user}/#{project}/network_meta"
253
253
  end
254
254
 
255
255
  helper :issues_page_for do |user|
@@ -257,7 +257,7 @@ helper :issues_page_for do |user|
257
257
  end
258
258
 
259
259
  helper :list_issues_for do |user, state|
260
- "http://github.com/api/v2/yaml/issues/list/#{user}/#{project}/#{state}"
260
+ "https://github.com/api/v2/yaml/issues/list/#{user}/#{project}/#{state}"
261
261
  end
262
262
 
263
263
  helper :has_launchy? do |blk|
data/lib/github.rb CHANGED
@@ -163,7 +163,9 @@ GitHub.command :default, :aliases => ['', '-h', 'help', '-help', '--help'] do
163
163
  :body_indent => indent,
164
164
  :columns => 79 # be a little more lenient than the default
165
165
  )
166
- GitHub.descriptions.sort {|a,b| a.to_s <=> b.to_s }.each do |command, desc|
166
+ sorted = GitHub.descriptions.keys.sort
167
+ sorted.each do |command|
168
+ desc = GitHub.descriptions[command]
167
169
  cmdstr = "%-#{longest}s" % command
168
170
  desc = fmt.format(desc).strip # strip to eat first "indent"
169
171
  message << " #{cmdstr} => #{desc}"
@@ -171,7 +173,7 @@ GitHub.command :default, :aliases => ['', '-h', 'help', '-help', '--help'] do
171
173
  ffmt = fmt.clone
172
174
  ffmt.body_indent += 2 # length of "% " and/or "--"
173
175
  GitHub.usage_descriptions[command].each do |usage_descriptions|
174
- usage_descriptions.each do |usage|
176
+ usage_descriptions.split("\n").each do |usage|
175
177
  usage_str = "%% %-#{flongest}s" % usage
176
178
  message << ffmt.format(usage_str)
177
179
  end
@@ -67,11 +67,21 @@ module GitHub
67
67
  end
68
68
 
69
69
  def github_user
70
- git("config --get github.user")
70
+ user = git("config --get github.user")
71
+ if user.empty?
72
+ die("You must 'git config --global github.user [your Github username]' before running this command")
73
+ end
74
+
75
+ user
71
76
  end
72
77
 
73
78
  def github_token
74
- git("config --get github.token")
79
+ token = git("config --get github.token")
80
+ if token.empty?
81
+ die("You must 'git config --global github.token [your API token]' before running this command")
82
+ end
83
+
84
+ token
75
85
  end
76
86
 
77
87
  def shell_user
@@ -99,8 +109,8 @@ module GitHub
99
109
  err = perr.read.strip
100
110
  end
101
111
 
102
- replace @error = err if err.any?
103
- replace @out = out if out.any?
112
+ replace @error = err unless err.empty?
113
+ replace @out = out unless out.empty?
104
114
 
105
115
  self
106
116
  end
@@ -8,7 +8,6 @@ end
8
8
  class NilClass
9
9
  klass = Class.new
10
10
  klass.class_eval do
11
- instance_methods.each { |meth| undef_method meth.to_sym unless meth =~ /^__(id|send)__$/ }
12
11
  def method_missing(*args)
13
12
  self
14
13
  end
@@ -0,0 +1,3 @@
1
+ module GitHub
2
+ VERSION = "0.5.0"
3
+ end
data/spec/command_spec.rb CHANGED
@@ -79,4 +79,18 @@ describe GitHub::Command do
79
79
  @command.should_receive(:exit!).once
80
80
  @command.die "message"
81
81
  end
82
+
83
+ it "should die if a github API token cannot be found" do
84
+ @command.should_receive(:git).once.with("config --get github.token").and_return("")
85
+ @command.should_receive(:puts).once.with("=> You must 'git config --global github.token [your API token]' before running this command")
86
+ @command.should_receive(:exit!).once
87
+ @command.github_token
88
+ end
89
+
90
+ it "should die if a github username token cannot be found" do
91
+ @command.should_receive(:git).once.with("config --get github.user").and_return("")
92
+ @command.should_receive(:puts).once.with("=> You must 'git config --global github.user [your Github username]' before running this command")
93
+ @command.should_receive(:exit!).once
94
+ @command.github_user
95
+ end
82
96
  end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require File.dirname(__FILE__) + '/command_helper'
3
+
4
+ describe "github admin" do
5
+ include CommandHelper
6
+
7
+ specify "admin should open the project admin page" do
8
+ running :admin do
9
+ setup_url_for
10
+ @helper.should_receive(:open).once.with("https://github.com/user/project/admin")
11
+ end
12
+ end
13
+
14
+ specify "admin drnic should open the home page of drnic's fork" do
15
+ running :admin, "drnic" do
16
+ setup_url_for
17
+ @helper.should_receive(:open).once.with("https://github.com/drnic/project/admin")
18
+ end
19
+ end
20
+ end
@@ -76,7 +76,7 @@ describe "github clone" do
76
76
  defunkt/github-gem # The official `github` command line helper for simplifying your GitHub experience.
77
77
  pjhyett/github-gem-builder # The scripts used to build RubyGems on GitHub
78
78
  LIST
79
- @command.should_receive(:open).with("http://github.com/api/v1/json/search/github-gem").and_return(json)
79
+ @command.should_receive(:open).with("https://github.com/api/v1/json/search/github-gem").and_return(json)
80
80
  GitHub::UI.should_receive(:display_select_list).with(question_list).
81
81
  and_return("defunkt/github-gem")
82
82
  @command.should_receive(:current_user?).and_return(nil)
@@ -84,4 +84,4 @@ describe "github clone" do
84
84
  end
85
85
  end
86
86
 
87
- end
87
+ end
@@ -18,8 +18,8 @@ describe "github fork" do
18
18
  setup_url_for "origin", "defunkt", "github-gem"
19
19
  setup_remote "origin", :user => "defunkt", :project => "github-gem"
20
20
  setup_user_and_branch
21
- @command.should_receive(:sh).with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' http://github.com/defunkt/github-gem/fork")
22
- @command.should_receive(:git, "config remote.origin.url git@github.com/drnic/github-gem.git")
21
+ @command.should_receive(:sh).with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' https://github.com/defunkt/github-gem/fork")
22
+ @command.should_receive(:git).with("config remote.origin.url git@github.com:drnic/github-gem.git")
23
23
  stdout.should == "defunkt/github-gem forked\n"
24
24
  end
25
25
  end
@@ -27,8 +27,8 @@ describe "github fork" do
27
27
  specify "fork a user/project repo" do
28
28
  running :fork, "defunkt/github-gem" do
29
29
  setup_github_token
30
- @command.should_receive(:sh).with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' http://github.com/defunkt/github-gem/fork")
31
- @command.should_receive(:git_exec, "clone git://github.com/defunkt/github-gem.git")
30
+ @command.should_receive(:sh).with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' https://github.com/defunkt/github-gem/fork")
31
+ @command.should_receive(:git_exec).with("clone git@github.com:drnic/github-gem.git")
32
32
  stdout.should == "Giving GitHub a moment to create the fork...\n"
33
33
  end
34
34
  end
@@ -36,9 +36,9 @@ describe "github fork" do
36
36
  specify "fork a user project repo" do
37
37
  running :fork, "defunkt", "github-gem" do
38
38
  setup_github_token
39
- @command.should_receive("sh").with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' http://github.com/defunkt/github-gem/fork")
40
- @command.should_receive(:git_exec, "clone git://github.com/defunkt/github-gem.git")
39
+ @command.should_receive("sh").with("curl -F 'login=drnic' -F 'token=MY_GITHUB_TOKEN' https://github.com/defunkt/github-gem/fork")
40
+ @command.should_receive(:git_exec).with("clone git@github.com:drnic/github-gem.git")
41
41
  stdout.should == "Giving GitHub a moment to create the fork...\n"
42
42
  end
43
43
  end
44
- end
44
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "github help" do
4
+
5
+ it "should output help contents" do
6
+ example_output = File.expand_path(File.dirname(__FILE__) + "/../resources/help_output.txt")
7
+ $stdout.should_receive(:write).with(File.read(example_output))
8
+ GitHub.invoke(:default)
9
+ end
10
+
11
+ end
@@ -149,8 +149,6 @@ module CommandHelper
149
149
  @calls = []
150
150
  end
151
151
 
152
- undef_method *(instance_methods.map { |x| x.to_sym } - [:__id__, :__send__])
153
-
154
152
  def invoke
155
153
  @calls.each do |sym, args|
156
154
  (@mock.obj.send @call).send sym, *args
@@ -167,4 +165,4 @@ module CommandHelper
167
165
  @parent.send sym, *args
168
166
  end
169
167
  end
170
- end
168
+ end
@@ -90,7 +90,7 @@ describe "github issues" do
90
90
 
91
91
  state: #{state}
92
92
  YAML
93
- api_url = "http://github.com/api/v2/yaml/issues/list/#{options[:user]}/#{options[:project]}/#{state}"
93
+ api_url = "https://github.com/api/v2/yaml/issues/list/#{options[:user]}/#{options[:project]}/#{state}"
94
94
  @command.should_receive(:open).with(api_url).and_return(yaml)
95
95
  end
96
96
  end
@@ -11,7 +11,7 @@ describe "github search" do
11
11
  '{"name":"github-gem-builder","size":76,"followers":26,"username":"pjhyett","language":"Ruby","fork":false,"id":"repo-67489","type":"repo","pushed":"2008-11-04T04:54:57Z","forks":3,"description":"The scripts used to build RubyGems on GitHub","score":3.4152448,"created":"2008-10-24T22:29:32Z"}' +
12
12
  ']}'
13
13
  json.rewind
14
- @command.should_receive(:open).with("http://github.com/api/v1/json/search/github-gem").and_return(json)
14
+ @command.should_receive(:open).with("https://github.com/api/v1/json/search/github-gem").and_return(json)
15
15
  stdout.should == "defunkt/github-gem\npjhyett/github-gem-builder\n"
16
16
  end
17
17
  end
@@ -20,7 +20,7 @@ describe "github search" do
20
20
  running :search, "xxxxxxxxxx" do
21
21
  json = StringIO.new '{"repositories":[]}'
22
22
  json.rewind
23
- @command.should_receive(:open).with("http://github.com/api/v1/json/search/xxxxxxxxxx").and_return(json)
23
+ @command.should_receive(:open).with("https://github.com/api/v1/json/search/xxxxxxxxxx").and_return(json)
24
24
  stdout.should == "No results found\n"
25
25
  end
26
26
  end
@@ -31,4 +31,4 @@ describe "github search" do
31
31
  self.should raise_error(RuntimeError)
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -0,0 +1,72 @@
1
+ Usage: github command <space separated arguments>
2
+ Available commands:
3
+ admin => Open this repo's Admin panel a web browser.
4
+ browse => Open this repo in a web browser.
5
+ % github browse [user] [branch]
6
+ clone => Clone a repo. Uses ssh if current user is
7
+ % github clone [user] [repo] [dir]
8
+ --search: Search for [user|repo] and clone selected
9
+ repository
10
+ --ssh : Clone using the git@github.com style url.
11
+ config => Automatically set configuration info, or pass args to
12
+ specify.
13
+ % github config [my_username] [my_repo_name]
14
+ create => Create a new, empty GitHub repository
15
+ % github create [repo]
16
+ --markdown: Create README.markdown
17
+ --mdown : Create README.mdown
18
+ --private : Create private repository
19
+ --rdoc : Create README.rdoc
20
+ --rst : Create README.rst
21
+ --textile : Create README.textile
22
+ create-from-local => Create a new GitHub repository from the current local
23
+ repository
24
+ --private: Create private repository
25
+ fetch => Fetch from a remote to a local branch.
26
+ fetch_all => Fetch all refs from a user
27
+ fork => Forks a GitHub repository
28
+ % github fork
29
+ % github fork [user]/[repo]
30
+ home => Open this repo's master branch in a web browser.
31
+ ignore => Ignore a SHA (from 'github network commits')
32
+ info => Info about this project.
33
+ issues => Project issues tools - sub-commands : open [user],
34
+ closed [user]
35
+ --after: Only show issues updated after a certain date
36
+ --label: Only show issues with a certain label
37
+ network => Project network tools - sub-commands : web [user], list,
38
+ fetch, commits
39
+ --after : Only show commits after a certain date
40
+ --applies : Filter commits to patches that apply cleanly
41
+ --author : Filter commits on a email address of author
42
+ --before : Only show commits before a certain date
43
+ --cache : Use the network data even if it's expired
44
+ --common : Show common branch point
45
+ --limit : Only look through the first X heads - useful
46
+ for really large projects
47
+ --noapply : Filter commits to patches that do not apply
48
+ cleanly
49
+ --nocache : Do not use the cached network data
50
+ --project : Filter commits on a certain project
51
+ --shas : Only show shas
52
+ --sort : How to sort : date(*), branch, author
53
+ --thisbranch: Look at branches that match the current
54
+ one
55
+ open => Open the given user/project in a web browser
56
+ % github open [user/project]
57
+ pull => Pull from a remote.
58
+ % github pull [user] [branch]
59
+ --merge: Automatically merge remote's changes into your
60
+ master.
61
+ pull-request => Generate the text for a pull request.
62
+ % github pull-request [user] [branch]
63
+ search => Search GitHub for the given repository name.
64
+ % github search [query]
65
+ track => Track another user's repository.
66
+ % github track remote [user]
67
+ % github track remote [user/repo]
68
+ % github track [user]
69
+ % github track [user/repo]
70
+ --private: Use git@github.com: instead of
71
+ git://github.com/.
72
+ --ssh : Equivalent to --private
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'rubygems'
1
+ require 'bundler/setup'
2
2
  require 'spec'
3
- require 'activerecord'
3
+ require 'active_record'
4
4
 
5
5
  require File.dirname(__FILE__) + '/../lib/github'
6
6
 
metadata CHANGED
@@ -1,93 +1,142 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 4
9
7
  - 5
10
- version: 0.4.5
8
+ - 0
9
+ version: 0.5.0
11
10
  platform: ruby
12
11
  authors:
13
- - Chris Wanstrath, Kevin Ballard, Scott Chacon, Dr Nic Williams
12
+ - Chris Wanstrath
13
+ - Kevin Ballard
14
+ - Scott Chacon
15
+ - Dr Nic Williams
14
16
  autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2010-10-25 00:00:00 -07:00
20
+ date: 2011-01-17 00:00:00 -08:00
19
21
  default_executable:
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
22
24
  name: text-format
23
- prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
- - - ">="
28
+ - - "="
28
29
  - !ruby/object:Gem::Version
29
- hash: 23
30
30
  segments:
31
31
  - 1
32
32
  - 0
33
33
  - 0
34
34
  version: 1.0.0
35
35
  type: :runtime
36
+ prerelease: false
36
37
  version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
38
39
  name: highline
39
- prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 1
46
45
  segments:
47
46
  - 1
48
47
  - 5
49
48
  - 1
50
49
  version: 1.5.1
51
50
  type: :runtime
51
+ prerelease: false
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: json
55
- prerelease: false
56
55
  requirement: &id003 !ruby/object:Gem::Requirement
57
56
  none: false
58
57
  requirements:
59
- - - ">="
58
+ - - ~>
60
59
  - !ruby/object:Gem::Version
61
- hash: 31
62
60
  segments:
63
61
  - 1
64
- - 2
65
- - 0
66
- version: 1.2.0
62
+ - 4
63
+ - 6
64
+ version: 1.4.6
67
65
  type: :runtime
66
+ prerelease: false
68
67
  version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: launchy
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ - 3
78
+ - 7
79
+ version: 0.3.7
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: rspec
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 1
105
+ - 3
106
+ - 1
107
+ version: 1.3.1
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: *id006
111
+ - !ruby/object:Gem::Dependency
112
+ name: activerecord
113
+ requirement: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ segments:
119
+ - 2
120
+ - 3
121
+ - 10
122
+ version: 2.3.10
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: *id007
69
126
  description: The official `github` command line helper for simplifying your GitHub experience.
70
- email: drnicwilliams@gmail.com
127
+ email:
128
+ - drnicwilliams@gmail.com
71
129
  executables:
72
130
  - gh
73
131
  - github
74
132
  extensions: []
75
133
 
76
- extra_rdoc_files:
77
- - LICENSE
78
- - README.md
79
- - bin/gh
80
- - bin/github
81
- - lib/commands/commands.rb
82
- - lib/commands/helpers.rb
83
- - lib/commands/issues.rb
84
- - lib/commands/network.rb
85
- - lib/github.rb
86
- - lib/github/command.rb
87
- - lib/github/extensions.rb
88
- - lib/github/helper.rb
89
- - lib/github/ui.rb
134
+ extra_rdoc_files: []
135
+
90
136
  files:
137
+ - .gitignore
138
+ - Gemfile
139
+ - Gemfile.lock
91
140
  - History.txt
92
141
  - LICENSE
93
142
  - Manifest
@@ -95,6 +144,7 @@ files:
95
144
  - Rakefile
96
145
  - bin/gh
97
146
  - bin/github
147
+ - github.gemspec
98
148
  - lib/commands/commands.rb
99
149
  - lib/commands/helpers.rb
100
150
  - lib/commands/issues.rb
@@ -104,13 +154,16 @@ files:
104
154
  - lib/github/extensions.rb
105
155
  - lib/github/helper.rb
106
156
  - lib/github/ui.rb
157
+ - lib/github/version.rb
107
158
  - setup.rb
108
159
  - spec/command_spec.rb
160
+ - spec/commands/command_admin_spec.rb
109
161
  - spec/commands/command_browse_spec.rb
110
162
  - spec/commands/command_clone_spec.rb
111
163
  - spec/commands/command_create-from-local_spec.rb
112
164
  - spec/commands/command_fetch_spec.rb
113
165
  - spec/commands/command_fork_spec.rb
166
+ - spec/commands/command_help_spec.rb
114
167
  - spec/commands/command_helper.rb
115
168
  - spec/commands/command_home_spec.rb
116
169
  - spec/commands/command_info_spec.rb
@@ -124,21 +177,16 @@ files:
124
177
  - spec/extensions_spec.rb
125
178
  - spec/github_spec.rb
126
179
  - spec/helper_spec.rb
180
+ - spec/resources/help_output.txt
127
181
  - spec/spec_helper.rb
128
182
  - spec/windoze_spec.rb
129
- - github.gemspec
130
183
  has_rdoc: true
131
- homepage: http://github.com/
184
+ homepage: https://github.com/defunkt/github-gem
132
185
  licenses: []
133
186
 
134
187
  post_install_message:
135
- rdoc_options:
136
- - --line-numbers
137
- - --inline-source
138
- - --title
139
- - Github
140
- - --main
141
- - README.md
188
+ rdoc_options: []
189
+
142
190
  require_paths:
143
191
  - lib
144
192
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -146,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
194
  requirements:
147
195
  - - ">="
148
196
  - !ruby/object:Gem::Version
149
- hash: 3
197
+ hash: -2745710888565364419
150
198
  segments:
151
199
  - 0
152
200
  version: "0"
@@ -155,11 +203,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
203
  requirements:
156
204
  - - ">="
157
205
  - !ruby/object:Gem::Version
158
- hash: 11
206
+ hash: -2745710888565364419
159
207
  segments:
160
- - 1
161
- - 2
162
- version: "1.2"
208
+ - 0
209
+ version: "0"
163
210
  requirements: []
164
211
 
165
212
  rubyforge_project: github
@@ -167,5 +214,28 @@ rubygems_version: 1.3.7
167
214
  signing_key:
168
215
  specification_version: 3
169
216
  summary: The official `github` command line helper for simplifying your GitHub experience.
170
- test_files: []
171
-
217
+ test_files:
218
+ - spec/command_spec.rb
219
+ - spec/commands/command_admin_spec.rb
220
+ - spec/commands/command_browse_spec.rb
221
+ - spec/commands/command_clone_spec.rb
222
+ - spec/commands/command_create-from-local_spec.rb
223
+ - spec/commands/command_fetch_spec.rb
224
+ - spec/commands/command_fork_spec.rb
225
+ - spec/commands/command_help_spec.rb
226
+ - spec/commands/command_helper.rb
227
+ - spec/commands/command_home_spec.rb
228
+ - spec/commands/command_info_spec.rb
229
+ - spec/commands/command_issues_spec.rb
230
+ - spec/commands/command_network_spec.rb
231
+ - spec/commands/command_pull-request_spec.rb
232
+ - spec/commands/command_pull_spec.rb
233
+ - spec/commands/command_search_spec.rb
234
+ - spec/commands/command_track_spec.rb
235
+ - spec/commands_spec.rb
236
+ - spec/extensions_spec.rb
237
+ - spec/github_spec.rb
238
+ - spec/helper_spec.rb
239
+ - spec/resources/help_output.txt
240
+ - spec/spec_helper.rb
241
+ - spec/windoze_spec.rb