Skip to content

Commit e99a5ed

Browse files
author
Charlie Somerville
committed
upload screenshot to cubeupload
1 parent 5d1521a commit e99a5ed

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.travis.rb

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# coding: BINARY
33
require "socket"
44
require "timeout"
5+
require "json"
56

67
QEMU = ENV["QEMU"] || "qemu-system-i386"
78
IMG = ENV["IMG"] || "floppy.img"
@@ -30,6 +31,18 @@
3031
abort "screen.ppm does not exist!"
3132
end
3233

34+
if system "convert screen.ppm screen.png"
35+
begin
36+
Timeout.timeout(5) do
37+
response = `curl -X POST -F name=screen.png -F 'fileinput[0][email protected]' http://cubeupload.com/upload_json.php`
38+
filename = JSON.parse(response)["file_name"]
39+
$stderr.puts "Screenshot available at: http://i.cubeupload.com/#{filename}"
40+
end
41+
rescue Timeout::Error
42+
$stderr.puts "could not upload screenshot to cubeupload"
43+
end
44+
end
45+
3346
magic, coords, channel_depth, data = File.read("screen.ppm").force_encoding("BINARY").split("\n", 4)
3447

3548
unless magic == "P6"

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ before_install:
22
- yes | sudo add-apt-repository ppa:hansjorg/rust
33
- sudo apt-get update
44
install:
5-
- sudo apt-get install rust-nightly nasm qemu
5+
- sudo apt-get install rust-nightly nasm qemu imagemagick
66
script:
77
- sed -i 's/i386-elf-ld/ld/' Makefile
88
- make

0 commit comments

Comments
 (0)