github-create 0.2 → 0.4
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 +13 -2
- data/lib/github-create.rb +12 -20
- data/lib/github-create/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -3,15 +3,26 @@ github-create
|
|
3
3
|
|
4
4
|
Adds an executable `ghcreate` which will help you by creating github repos from your command line
|
5
5
|
|
6
|
+
Install
|
7
|
+
--------
|
8
|
+
|
9
|
+
gem install github-create
|
10
|
+
|
11
|
+
|
12
|
+
Usage
|
13
|
+
------
|
14
|
+
|
15
|
+
ghcreate -c REPO_NAME
|
6
16
|
|
7
17
|
Options
|
8
18
|
--------
|
9
19
|
|
20
|
+
`-c, --c NAME` specifying the name of the repo to create
|
21
|
+
|
10
22
|
`-p, --private` create private repo
|
11
23
|
|
12
24
|
`--clear` clear github username, stored in $HOME/.github-create
|
13
25
|
|
14
|
-
`-c, --c NAME` specifying the name of the repo to create
|
15
|
-
|
16
26
|
`-r, --remote NAME` set the origin name. If not specified origin or github is used
|
17
27
|
|
28
|
+
`-h, --help` displays help message
|
data/lib/github-create.rb
CHANGED
@@ -12,7 +12,7 @@ class GithubCreate
|
|
12
12
|
File.delete configFilePath
|
13
13
|
puts "Username in $HOME/.github-create cleared"
|
14
14
|
rescue
|
15
|
-
puts "Oops! could not delete file"
|
15
|
+
puts "Oops! could not config delete file"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -29,37 +29,29 @@ class GithubCreate
|
|
29
29
|
return
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
return
|
35
|
-
# get remote url of the repo
|
36
|
-
remoteUrl = getRemoteUrl(repo, pw)
|
32
|
+
remoteUrl = repoUrl.sub("https://", "git@").sub("/",":") << ".git"
|
37
33
|
|
38
|
-
#
|
39
|
-
|
40
|
-
puts "something went wrong..."
|
41
|
-
return
|
42
|
-
end
|
34
|
+
# remote url of the repo
|
35
|
+
# remoteUrl = getRemoteUrl(repo, pw)
|
43
36
|
|
44
37
|
# setup remote in local repo
|
45
|
-
unless setupRemote
|
38
|
+
unless setupRemote(remote, remoteUrl)
|
46
39
|
return
|
47
40
|
end
|
48
41
|
|
49
|
-
puts "setup done"
|
50
42
|
end
|
51
43
|
|
52
44
|
|
53
45
|
def self.createRepo(repo, access, pw)
|
54
46
|
username = readCredentialsFromFile
|
55
47
|
result = makeCreateRequest username, pw, repo, access
|
56
|
-
|
57
|
-
if
|
58
|
-
puts "Repository is at " << result["repository"]["url"]
|
59
|
-
return result["repository"]["url"]
|
60
|
-
else
|
48
|
+
|
49
|
+
if result.has_key?('error')
|
61
50
|
puts "Error: " << result["error"]
|
62
51
|
return nil
|
52
|
+
else
|
53
|
+
puts "Repository is at " << result["repository"]["url"]
|
54
|
+
return result["repository"]["url"]
|
63
55
|
end
|
64
56
|
|
65
57
|
end
|
@@ -76,10 +68,10 @@ class GithubCreate
|
|
76
68
|
|
77
69
|
def self.setupRemote(remoteName, remoteUrl)
|
78
70
|
# check for remote and create it
|
79
|
-
if
|
71
|
+
if checkIfRemoteExists(remoteName)
|
80
72
|
if remoteName == "origin"
|
81
73
|
remoteName = "github"
|
82
|
-
addRemote(remoteName, remoteUrl) unless
|
74
|
+
addRemote(remoteName, remoteUrl) unless checkIfRemoteExists(remoteName)
|
83
75
|
else
|
84
76
|
puts "Seems like remote with that name already exists!"
|
85
77
|
puts "Here's the remote url of the repo to add it yourself: " << remoteUrl
|