Browse Source

Added support for deploying to github.io

unreleased_contents
Brandon Mathis 12 years ago
parent
commit
1bd2b62a80
  1. 6
      Rakefile

6
Rakefile

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

Loading…
Cancel
Save