Merge pull request #1687 from blbradley/rakefile-cname-sourcedir

Rakefile: use source_dir when setting url via CNAME
This commit is contained in:
Brandon Mathis 2014-12-21 08:44:24 -06:00
commit 52aa0d2524

View File

@ -341,7 +341,7 @@ task :setup_github_pages, :repo do |t, args|
end end
end end
end end
url = blog_url(user, project) url = blog_url(user, project, source_dir)
jekyll_config = IO.read('_config.yml') jekyll_config = IO.read('_config.yml')
jekyll_config.sub!(/^url:.*$/, "url: #{url}") jekyll_config.sub!(/^url:.*$/, "url: #{url}")
File.open('_config.yml', 'w') do |f| File.open('_config.yml', 'w') do |f|
@ -388,9 +388,10 @@ def ask(message, valid_options)
answer answer
end end
def blog_url(user, project) def blog_url(user, project, source_dir)
url = if File.exists?('source/CNAME') cname = "#{source_dir}/CNAME"
"http://#{IO.read('source/CNAME').strip}" url = if File.exists?(cname)
"http://#{IO.read(cname).strip}"
else else
"http://#{user.downcase}.github.io" "http://#{user.downcase}.github.io"
end end