lib/octopress/page.rb in octopress-3.0.0.alpha6 vs lib/octopress/page.rb in octopress-3.0.0.alpha7
- old
+ new
@@ -8,11 +8,11 @@
@content = options['content'] || content
end
def write
if File.exist?(path) && !@options['force']
- abort "File #{relative_path} already exists"
+ raise "File #{relative_path} already exists. Use --force to overwrite."
end
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') { |f| f.write(@content) }
if STDOUT.tty?
@@ -32,9 +32,10 @@
end
def path
return @path if @path
file = @options['path']
+ raise "You must specify a path." unless file
# If path ends with a slash, make it an index
file += "index" if file =~ /\/$/
# if path has no extension, add the default extension