Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

github create & github config #83

Merged
merged 2 commits into from

3 participants

Drew Delianides Dr Nic Williams AB12CD34
Drew Delianides

Two issues I found and fixed. The first was with github create, which now sends the json request to the API along with the name. It was correct in create-from-local but not create. Also I set the creation of the local git repo conditional to the success of the curl request.

The second was with github config; overriding the global github.user with the username of the current ENV (whoami).

This was all working with ruby 1.9.3p125.

Drew Delianides added some commits
Drew Delianides Fixed ERROR caused by running github create, also fixed issue were gi…
…thub.user global was being set to ENV username.
ce98f26
Drew Delianides Don't need logger anymore c82d361
Dr Nic Williams drnic merged commit 8ef0c30 into from
Dr Nic Williams
Collaborator

Thanks!

AB12CD34

hello happy new year 2014

i thing good day

somthing write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 15, 2012
  1. Fixed ERROR caused by running github create, also fixed issue were gi…

    Drew Delianides authored
    …thub.user global was being set to ENV username.
  2. Don't need logger anymore

    Drew Delianides authored
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 11 deletions.
  1. +17 −11 lib/commands/commands.rb
28 lib/commands/commands.rb
View
@@ -20,7 +20,7 @@
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']
+ user ||= "#{github_user}"
repo ||= File.basename(FileUtils.pwd)
git "config --global github.user #{user}"
git "config github.repo #{repo}"
@@ -193,16 +193,22 @@
flags :rst => 'Create README.rst'
flags :private => 'Create private repository'
command :create do |repo|
- sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{!options[:private]}' -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/repositories"
- mkdir repo
- cd repo
- git "init"
- extension = options.keys.first
- touch extension ? "README.#{extension}" : "README"
- git "add *"
- git "commit -m 'First commit!'"
- git "remote add origin git@github.com:#{github_user}/#{repo}.git"
- git_exec "push origin master"
+ command = "curl -F 'name=#{repo}' -F 'public=#{options[:private] ? 0 : 1}' -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/api/v2/json/repos/create"
+ output_json = sh command
+ output = JSON.parse(output_json)
+ if output["error"]
+ die output["error"]
+ else
+ mkdir repo
+ cd repo
+ git "init"
+ extension = options.keys.first
+ touch extension ? "README.#{extension}" : "README"
+ git "add *"
+ git "commit -m 'First commit!'"
+ git "remote add origin git@github.com:#{github_user}/#{repo}.git"
+ git_exec "push origin master"
+ end
end
desc "Forks a GitHub repository"
Something went wrong with that request. Please try again.