lib/vimgolf/cli.rb in vimgolf-0.1.2 vs lib/vimgolf/cli.rb in vimgolf-0.1.3

- old
+ new

@@ -61,15 +61,17 @@ begin type = download(id) # - n - no swap file, memory only editing + # - +0 - always start on line 0 # - --noplugin - don't load any plugins, lets be fair! - # -u NONE and -U none - don't load .vimrc or .gvimrc # -i NONE - don't load .viminfo (for saved macros and the like) - # - +0 - always start on line 0 - system("vim -n --noplugin -i NONE +0 -W #{log(id)} #{input(id, type)}") + # - u - load vimgolf .vimrc to level the playing field + vimcmd = "vim -n --noplugin -i NONE +0 -u #{vimrc(id)} -W #{log(id)} #{input(id, type)}" + debug(vimcmd) + system(vimcmd) if $?.exitstatus.zero? diff = `diff --strip-trailing-cr #{input(id, type)} #{output(id)}` if diff.size > 0 @@ -127,10 +129,11 @@ raise "Bad Version" end File.open(Config.put_path + "/#{id}.#{data['in']['type']}", "w") {|f| f.puts data['in']['data']} File.open(Config.put_path + "/#{id}.output", "w") {|f| f.puts data['out']['data']} + File.open(Config.put_path + "/#{id}.golfrc", "w") {|f| f.puts data['vimrc']} data['in']['type'] rescue Exception => e debug(e) @@ -158,10 +161,11 @@ end private def input(id, type); challenge(id) + ".#{type}"; end def output(id); challenge(id) + ".output"; end - def log(id); challenge(id) + ".log"; end + def log(id); challenge(id) + ".log"; end + def vimrc(id); challenge(id) + ".golfrc"; end def challenge(id) Config.put_path + "/#{id}" end \ No newline at end of file