-
-
Save clauswitt/1574298 to your computer and use it in GitHub Desktop.
Revisions
-
clauswitt revised this gist
Jan 7, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # Script to create a jekyll blog post using a template and open it in textmate. It takes one input parameter # which is the title of the blog post # e.g. command: # $ ./new.rb "helper script to create new posts using jekyll" -
clauswitt revised this gist
Jan 7, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,4 +29,4 @@ new_post_file.puts new_post new_post_file.close puts `mate #{filepath}` -
clauswitt revised this gist
Jan 7, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,9 +6,11 @@ # $ ./new.rb "helper script to create new posts using jekyll" # # Author:Khaja Minhajuddin (http://minhajuddin.com) # Minor tweaks by Claus Witt (http://www.clauswitt.com) # Some constants TEMPLATE = "_template.markdown" TARGET_DIR = "_posts" # Get the title which was passed as an argument -
minhajuddin created this gist
Sep 30, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/usr/bin/env ruby # Script to create a jekyll blog post using a template. It takes one input parameter # which is the title of the blog post # e.g. command: # $ ./new.rb "helper script to create new posts using jekyll" # # Author:Khaja Minhajuddin (http://minhajuddin.com) # Some constants TEMPLATE = "template.markdown" TARGET_DIR = "_posts" # Get the title which was passed as an argument title = ARGV[0] # Get the filename filename = title.gsub(' ','-') filename = "#{ Time.now.strftime('%Y-%m-%d') }-#{filename}.markdown" filepath = File.join(TARGET_DIR, filename) # Create a copy of the template with the title replaced new_post = File.read(TEMPLATE) new_post.gsub!('TITLE', title); # Write out the file to the target directory new_post_file = File.open(filepath, 'w') new_post_file.puts new_post new_post_file.close puts "created => #{filepath}"