mirror of https://github.com/subgraph/fw-daemon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
388 B
20 lines
388 B
#!/usr/bin/env ruby
|
|
|
|
def gen_go_file
|
|
binary_definition = File.binread("gschemas.compiled")
|
|
hex = binary_definition.each_byte.map { |b| "%02x" % b }.join
|
|
|
|
File.open("schemas.go", "w") do |f|
|
|
sliced = hex.chars.each_slice(80).map{ |s| s.join }.join "\"+\n\t\""
|
|
|
|
f.puts <<TEMPLATE
|
|
package definitions
|
|
|
|
const schemaDefinition = ""+
|
|
\t"#{sliced}"
|
|
TEMPLATE
|
|
end
|
|
end
|
|
|
|
gen_go_file
|