Browse files

Moved posts

  • Loading branch information...
1 parent ba74d8c commit 91c03e86986aa6be5ddaac26a088c1179f0adb0d @xerial committed Jul 5, 2012
View
5 Rakefile
@@ -45,7 +45,7 @@ desc "Begin a new post in #{CONFIG['posts']}"
task :post do
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
title = ENV["title"] || "new-post"
- slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
+ slug = title.downcase.strip.gsub(' ', '-').gsub(/[^A-Za-z0-9_-]/, '')
tag = ENV['tag']
if tag == nil
puts "A tag must be specified: rake post tag=\"...\" title=\"...\""
@@ -58,7 +58,8 @@ task :post do
puts "Error - date format must be YYYY-MM-DD, please check you typed it correctly!"
exit -1
end
- filename = File.join(CONFIG['posts'], "#{tag}/#{date}-#{slug}.#{CONFIG['post_ext']}")
+ tagfolder = tag.downcase
+ filename = File.join(CONFIG['posts'], "#{tagfolder}/#{date}-#{slug}.#{CONFIG['post_ext']}")
Dir.mkdir(File.dirname(filename)) if !File.exist?(File.dirname(filename))
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
View
0 _posts/2012-07-03-interval-sweep.md → ...s/algorithms/2012-07-03-interval-sweep.md
File renamed without changes.
View
0 _posts/2012-07-03-union-find.md → _posts/algorithms/2012-07-03-union-find.md
File renamed without changes.
View
0 _posts/2012-06-29-enumeration.md → _posts/antipattern/2012-06-29-enumeration.md
File renamed without changes.
View
0 _posts/2012-06-30-class.md → _posts/class/2012-06-30-class.md
File renamed without changes.
View
0 _posts/2012-07-03-permutations.md → ...ts/collections/2012-07-03-permutations.md
File renamed without changes.
View
0 _posts/2012-06-28-scalatest.md → _posts/debug/2012-06-28-scalatest.md
File renamed without changes.
View
0 _posts/2012-07-03-repl.md → _posts/debug/2012-07-03-repl.md
File renamed without changes.
View
0 _posts/2012-06-27-loan-pattern.md → .../designpattern/2012-06-27-loan-pattern.md
File renamed without changes.
View
0 _posts/2012-07-02-advantages-of-scala.md → ...duction/2012-07-02-advantages-of-scala.md
File renamed without changes.
View
0 _posts/2012-07-02-functional-programming.md → ...tion/2012-07-02-functional-programming.md
File renamed without changes.
View
0 _posts/2012-06-28-reading-files.md → _posts/io/2012-06-28-reading-files.md
File renamed without changes.
View
0 _posts/2012-06-28-grammar.md → _posts/references/2012-06-28-grammar.md
File renamed without changes.
View
0 _posts/2012-06-28-scala-references.md → ...references/2012-06-28-scala-references.md
File renamed without changes.
View
0 _posts/2012-06-27-scala-quick-start.md → _posts/setup/2012-06-27-scala-quick-start.md
File renamed without changes.
View
0 _posts/2012-06-28-create-a-scala-project.md → ...etup/2012-06-28-create-a-scala-project.md
File renamed without changes.
View
0 ...s/2012-07-03-install-scala-in-mac-os-x.md → ...p/2012-07-03-install-scala-in-mac-os-x.md
File renamed without changes.

0 comments on commit 91c03e8

Please sign in to comment.