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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjY3MDU2NTM0ODI4OTgzNzg3MTgzOTRlMjgxODQ5MDc3YTQyNjc0Mg==
4
+ ZDQ5ZDhhYWNmMDhkNGMyNWNiMjQ0MjA2MWM5Y2QyZTFkNDM0OGY0Yg==
5
5
  data.tar.gz: !binary |-
6
- NzIwYWE2Y2ZmNzRkODRmMGM1ZTM1MGVkNDRmODI5ODVkNDZhYzdlNQ==
6
+ MDc0MjQ1YmQyMWU5YWIzZDRiMmRkOWRhZGU0NDEzZDE3NGZjMmNiNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjlkZmZjNWFhOWRlNWEzZmJlNDNjODg4NDM1YTc5M2JkNDg0NWZkZDBlZjg4
10
- YTQ5NjA1OWMzYjkzYWU4Y2YwNDNjNmU5NjZlMmFkYjI4Nzg5NDNjYmVlZjJi
11
- OTQ1YzA1ZDMzNGEyNzk3ZGNlZjFiZWU0NTliYjIwYTJmYmVhMWE=
9
+ MzY5Yzg0NTA5NmM1OWUyMDI3OTViZDgxN2VlNjYxNzBkYWZjNDJiNTE0ZTRl
10
+ YTIzOTgzZmViMGZlNDhhZjU4OGI4NWZiZDZlZGI4MzNmMTY1MWYzYmRjYmU2
11
+ N2Q3MGUzY2E3NWU2NzRiYjAzZGMwNjJkZGM1ZWFkYTM5Njc3YWU=
12
12
  data.tar.gz: !binary |-
13
- MTkzOTA3NDM1NWE2Y2M2YzgxODMzY2NlZjZhNDc2NmJkMjM5NjMwMmU4NjY5
14
- ZGUzMDk3NjcxOTI0NzhiNzU5NzM1OThjYWI0ZGQzMGYxMDZiYmFjNGQ4NThh
15
- MjIyMzA1ZDkxN2U2ZGM0YmYwOGU0OTMwYmYyN2VlZjM0OGYxMzI=
13
+ MWJkMWQzYTlmZmUxZWVjOTQ2NTY1MzYyMmFjNWRkYTZiNmMwM2JjOGQ3NmUx
14
+ OWU0OTk5N2MzNDA0NjBiMTgwYTY4MzcwMzJlYjY0ZmRjZDkwY2I1OTI5MDUy
15
+ YmJkMWE1ZDkxM2RkMjlkZjZhODdiMTM0MDMzNGRlY2NlZTFkNGM=
data/README.md CHANGED
@@ -1,24 +1,62 @@
1
1
  # Ghrepo
2
2
 
3
- TODO: Write a gem description
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
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
5
+ ```
6
+ GHREPO_KEY=PERSONAL_GITHUB_API_TOKEN
7
+ GHREPO_USERNAME=YOUR_GITHUB_USERNAME
8
+ ```
8
9
 
9
- gem 'ghrepo'
10
+ Also, if you want to default to using SSH, set the following environment variable
10
11
 
11
- And then execute:
12
+ ```
13
+ GHREPO_SSH=true
14
+ ```
12
15
 
13
- $ bundle
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
- Or install it yourself as:
19
+ ## Installation
16
20
 
17
21
  $ gem install ghrepo
18
22
 
19
23
  ## Usage
20
24
 
21
- TODO: Write usage instructions here
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Ghrepo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghrepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris DeLauder