Skip to content

Commit

Permalink
Updated new_post and new_page taks to use new ask method for dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
imathis committed Sep 4, 2011
1 parent ed0c220 commit b812500
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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|
Expand Down

0 comments on commit b812500

Please sign in to comment.