mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-25 00:48:53 -05:00
Updated new_post and new_page taks to use new ask method for dialogs
This commit is contained in:
parent
ed0c220523
commit
b812500f39
8
Rakefile
8
Rakefile
@ -96,9 +96,7 @@ task :new_post, :title do |t, args|
|
|||||||
title = args.title
|
title = args.title
|
||||||
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
|
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
|
||||||
if File.exist?(filename)
|
if File.exist?(filename)
|
||||||
puts "### #{filename} Already exists. Overwrite? y/n:"
|
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
||||||
response = $stdin.gets.chomp.downcase
|
|
||||||
next unless response == 'y'
|
|
||||||
end
|
end
|
||||||
puts "Creating new post: #{filename}"
|
puts "Creating new post: #{filename}"
|
||||||
open(filename, 'w') do |post|
|
open(filename, 'w') do |post|
|
||||||
@ -128,9 +126,7 @@ task :new_page, :filename do |t, args|
|
|||||||
mkdir_p page_dir
|
mkdir_p page_dir
|
||||||
file = page_dir + filename
|
file = page_dir + filename
|
||||||
if File.exist?(file)
|
if File.exist?(file)
|
||||||
puts "### #{file} Already exists. Overwrite? y/n:"
|
abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
||||||
response = $stdin.gets.chomp.downcase
|
|
||||||
next unless response == 'y'
|
|
||||||
end
|
end
|
||||||
puts "Creating new page: #{file}"
|
puts "Creating new page: #{file}"
|
||||||
open(file, 'w') do |page|
|
open(file, 'w') do |page|
|
||||||
|
Loading…
Reference in New Issue
Block a user