gyazo 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gyazo might be problematic. Click here for more details.
- data/lib/gyazo.rb +14 -2
- metadata +5 -5
data/lib/gyazo.rb
CHANGED
@@ -5,7 +5,7 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
5
5
|
require 'net/http'
|
6
6
|
|
7
7
|
class Gyazo
|
8
|
-
VERSION = '0.0
|
8
|
+
VERSION = '0.1.0'
|
9
9
|
|
10
10
|
def initialize(app = '/Applications/Gyazo.app')
|
11
11
|
@user = IO.popen("whoami", "r+").gets.chomp
|
@@ -20,7 +20,7 @@ class Gyazo
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def upload(imagefile)
|
23
|
+
def upload(imagefile,time=nil)
|
24
24
|
tmpfile = "/tmp/image_upload#{$$}.png"
|
25
25
|
if imagefile && File.exist?(imagefile) then
|
26
26
|
system "sips -s format png \"#{imagefile}\" --out \"#{tmpfile}\" > /dev/null"
|
@@ -43,6 +43,18 @@ content-disposition: form-data; name="imagedata"; filename="gyazo.com"\r
|
|
43
43
|
#{imagedata}\r
|
44
44
|
--#{boundary}--\r
|
45
45
|
EOF
|
46
|
+
|
47
|
+
if time && time.class == Time then
|
48
|
+
@timestr = time.gmtime.strftime("%Y-%m-%d %H:%M:%S")
|
49
|
+
s = <<EOF
|
50
|
+
--#{boundary}\r
|
51
|
+
content-disposition: form-data; name="date"\r
|
52
|
+
\r
|
53
|
+
#{@timestr}\r
|
54
|
+
EOF
|
55
|
+
data = s + data
|
56
|
+
end
|
57
|
+
|
46
58
|
header ={
|
47
59
|
'Content-Length' => data.length.to_s,
|
48
60
|
'Content-type' => "multipart/form-data; boundary=#{boundary}",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyazo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.5
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Toshiyuki Masui
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-02-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rdoc
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements: []
|
119
119
|
|
120
120
|
rubyforge_project: gyazo
|
121
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.8.23
|
122
122
|
signing_key:
|
123
123
|
specification_version: 3
|
124
124
|
summary: "* Upload an image to Gyazo.com"
|