Rakefile: use source_dir when setting url via CNAME

This commit is contained in:
Brandon Bradley 2014-11-27 00:33:12 -06:00
parent 3345fa5897
commit 818301c17b

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