Browse code

improved new_post title substitutions, fixed directories in rake update tasks

Brandon Mathis authored on 27/07/2011 at 20:39:50
Showing 1 changed files
... ...
@@ -61,7 +61,7 @@ task :new_post, :title do |t, args|
61 61
   require './plugins/titlecase.rb'
62 62
   args.with_defaults(:title => 'new-post')
63 63
   title = args.title
64
-  filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.downcase.gsub(/&/,'and').gsub(/[,\.'":\(\)\[\]]/,'').gsub(/\W/, '-')}.#{new_post_ext}"
64
+  filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.downcase.gsub(/&/,'and').gsub(/[,'":\?!\(\)\[\]]/,'').gsub(/[\W\.]/, '-').gsub(/-+$/,'')}.#{new_post_ext}"
65 65
   puts "Creating new post: #{filename}"
66 66
   open(filename, 'w') do |post|
67 67
     system "mkdir -p #{source_dir}/#{posts_dir}";
... ...
@@ -129,7 +129,7 @@ task :update_style, :theme do |t, args|
129 129
   theme = args.theme || 'classic'
130 130
   system "mv sass sass.old"
131 131
   puts "## Moved styles into sass.old/"
132
-  system "mkdir -p sass; cp -R #{themes_dir}/"+theme+"/sass/ sass/"
132
+  system "mkdir -p sass; cp -R #{themes_dir}/"+theme+"/sass/* sass/"
133 133
   cp_r "sass.old/custom/.", "sass/custom"
134 134
   puts "## Updated Sass ##"
135 135
 end
... ...
@@ -139,7 +139,7 @@ task :update_source, :theme do |t, args|
139 139
   theme = args.theme || 'classic'
140 140
   system "mv #{source_dir} #{source_dir}.old"
141 141
   puts "moved #{source_dir} into #{source_dir}.old/"
142
-  system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}"
142
+  system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/*. #{source_dir}"
143 143
   system "cp -Rn #{source_dir}.old/. #{source_dir}"
144 144
   system "cp -f #{source_dir}.old/_includes/navigation.html #{source_dir}/_includes/navigation.html"
145 145
   puts "## Updated #{source_dir} ##"