diff options
Diffstat (limited to '')
-rw-r--r-- | Rakefile | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -108,7 +108,7 @@ task :new_post, :title do |t, args| post.puts "---" post.puts "layout: post" post.puts "title: \"#{title.gsub(/&/,'&')}\"" - post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}" + post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}" post.puts "comments: true" post.puts "categories: " post.puts "---" @@ -307,7 +307,7 @@ task :setup_github_pages, :repo do |t, args| repo_url = args.repo else puts "Enter the read/write url for your repository" - puts "(For example, 'git@github.com:your_username/your_username.github.io)" + puts "(For example, 'git@github.com:your_username/your_username.github.io.git)" puts " or 'https://github.com/your_username/your_username.github.io')" repo_url = get_stdin("Repository url: ") end @@ -337,10 +337,8 @@ task :setup_github_pages, :repo do |t, args| end end end - url = "http://#{user}.github.io" - 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 @@ -360,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 #{repo_url} with `rake deploy` ##" end def ok_failed(condition) @@ -385,6 +383,16 @@ 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 == '' + url +end + desc "list tasks" task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" |