aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Pravosud <rwz@duckroll.ru>2011-08-20 10:24:15 +0700
committerPavel Pravosud <rwz@duckroll.ru>2011-08-20 10:24:15 +0700
commit5ec1f014a0d828fe3d555600b527d7201fbf4d97 (patch)
tree0a962d6bdb026bc3a4c6b85cc63da57d92181023
parent178a198ea7f932307bbe2affeba10240a3168ff3 (diff)
downloadmy_new_personal_website-5ec1f014a0d828fe3d555600b527d7201fbf4d97.tar.xz
my_new_personal_website-5ec1f014a0d828fe3d555600b527d7201fbf4d97.zip
added stringex gem for permalink url generation
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--Rakefile3
3 files changed, 5 insertions, 1 deletions
diff --git a/Gemfile b/Gemfile
index 5bb57ed4..ffb614f2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,3 +10,4 @@ gem 'haml', '>= 3.1'
gem 'compass', '>= 0.11'
gem 'rubypants'
gem 'rb-fsevent'
+gem 'stringex' \ No newline at end of file
diff --git a/Gemfile.lock b/Gemfile.lock
index c9235cb2..55634060 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -40,6 +40,7 @@ GEM
blankslate (>= 2.1.2.3)
ffi (~> 1.0.7)
sass (3.1.5)
+ stringex (1.3.0)
syntax (1.0.0)
PLATFORMS
@@ -56,3 +57,4 @@ DEPENDENCIES
rb-fsevent
rdiscount
rubypants
+ stringex
diff --git a/Rakefile b/Rakefile
index 18b5da95..aa3cbf8a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
require "rubygems"
require "bundler/setup"
+require "stringex"
## -- Rsync Deploy config -- ##
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
@@ -63,7 +64,7 @@ task :new_post, :title do |t, args|
require './plugins/titlecase.rb'
args.with_defaults(:title => 'new-post')
title = args.title
- filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.downcase.gsub(/&/,'and').gsub(/[,'":\?!\(\)\[\]]/,'').gsub(/[\W\.]/, '-').gsub(/-+$/,'')}.#{new_post_ext}"
+ filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
system "mkdir -p #{source_dir}/#{posts_dir}";