ghrepo 0.0.1 → 0.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.
- checksums.yaml +8 -8
- data/lib/ghrepo.rb +23 -4
- 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
|
+
ZGRkMTExNjA5MjM3ZWVkYjhkNjBiNDc4M2ZjNTIyNjExNGNlZDE2MQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MWMwNWQ5ZGMyNTMwMDNlNzMxZDk2MWE5ZTkwNWNkNmYwYjk0NGMzMQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ZDBmMGU2NzVhZWM4MTVjMGI4ZjFiYjA5MzFjMWU5ZTRlYzc4OGY2NTM2ZjFj
|
|
10
|
+
NGViNDAwMTYwYjgzZDcwNmQ0MWNjZTVlNWY5YjBlODI4YWUwNDExZTUzZGQz
|
|
11
|
+
ZWI2OTQzZjdhODliYmExMTI5ZjExMDA1OGVmZDFhODZjNmFiYzg=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
N2RmM2E5NjY5NzkwYzZiNzhiMjk5YzhiMTlhYmMzNzhhZGY5MTM5ZjhhOTc1
|
|
14
|
+
NjJkMDRkZDczNTZhMDZkNWM1ZWU4OTIwNTM5MWY3Zjk1NWViYWZkZWMyZmFl
|
|
15
|
+
MTk3NmY5ODRmYjMxYjhkMmZhYzRlYzI0OGY4ZDZiNzEyYTcxOWQ=
|
data/lib/ghrepo.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Ghrepo
|
|
|
15
15
|
response = `curl -u "#{credentials[:username]}:#{credentials[:password]}" https://api.github.com/user/repos -d '{"name":"'#{repo_name}'"}'`
|
|
16
16
|
git_url = JSON.parse(response)[credentials[:url]]
|
|
17
17
|
|
|
18
|
-
`git clone "#{git_url}"`
|
|
18
|
+
args.include?('-rails') ? include_rails(args, repo_name, git_url) : `git clone "#{git_url}"`
|
|
19
19
|
else
|
|
20
20
|
puts "RTFM dummy!"
|
|
21
21
|
puts <<-eos
|
|
@@ -44,12 +44,12 @@ module Ghrepo
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def prompt_password
|
|
47
|
-
|
|
47
|
+
print "password > "
|
|
48
48
|
password = STDIN.noecho(&:gets).chomp
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def set_url(args)
|
|
52
|
-
args.include?('-ssl') ? 'ssh_url' : '
|
|
52
|
+
args.include?('-ssl') ? 'ssh_url' : 'clone_url'
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def set_username
|
|
@@ -57,7 +57,7 @@ module Ghrepo
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def prompt_username
|
|
60
|
-
|
|
60
|
+
print "github username > "
|
|
61
61
|
username = STDIN.gets.chomp
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -68,4 +68,23 @@ module Ghrepo
|
|
|
68
68
|
def set_credentials(args)
|
|
69
69
|
{url: set_url(args), username: set_username, password: set_password}
|
|
70
70
|
end
|
|
71
|
+
|
|
72
|
+
def include_rails(args, repo_name, git_url)
|
|
73
|
+
add_rails(repo_name, git_url)
|
|
74
|
+
push_rails
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def add_rails(repo_name, git_url)
|
|
78
|
+
puts "\nbuilding your rails app...."
|
|
79
|
+
`rails new "#{repo_name}"`
|
|
80
|
+
Dir.chdir(repo_name)
|
|
81
|
+
`git init`
|
|
82
|
+
`git remote add origin "#{git_url}"`
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def push_rails
|
|
86
|
+
`git add .`
|
|
87
|
+
`git commit -m "boilerplate rails"`
|
|
88
|
+
`git push -u origin master`
|
|
89
|
+
end
|
|
71
90
|
end
|
data/lib/ghrepo/version.rb
CHANGED