Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

config command asks for user/token if not provided

  • Loading branch information...
commit 3f1f724754ea93413bbcc209e026cd90bc780741 1 parent 73e56e5
@drnic drnic authored
Showing with 9 additions and 14 deletions.
  1. +9 −6 lib/commands/commands.rb
  2. +0 −8 spec/commands/command_fork_spec.rb
View
15 lib/commands/commands.rb
@@ -8,13 +8,16 @@
end
desc "Automatically set configuration info, or pass args to specify."
-usage "github config [my_username] [my_repo_name]"
-command :config do |user, repo|
- user ||= ENV['USER']
- repo ||= File.basename(FileUtils.pwd)
+usage "github config [my_username] [my_token]"
+command :config do |user, token|
+ require "highline"
+ highline = HighLine.new
+ user ||= highline.ask("What is your github user? ") {|q| q.default = ENV['USER']}
+ token ||= highline.ask("What is your github token? ")
+ repo ||= File.basename(FileUtils.pwd)
git "config --global github.user #{user}"
- git "config github.repo #{repo}"
- puts "Configured with github.user #{user}, github.repo #{repo}"
+ git "config --global github.token #{token}"
+ puts "Configured with github.user #{user}"
end
desc "Open this repo in a web browser."
View
8 spec/commands/command_fork_spec.rb
@@ -42,12 +42,4 @@
end
end
- specify "fork should die if token or user isn't set" do
- running :fork, "defunkt", "github-gem" do
- setup_github_token :user => nil, :token => nil
- @command.should_receive(:die).with("Setup your github user and token before running a fork").and_return { raise "Died" }
- self.should raise_error(RuntimeError)
- end
- end
-
end

0 comments on commit 3f1f724

Please sign in to comment.
Something went wrong with that request. Please try again.