...
|
...
|
@@ -96,9 +96,7 @@ task :new_post, :title do |t, args|
|
96
|
96
|
title = args.title
|
97
|
97
|
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
|
98
|
98
|
if File.exist?(filename)
|
99
|
|
- puts "### #{filename} Already exists. Overwrite? y/n:"
|
100
|
|
- response = $stdin.gets.chomp.downcase
|
101
|
|
- next unless response == 'y'
|
|
99
|
+ abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
102
|
100
|
end
|
103
|
101
|
puts "Creating new post: #{filename}"
|
104
|
102
|
open(filename, 'w') do |post|
|
...
|
...
|
@@ -128,9 +126,7 @@ task :new_page, :filename do |t, args|
|
128
|
128
|
mkdir_p page_dir
|
129
|
129
|
file = page_dir + filename
|
130
|
130
|
if File.exist?(file)
|
131
|
|
- puts "### #{file} Already exists. Overwrite? y/n:"
|
132
|
|
- response = $stdin.gets.chomp.downcase
|
133
|
|
- next unless response == 'y'
|
|
131
|
+ abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
134
|
132
|
end
|
135
|
133
|
puts "Creating new page: #{file}"
|
136
|
134
|
open(file, 'w') do |page|
|