From 0cdcde10bfd1605ce16b6dcaee5a71238f868f46 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Thu, 27 Feb 2014 15:00:37 -0500 Subject: [PATCH] Add category to rake new_post --- .gitignore | 3 +-- Gemfile | 8 -------- Rakefile.rb | 2 ++ _layouts/post.html | 12 ++---------- theme-setup.md | 1 + 5 files changed, 6 insertions(+), 20 deletions(-) delete mode 100644 Gemfile diff --git a/.gitignore b/.gitignore index 96f3a496..6ad4fcd8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ _site *.sublime-workspace codekit-config.json node_modules -_asset_bundler_cache -Gemfile.lock \ No newline at end of file +_asset_bundler_cache \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index a1d8edf2..00000000 --- a/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://rubygems.org' - -gem 'jekyll' -gem 'kramdown' -gem 'coderay' -gem 'rake' -gem 'activesupport' -gem 'stringex' \ No newline at end of file diff --git a/Rakefile.rb b/Rakefile.rb index 9afbe533..6a70cb01 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -25,6 +25,7 @@ task :new_post, :title do |t, args| if File.exist?(filename) abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n' end + category = get_stdin("Enter category name to group your post in (leave blank for none): ") tags = get_stdin("Enter tags to classify your post (comma separated): ") puts "Creating new post: #{filename}" open(filename, 'w') do |post| @@ -32,6 +33,7 @@ task :new_post, :title do |t, args| post.puts "layout: post" post.puts "title: \"#{title.gsub(/&/,'&')}\"" post.puts "modified: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}" + post.puts "category: [#{category}]" post.puts "tags: [#{tags}]" post.puts "image:" post.puts " feature: " diff --git a/_layouts/post.html b/_layouts/post.html index 50da834c..1d9df917 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -40,23 +40,15 @@