aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Slifka <robert.slifka@gmail.com>2013-08-21 20:58:45 -0700
committerRob Slifka <robert.slifka@gmail.com>2013-08-21 20:58:45 -0700
commitf56cbb55891c9214d66a9eaace4120d0901c62b4 (patch)
tree4a6de1b1f49efa2fdf36f534e9df6cfa2130e600
parentdef01cb4441a08a4dca4b4be4d44c8684857f648 (diff)
downloadmy_new_personal_website-f56cbb55891c9214d66a9eaace4120d0901c62b4.tar.xz
my_new_personal_website-f56cbb55891c9214d66a9eaace4120d0901c62b4.zip
Extract method
Diffstat (limited to '')
-rw-r--r--Rakefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/Rakefile b/Rakefile
index f16a5f40..8e07281a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -337,14 +337,8 @@ task :setup_github_pages, :repo do |t, args|
end
end
end
- url = if File.exists?('source/CNAME')
- "http://#{IO.read('source/CNAME').strip}"
- else
- "http://#{user}.github.io"
- end
- url += "/#{project}" unless project == ''
jekyll_config = IO.read('_config.yml')
- jekyll_config.sub!(/^url:.*$/, "url: #{url}")
+ jekyll_config.sub!(/^url:.*$/, "url: #{blog_url(user,project)}")
File.open('_config.yml', 'w') do |f|
f.write jekyll_config
end
@@ -389,6 +383,15 @@ def ask(message, valid_options)
answer
end
+def blog_url(user, project)
+ url = if File.exists?('source/CNAME')
+ "http://#{IO.read('source/CNAME').strip}"
+ else
+ "http://#{user}.github.io"
+ end
+ url += "/#{project}" unless project == ''
+end
+
desc "list tasks"
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"