github-create 0.0.1 → 0.2

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.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ github-create
2
+ ==============
3
+
4
+ Adds an executable `ghcreate` which will help you by creating github repos from your command line
5
+
6
+
7
+ Options
8
+ --------
9
+
10
+ `-p, --private` create private repo
11
+
12
+ `--clear` clear github username, stored in $HOME/.github-create
13
+
14
+ `-c, --c NAME` specifying the name of the repo to create
15
+
16
+ `-r, --remote NAME` set the origin name. If not specified origin or github is used
17
+
data/lib/github-create.rb CHANGED
@@ -23,10 +23,14 @@ class GithubCreate
23
23
  pw = getCredentials
24
24
 
25
25
  # if cannot create repo return
26
- unless createRepo(remote, access, pw)
26
+ repoUrl = createRepo(repo, access, pw)
27
+ if repoUrl.nil?
28
+ puts "Oops! couldn't create repo"
27
29
  return
28
30
  end
29
31
 
32
+ puts repoUrl
33
+
30
34
  return
31
35
  # get remote url of the repo
32
36
  remoteUrl = getRemoteUrl(repo, pw)
@@ -50,7 +54,14 @@ class GithubCreate
50
54
  username = readCredentialsFromFile
51
55
  result = makeCreateRequest username, pw, repo, access
52
56
  puts result
53
- puts result.class
57
+ if not result["error"].nil?
58
+ puts "Repository is at " << result["repository"]["url"]
59
+ return result["repository"]["url"]
60
+ else
61
+ puts "Error: " << result["error"]
62
+ return nil
63
+ end
64
+
54
65
  end
55
66
 
56
67
  def self.createLocalRepo
@@ -146,7 +157,6 @@ class GithubCreate
146
157
  }
147
158
 
148
159
  basic_auth username, pw
149
-
150
160
  self.post('http://github.com/api/v2/json/repos/create', options)
151
161
  end
152
162
 
@@ -1,5 +1,5 @@
1
1
  module Github
2
2
  module Create
3
- VERSION = "0.0.1"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: github-create
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: "0.2"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Akash Manohar
@@ -26,6 +26,7 @@ extra_rdoc_files: []
26
26
  files:
27
27
  - .gitignore
28
28
  - Gemfile
29
+ - README.md
29
30
  - Rakefile
30
31
  - bin/ghcreate
31
32
  - github-create.gemspec