Skip to content

Instantly share code, notes, and snippets.

@yrgoldteeth
Created May 11, 2010 14:25
Show Gist options
  • Save yrgoldteeth/397368 to your computer and use it in GitHub Desktop.
Save yrgoldteeth/397368 to your computer and use it in GitHub Desktop.
Adds a string to a csv file with category fed from a bash function that wraps git commit -m
require 'rubygems'
require 'active_support'
require 'ruby-debug'
class WorkorderCreator
attr_accessor :category, :message, :data_file
def initialize(args=[])
@data_file = File.join("/home/ndfine/code/misc/work_order", "#{Time.now.strftime('%Y_%m_%d')}_work_orders.csv")
@category = args.last
raise 'no category, fool' unless @category.present?
@message = args.first
File.open(@data_file, 'a') {|file| file.puts "#{@category},#{@message}"}
puts "Added #{@message} to #{@category}"
end
end
WorkorderCreator.new(ARGV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment