lib/spout/tasks/engine.rake in spout-0.6.0.beta5 vs lib/spout/tasks/engine.rake in spout-0.6.0.beta6
- old
+ new
@@ -137,11 +137,11 @@
def load_json(column)
file = Dir.glob("variables/**/#{column}.json").first
@file_name_test = (file != nil)
@json = JSON.parse(File.read(file)) rescue @json = {}
- @json_id_test = (@json['id'].downcase == column)
+ @json_id_test = (@json['id'].to_s.downcase == column)
end
def load_valid_values
valid_values = []
if @json['type'] == 'choices'
@@ -261,11 +261,11 @@
hash['calculation'] = calculation if calculation != ''
labels = row.delete('labels').to_s.split(';')
hash['labels'] = labels if labels.size > 0
hash['other'] = row unless row.empty?
- file_name = File.join(folder, id.downcase + '.json')
+ file_name = File.join(folder, id.to_s.downcase + '.json')
File.open(file_name, 'w') do |file|
file.write(JSON.pretty_generate(hash) + "\n")
end
puts " create".colorize( :green ) + " #{file_name}"
end
@@ -306,10 +306,10 @@
domains.each do |domain_name, domain_hash|
folder = domain_hash["folder"]
FileUtils.mkpath folder
- file_name = File.join(folder, domain_name.downcase + '.json')
+ file_name = File.join(folder, domain_name.to_s.downcase + '.json')
File.open(file_name, 'w') do |file|
file.write(JSON.pretty_generate(domain_hash["options"]) + "\n")
end
puts " create".colorize( :green ) + " #{file_name}"