smdev 0.7.0 → 0.9.0
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 +4 -4
- data/lib/smdev.rb +26 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd3bd438e2a171908e6227b3361cfa8d851a04d8a7e72c76eb1b7fbf53f52b48
|
4
|
+
data.tar.gz: 9b45204d34f2b68fa9c8f693290e0fc67b9ca61d2d07831cf44e3f9a760cfb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eaf68d9b2d3c6e8cb85255d59df6415b6255db21328f1835442340dd7efe47601421efc348277282013f3256265647d4a2afe99d983fab16efb0f1c38c9acf5
|
7
|
+
data.tar.gz: 2f2ad3110f162fc18abe33e1c59d2633169a8cd3dd2aee8c5f45fd393fce5be9fadc8c149777180860ea84430a66849aec9c2985d35b55fc95cd4015ea21e0c4
|
data/lib/smdev.rb
CHANGED
@@ -146,13 +146,16 @@ module Smdev
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def get_repos(options)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
149
|
+
if options[:https]
|
150
|
+
token = ENV['GITHUB_TOKEN']
|
151
|
+
if token.nil?
|
152
|
+
# Prompt the user for their GitHub personal access token
|
153
|
+
print "GitHub personal access token: "
|
154
|
+
token = STDIN.noecho(&:gets).chomp
|
155
|
+
puts ""
|
156
|
+
end
|
155
157
|
end
|
158
|
+
|
156
159
|
# Authenticate with the GitHub API using the user's credentials
|
157
160
|
client = Octokit::Client.new(access_token: token)
|
158
161
|
|
@@ -200,7 +203,15 @@ module Smdev
|
|
200
203
|
|
201
204
|
if Dir.exist?(repo_name)
|
202
205
|
puts "Checking for updates to '#{repo_name}'"
|
203
|
-
|
206
|
+
if options[:https]
|
207
|
+
puts "Using HTTPS to pull repo"
|
208
|
+
token = ENV['GITHUB_TOKEN']
|
209
|
+
url_with_token = url.sub('https://', "https://#{token}@")
|
210
|
+
`cd #{repo_name} && git -c http.extraHeader="Authorization: Bearer #{token}" pull #{url_with_token}`
|
211
|
+
else
|
212
|
+
puts "Using SSH to pull repo"
|
213
|
+
`cd #{repo_name} && git pull`
|
214
|
+
end
|
204
215
|
else
|
205
216
|
puts "Repository '#{repo_name}' isn't cloned locally. Skipping update."
|
206
217
|
end
|
@@ -212,6 +223,14 @@ module Smdev
|
|
212
223
|
def checkout_repos(options)
|
213
224
|
repos = get_repos(options)
|
214
225
|
|
226
|
+
unless options[:https]
|
227
|
+
puts "*************************************************************************"
|
228
|
+
puts "* You must use https to get private repositories. *"
|
229
|
+
puts "* If you have not setup your github token, you will be prompted for it. *"
|
230
|
+
puts "* Use smdev -s to use https. *"
|
231
|
+
puts "*************************************************************************"
|
232
|
+
end
|
233
|
+
|
215
234
|
# Clone each repository to a local directory
|
216
235
|
repos.each do |repo|
|
217
236
|
clone_url = repo.clone_url
|