Sha256: f509a850c32950577f6699b62067717a7550af7433b59b7b4be7f608e5ee64be
Contents?: true
Size: 1.03 KB
Versions: 17
Compression:
Stored size: 1.03 KB
Contents
require "fileutils" txt = "$array = {" Dir.glob("/home/a/democracy/documentation/" + "*").each do |i| doc = File.read i i = File.basename i txt<< <<~A "#{i}" => ["#{i}", "[#{i}] [arguments]", #{doc.strip.dump}], A end; txt<<"}" eval txt def iter(arg) # warn arg FileUtils.mkdir_p("../compilation") name, args = arg.scan(/^def\s+(.+)(\(.*\))\s*$/)[0] args_split = args[1..-2].strip.split(",") invoke_function = if args_split.empty? name else "#{name}(#{["", "ARGV[0]", "ARGV[0], ARGV[1]", "ARGV[0], ARGV[1], ARGV[2]"][args_split.length]})" end File.open("../compilation/#{name}", "w") do |file| file << (File.read("functions.cr")) << text = <<CR def main() if ARGV.size != #{args_split.length} Funcs.argument_data(#{$array[name].to_s[1..-2]}) exit 1 end #{invoke_function} end main CR #abort text #START system "#notify-send #&" end end File.read("functions.cr").each_line.reject do |i| !i.start_with?("def ") end.each do |arg| iter(arg.strip) end
Version data entries
17 entries across 17 versions & 5 rubygems