Created
May 11, 2010 14:25
-
-
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
This file contains 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 characters
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