imgur2 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -0
- data/lib/imgur2.rb +26 -3
- metadata +50 -29
data/CHANGELOG.rdoc
CHANGED
data/lib/imgur2.rb
CHANGED
@@ -9,17 +9,34 @@ require 'json'
|
|
9
9
|
# client.upload f
|
10
10
|
# }
|
11
11
|
class Imgur2 < Struct.new(:key)
|
12
|
-
VERSION = '1.
|
12
|
+
VERSION = '1.2.0'
|
13
13
|
|
14
14
|
def self.run argv
|
15
15
|
client = Imgur2.new '65aea9a07b4f6110c90248ffa247d41a'
|
16
|
-
fh =
|
16
|
+
fh = get_image argv[0]
|
17
17
|
link = client.upload(fh)['upload']['links']['original']
|
18
18
|
link = client.follow_redirect link
|
19
19
|
client.paste link
|
20
20
|
puts link
|
21
21
|
ensure
|
22
|
-
fh.close
|
22
|
+
fh.close if fh
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.get_image filename = nil
|
26
|
+
return open(filename, 'rb') if filename
|
27
|
+
begin
|
28
|
+
require 'pasteboard'
|
29
|
+
require 'stringio'
|
30
|
+
|
31
|
+
clipboard = Pasteboard.new
|
32
|
+
|
33
|
+
data = clipboard[0, Pasteboard::Type::JPEG]
|
34
|
+
|
35
|
+
return StringIO.new data if data
|
36
|
+
rescue LoadError
|
37
|
+
end
|
38
|
+
|
39
|
+
$stdin
|
23
40
|
end
|
24
41
|
|
25
42
|
def upload io
|
@@ -59,6 +76,12 @@ class Imgur2 < Struct.new(:key)
|
|
59
76
|
# clipboard.
|
60
77
|
|
61
78
|
def paste link
|
79
|
+
require 'pasteboard'
|
80
|
+
|
81
|
+
clipboard = Pasteboard.new
|
82
|
+
|
83
|
+
clipboard.put_url link
|
84
|
+
rescue LoadError
|
62
85
|
clipboard = %w{
|
63
86
|
/usr/bin/pbcopy
|
64
87
|
/usr/bin/xclip
|
metadata
CHANGED
@@ -1,39 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgur2
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Aaron Patterson
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2011-03-28 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: hoe
|
17
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
25
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 41
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 9
|
33
|
+
- 1
|
22
34
|
version: 2.9.1
|
23
35
|
type: :development
|
24
|
-
|
25
|
-
version_requirements: *2160778600
|
36
|
+
version_requirements: *id001
|
26
37
|
description: Upload stuff to imgur. Yay.
|
27
|
-
email:
|
38
|
+
email:
|
28
39
|
- aaron@tenderlovemaking.com
|
29
|
-
executables:
|
40
|
+
executables:
|
30
41
|
- imgur2
|
31
42
|
extensions: []
|
32
|
-
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
33
45
|
- Manifest.txt
|
34
46
|
- CHANGELOG.rdoc
|
35
47
|
- README.rdoc
|
36
|
-
files:
|
48
|
+
files:
|
37
49
|
- .autotest
|
38
50
|
- CHANGELOG.rdoc
|
39
51
|
- Manifest.txt
|
@@ -44,28 +56,37 @@ files:
|
|
44
56
|
has_rdoc: true
|
45
57
|
homepage: http://github.com/tenderlove/imgur2
|
46
58
|
licenses: []
|
59
|
+
|
47
60
|
post_install_message:
|
48
|
-
rdoc_options:
|
61
|
+
rdoc_options:
|
49
62
|
- --main
|
50
63
|
- README.rdoc
|
51
|
-
require_paths:
|
64
|
+
require_paths:
|
52
65
|
- lib
|
53
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
67
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
76
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
65
84
|
requirements: []
|
85
|
+
|
66
86
|
rubyforge_project: imgur2
|
67
87
|
rubygems_version: 1.6.1
|
68
88
|
signing_key:
|
69
89
|
specification_version: 3
|
70
90
|
summary: Upload stuff to imgur
|
71
91
|
test_files: []
|
92
|
+
|