Created
August 22, 2011 16:00
-
-
Save brianstorti/1162756 to your computer and use it in GitHub Desktop.
Generate monkey code
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 'spreadsheet' | |
TEMPLATE = "template.xls" | |
LOCAL_FILE_NAME = "generated.txt" | |
Spreadsheet.client_encoding = 'UTF-8' | |
def inspect_sheet sheet | |
File.open(LOCAL_FILE_NAME, 'w') {|f| | |
sheet.each do |row| | |
if true | |
type = "TextVariableField" | |
end | |
line = "lineLayout.addField(new #{type}('IDC-REG', #{row[2]}));" | |
f.puts(line) | |
end | |
} | |
end | |
template = Spreadsheet.open TEMPLATE | |
sheet = template.worksheet 0 | |
inspect_sheet(sheet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment