aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-09-04 08:47:36 -0500
committerBrandon Mathis <brandon@imathis.com>2011-09-04 08:47:36 -0500
commitb812500f392718ad80a5334350b7b7420fe618c3 (patch)
treedf72147bdcd75fb734bd528669bd05186a64c951 /Rakefile
parented0c220523f81a9f29009f8bbb75ff50052465d4 (diff)
downloadmy_new_personal_website-b812500f392718ad80a5334350b7b7420fe618c3.tar.xz
my_new_personal_website-b812500f392718ad80a5334350b7b7420fe618c3.zip
Updated new_post and new_page taks to use new ask method for dialogs
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile8
1 files changed, 2 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 5a3f8f04..3d49fce3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -96,9 +96,7 @@ task :new_post, :title do |t, args|
title = args.title
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
if File.exist?(filename)
- puts "### #{filename} Already exists. Overwrite? y/n:"
- response = $stdin.gets.chomp.downcase
- next unless response == 'y'
+ abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
@@ -128,9 +126,7 @@ task :new_page, :filename do |t, args|
mkdir_p page_dir
file = page_dir + filename
if File.exist?(file)
- puts "### #{file} Already exists. Overwrite? y/n:"
- response = $stdin.gets.chomp.downcase
- next unless response == 'y'
+ abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
puts "Creating new page: #{file}"
open(file, 'w') do |page|