Customer: Orangutan-Roasters Project: Burundai Tasting Author: Cody Bunch Date: 2017-04-17 categories:
Some background here
Some background here
require 'fileutils' | |
task :note do | |
customer = ENV['customer'] || 'internal' | |
project = ENV['project'] || 'stuff' | |
author = ENV['author'] || 'Cody Bunch' | |
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d') | |
filename = File.join('.', "#{Time.now.strftime('%Y-%m-%d')}-#{customer.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}-#{project.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.md") | |
open(filename, 'w') do |post| | |
post.puts "Customer: #{customer}" | |
post.puts "Project: #{project}" | |
post.puts "Author: #{author}" | |
post.puts "Date: #{Time.now.strftime('%Y-%m-%d')}" | |
post.puts "categories: " | |
post.puts "---" | |
post.puts " " | |
post.puts "\# #{customer}" | |
post.puts "\nSome background here\n" | |
post.puts "\# #{project}" | |
post.puts "\nSome background here\n" | |
post.puts "\# Notes:" | |
end | |
end |
bunchc ~/projects/case-notes | |
$ cat Rakefile | |
require 'fileutils' | |
task :note do | |
customer = ENV['customer'] || '' | |
project = ENV['project'] || 'stuff' | |
author = ENV['author'] || '' | |
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d') | |
filename = File.join('.', "#{Time.now.strftime('%Y-%m-%d')}-#{customer.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}-#{project.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.md") | |
open(filename, 'w') do |post| | |
post.puts "Customer: #{customer}" | |
post.puts "Project: #{project}" | |
post.puts "Author: #{author}" | |
post.puts "Date: #{Time.now.strftime('%Y-%m-%d')}" | |
post.puts "categories: " | |
post.puts "---" | |
post.puts " " | |
post.puts "\# #{customer}" | |
post.puts "\nSome background here\n" | |
post.puts "\# #{project}" | |
post.puts "\nSome background here\n" | |
post.puts "\# Notes:" | |
end | |
end | |
bunchc ~/projects/case-notes | |
$ rake note customer=Orangutan-Roasters project="Burundai Tasting" | |
bunchc ~/projects/case-notes | |
$ subl 2017-04-17-Orangutan-Roasters-Burundai-Tasting.md |