From 498116b77465d8cdc87c25e3abd7701e4f8e0318 Mon Sep 17 00:00:00 2001 From: Daniel Escoz Date: Fri, 23 Aug 2013 12:26:49 +0200 Subject: [PATCH 1/3] Fixed blog_url not returning & rake setup_github_pages failing When executing `rake setup_github_pages`, an error tells that `url` don't exist. The reference to that variable has been changed to a call to `blog_url`. The function `blog_url` was not returning anything, failing to properly write the `_config.yml` file. It now does return what should have. --- Rakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ce6ba4a..a30a6f8 100644 --- a/Rakefile +++ b/Rakefile @@ -358,7 +358,7 @@ task :setup_github_pages, :repo do |t, args| f.write rakefile end end - puts "\n---\n## Now you can deploy to #{url} with `rake deploy` ##" + puts "\n---\n## Now you can deploy to #{blog_url(user, project)} with `rake deploy` ##" end def ok_failed(condition) @@ -390,6 +390,7 @@ def blog_url(user, project) "http://#{user}.github.io" end url += "/#{project}" unless project == '' + url end desc "list tasks" From a4236cae1b8e20e091fe7e42a05b376cd60eb312 Mon Sep 17 00:00:00 2001 From: Daniel Escoz Date: Fri, 23 Aug 2013 12:36:08 +0200 Subject: [PATCH 2/3] Fixed blog_url when user contains uppercase letters --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index a30a6f8..177a9e9 100644 --- a/Rakefile +++ b/Rakefile @@ -387,7 +387,7 @@ def blog_url(user, project) url = if File.exists?('source/CNAME') "http://#{IO.read('source/CNAME').strip}" else - "http://#{user}.github.io" + "http://#{user.downcase}.github.io" end url += "/#{project}" unless project == '' url From 631069f427764884855efc03660dbaec363dd565 Mon Sep 17 00:00:00 2001 From: Daniel Escoz Date: Sun, 25 Aug 2013 12:29:21 +0200 Subject: [PATCH 3/3] Made blog_url becalled just once... ...and stored in the `url` variable. --- Rakefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 177a9e9..884fb77 100644 --- a/Rakefile +++ b/Rakefile @@ -337,8 +337,9 @@ task :setup_github_pages, :repo do |t, args| end end end + url = blog_url(user, project) jekyll_config = IO.read('_config.yml') - jekyll_config.sub!(/^url:.*$/, "url: #{blog_url(user, project)}") + jekyll_config.sub!(/^url:.*$/, "url: #{url}") File.open('_config.yml', 'w') do |f| f.write jekyll_config end @@ -358,7 +359,7 @@ task :setup_github_pages, :repo do |t, args| f.write rakefile end end - puts "\n---\n## Now you can deploy to #{blog_url(user, project)} with `rake deploy` ##" + puts "\n---\n## Now you can deploy to #{url} with `rake deploy` ##" end def ok_failed(condition)