ghrepo 0.0.4 → 0.0.5
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.
- checksums.yaml +8 -8
- data/README.md +47 -9
- data/lib/ghrepo.rb +13 -0
- data/lib/ghrepo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZDQ5ZDhhYWNmMDhkNGMyNWNiMjQ0MjA2MWM5Y2QyZTFkNDM0OGY0Yg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MDc0MjQ1YmQyMWU5YWIzZDRiMmRkOWRhZGU0NDEzZDE3NGZjMmNiNA==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MzY5Yzg0NTA5NmM1OWUyMDI3OTViZDgxN2VlNjYxNzBkYWZjNDJiNTE0ZTRl
|
|
10
|
+
YTIzOTgzZmViMGZlNDhhZjU4OGI4NWZiZDZlZGI4MzNmMTY1MWYzYmRjYmU2
|
|
11
|
+
N2Q3MGUzY2E3NWU2NzRiYjAzZGMwNjJkZGM1ZWFkYTM5Njc3YWU=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MWJkMWQzYTlmZmUxZWVjOTQ2NTY1MzYyMmFjNWRkYTZiNmMwM2JjOGQ3NmUx
|
|
14
|
+
OWU0OTk5N2MzNDA0NjBiMTgwYTY4MzcwMzJlYjY0ZmRjZDkwY2I1OTI5MDUy
|
|
15
|
+
YmJkMWE1ZDkxM2RkMjlkZjZhODdiMTM0MDMzNGRlY2NlZTFkNGM=
|
data/README.md
CHANGED
|
@@ -1,24 +1,62 @@
|
|
|
1
1
|
# Ghrepo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
If you don't want to have to enter your GitHub username and password (or API token) everytime you create a GitHub repo with this gem, set the following environment variables on your system.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
```
|
|
6
|
+
GHREPO_KEY=PERSONAL_GITHUB_API_TOKEN
|
|
7
|
+
GHREPO_USERNAME=YOUR_GITHUB_USERNAME
|
|
8
|
+
```
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Also, if you want to default to using SSH, set the following environment variable
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
```
|
|
13
|
+
GHREPO_SSH=true
|
|
14
|
+
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
You can create a personal GitHub API token here:
|
|
17
|
+
<img src="https://d2oawfjgoy88bd.cloudfront.net/5393b246c38aa547534fcae3/5393b246c38aa547534fcae5/5393b24ac38aa54754e9b138.png?Expires=1402277210&Signature=GpJuRQJMfxRpGohuxHZnKd9H1DcmBskpLshyJsMF4y2RQc89-YcRWY-gYtT6yFzG7lD2483YKlGk6H5mjljG0kEp-eAvVndMPSkdX9wK~VRJMWgoC9Y3RobP9nOruCaRR4O6wKngFjetKrTcHvCL6CyE9PcSCQIy2ta4Ua0EBaaJ794RcNp0fIxv3XzYqNiPM0Nfo~c7zFn0kPU9BULq56zbSfBI3B1fnIGaIM1iLCDHP6RWWD4ECd3q62PlwhPX42equ5PLD2P~u20gmgujWvw-fUiyj65UZeVf0esaknZmoatZdIhu3B6FkOx6~et9gahYz1s98KfKrbPRfiJplA__&Key-Pair-Id=APKAJHEJJBIZWFB73RSA">
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
## Installation
|
|
16
20
|
|
|
17
21
|
$ gem install ghrepo
|
|
18
22
|
|
|
19
23
|
## Usage
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
Create an empty repo on GitHub and clone that directory into the directory that you are currently in
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ ghrepo soverywow
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Create an empty repo on GitHub and clone that directory using the SSH address
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
$ ghrepo -ssh soverywow
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Create an empty repo on GitHub, build a boilerplate Rails app and push it to the GitHub repository that was just created
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
$ ghrepo -rails soverywow
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Create an empty repo on GitHub, build a boilerplate Rails app and push it to the GitHub repository that was just created using SSH
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
$ ghrepo -rails -ssh soverywow
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create an empty repo on GitHub, build a boilerplate HTML5 index.html file and push it to the GitHub repository that was just created
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
$ ghrepo -html soverywow
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Create an empty repo on GitHub, build a boilerplate HTML5 index.html and push it to the GitHub repository that was just created using SSH
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
$ ghrepo -html -ssh soverywow
|
|
59
|
+
```
|
|
22
60
|
|
|
23
61
|
## Contributing
|
|
24
62
|
|
data/lib/ghrepo.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "ghrepo/version"
|
|
4
4
|
require "json"
|
|
5
5
|
require "io/console"
|
|
6
|
+
require "pry"
|
|
6
7
|
|
|
7
8
|
module Ghrepo
|
|
8
9
|
|
|
@@ -17,6 +18,7 @@ module Ghrepo
|
|
|
17
18
|
|
|
18
19
|
args.include?('-rails') ? include_rails(args, repo_name, git_url) : `git clone "#{git_url}"`
|
|
19
20
|
add_html(repo_name, git_url) if args.include?('-html')
|
|
21
|
+
find_collabs(args, credentials, repo_name) if args.include?('-c')
|
|
20
22
|
|
|
21
23
|
else
|
|
22
24
|
puts "RTFM dummy!"
|
|
@@ -100,4 +102,15 @@ module Ghrepo
|
|
|
100
102
|
`git commit -m "boilerplate rails"`
|
|
101
103
|
`git push -u origin master`
|
|
102
104
|
end
|
|
105
|
+
|
|
106
|
+
def find_collabs(args, credentials, repo_name)
|
|
107
|
+
starts_with_c = args.drop_while {|arg| arg.start_with?('-c')}
|
|
108
|
+
collabs_list = starts_with_c.reject {|flags| flags.start_with?('-')}
|
|
109
|
+
collabs_list.each {|collab| add_collaborator(collab, credentials, repo_name)}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def add_collaborator(collab, credentials, repo_name)
|
|
113
|
+
`curl -i -u "#{credentials[:username]}:#{credentials[:password]}" -X PUT -d '' https://api.github.com/repos/"#{credentials[:username]}"/"#{repo_name}"/collaborators/"#{collab}"`
|
|
114
|
+
puts "succesfully added collaborator ", collab
|
|
115
|
+
end
|
|
103
116
|
end
|
data/lib/ghrepo/version.rb
CHANGED