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