aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerizhang <zhang.lyuan@gmail.com>2013-05-31 11:19:47 +0800
committererizhang <zhang.lyuan@gmail.com>2013-05-31 11:19:47 +0800
commitf5bb4dd89ea64181910acb8ef0df5ae84644b75d (patch)
treeb173785d511b497504ad75943d2235f56ec59e26
parente83dfccc4f6f2db6283918af1743e63278807089 (diff)
downloadmy_new_personal_website-f5bb4dd89ea64181910acb8ef0df5ae84644b75d.tar.xz
my_new_personal_website-f5bb4dd89ea64181910acb8ef0df5ae84644b75d.zip
add https protocol supporting during rake setup_github_pages
-rw-r--r--Rakefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index a57a56f6..b9daf00c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -305,9 +305,15 @@ task :setup_github_pages, :repo do |t, args|
else
puts "Enter the read/write url for your repository"
puts "(For example, 'git@github.com:your_username/your_username.github.io)"
+ puts " or 'https://github.com/your_username/your_username.github.io')"
repo_url = get_stdin("Repository url: ")
end
- user = repo_url.match(/:([^\/]+)/)[1]
+ protocol = (repo_url.match(/(^git)@/).nil?) ? 'https' : 'git'
+ if protocol == 'git'
+ user = repo_url.match(/:([^\/]+)/)[1]
+ else
+ user = repo_url.match(/github\.com\/([^\/]+)/)[1]
+ end
branch = (repo_url.match(/\/[\w-]+\.github\.(?:io|com)/).nil?) ? 'gh-pages' : 'master'
project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''
unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?