|
|
|
@ -304,11 +304,11 @@ task :setup_github_pages, :repo do |t, args|
|
|
|
|
|
repo_url = args.repo
|
|
|
|
|
else
|
|
|
|
|
puts "Enter the read/write url for your repository"
|
|
|
|
|
puts "(For example, 'git@github.com:your_username/your_username.github.com)"
|
|
|
|
|
puts "(For example, 'git@github.com:your_username/your_username.github.io)"
|
|
|
|
|
repo_url = get_stdin("Repository url: ")
|
|
|
|
|
end
|
|
|
|
|
user = repo_url.match(/:([^\/]+)/)[1]
|
|
|
|
|
branch = (repo_url.match(/\/[\w-]+\.github\.com/).nil?) ? 'gh-pages' : 'master'
|
|
|
|
|
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?
|
|
|
|
|
# If octopress is still the origin remote (from cloning) rename it to octopress
|
|
|
|
@ -328,7 +328,7 @@ task :setup_github_pages, :repo do |t, args|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
url = "http://#{user}.github.com"
|
|
|
|
|
url = "http://#{user}.github.io"
|
|
|
|
|
url += "/#{project}" unless project == ''
|
|
|
|
|
jekyll_config = IO.read('_config.yml')
|
|
|
|
|
jekyll_config.sub!(/^url:.*$/, "url: #{url}")
|
|
|
|
|