lib/lignite/ev3_tool.rb in lignite-0.5.0 vs lib/lignite/ev3_tool.rb in lignite-0.6.0

- old
+ new

@@ -30,18 +30,19 @@ end desc "download BRICK_FILENAME [LOCAL_FILENAME]", "download a file" map "dl" => "download" def download(brick_filename, local_filename = nil) + chunk_size = 1000 # 2000 stalls, 4096 goes out of sync in our code local_filename ||= File.basename(brick_filename) - fsize, handle, data = sc.begin_upload(4096, brick_filename) + fsize, handle, data = sc.begin_upload(chunk_size, brick_filename) File.open(local_filename, "w") do |f| loop do f.write(data) fsize -= data.bytesize break if fsize.zero? - handle, data = sc.continue_upload(handle, 4096) + handle, data = sc.continue_upload(handle, chunk_size) end end end desc "list-files DIRNAME", "list DIRNAME in a long format" @@ -51,9 +52,15 @@ end desc "ls DIRNAME", "list DIRNAME in a short format" def ls(name) puts raw_ls(name) + end + + desc "asm RUBYFILE RBFFILE", "assemble RUBYFILE to RBFFILE" + def asm(ruby_fn, rbf_fn) + a = Assembler.new + a.assemble(ruby_fn, rbf_fn) end no_commands do def raw_list_files(name) name ||= EV3TOOL_HOME