Sha256: 594e418858a0bca3e8ebc062a5cd6ad8db469f609191fc4d59920d7bc3342004
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 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
5 entries across 5 versions & 5 rubygems
Version | Path |
---|---|
politics-1.0.82 | ./src/src/code |
freespeech-1.0.82 | ./src/src/code |
elonmusk-1.0.82 | ./src/src/code |
ufos-1.0.82 | ./src/src/code |
aliens-1.0.82 | ./src/src/code |