imgurr 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +3 -3
- data/README.md +10 -6
- data/imgurr.gemspec +1 -1
- data/lib/imgurr/command.rb +29 -1
- data/lib/imgurr/platform.rb +18 -4
- metadata +16 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6777d3dbff2111a8da2b309dfbd7d6770b35858
|
4
|
+
data.tar.gz: 8235aa8f016c17665b6fb882372d839852588538
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7808e86a9294e2e3310081dbbe6d77ce0a20b8eeb2ba7f6cc7ece4acc86597134b86cab93bb0a333d4e95bdeb24ca653cd4d2f9bf8fc9366c959fcf60bf2b195
|
7
|
+
data.tar.gz: 326758a27bb0a30130cbb11c106956456abea1c6da9daf1788f347a0e9285f1afa78fe2b55e06982500052ecd40cd306d596f30d5f8a9713a630ae7197f5f9b2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,15 +4,19 @@ Command line utility for Imgur in Ruby. Imgurr lets you quickly upload images, g
|
|
4
4
|
|
5
5
|
## Install
|
6
6
|
gem install imgurr
|
7
|
-
|
7
|
+
|
8
8
|
## Usage
|
9
9
|
|
10
|
-
![](http://i.imgur.com/
|
10
|
+
![](http://i.imgur.com/rGoGCNb.png)
|
11
|
+
#### Examples
|
12
|
+
$ imgurr capture
|
13
|
+
Uploading screenshot...
|
14
|
+
Copied http://i.imgur.com/rGoGCNb.png to clipboard
|
11
15
|
|
12
|
-
imgurr upload image.jpg
|
16
|
+
$ imgurr upload image.jpg
|
13
17
|
Copied http://i.imgur.com/PLWGJlc.gif to clipboard
|
14
18
|
|
15
|
-
imgurr upload image.jpg --markdown
|
19
|
+
$ imgurr upload image.jpg --markdown
|
16
20
|
Copied ![Screenshot](http://i.imgur.com/PLWGJlc.gif) to clipboard
|
17
21
|
|
18
22
|
imgurr info 2KxrTAK
|
@@ -26,7 +30,7 @@ Command line utility for Imgur in Ruby. Imgurr lets you quickly upload images, g
|
|
26
30
|
Height : 540 px
|
27
31
|
Link : http://i.imgur.com/2KxrTAK.jpg
|
28
32
|
|
29
|
-
imgurr delete http://i.imgur.com/2KxrTAK.jpg
|
33
|
+
$ imgurr delete http://i.imgur.com/2KxrTAK.jpg
|
30
34
|
Successfully deleted image from Imgur
|
31
35
|
|
32
36
|
./imgurr --help for more.
|
@@ -43,4 +47,4 @@ Imgurr stores the delete hash generated by Imgur locally when uploading an image
|
|
43
47
|
4. Push to the branch (`git push origin my-new-feature`)
|
44
48
|
5. Create new Pull Request
|
45
49
|
|
46
|
-
Don't forget to add a test for any new feature.
|
50
|
+
Don't forget to add a test for any new feature.
|
data/imgurr.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'imgurr'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.summary = "Imgurr lets you upload images to imgur from the command line"
|
5
5
|
s.description = "Imgurr is a ruby gem that lets you upload images to Imgur and manage your account"
|
6
6
|
s.authors = ["Christophe Naud-Dulude"]
|
data/lib/imgurr/command.rb
CHANGED
@@ -96,11 +96,12 @@ module Imgurr
|
|
96
96
|
def delegate(command, major, minor)
|
97
97
|
return help unless command
|
98
98
|
return no_internet unless self.internet_connection?
|
99
|
+
return capture if command == 'capture' || command == 'cap'
|
99
100
|
|
100
|
-
# Get image ID from URL
|
101
101
|
if major
|
102
102
|
return upload(major) if command == 'upload' || command == 'up' || command == 'u'
|
103
103
|
|
104
|
+
# Get image ID from URL
|
104
105
|
if major =~ /.*imgur\.com\/[a-zA-Z0-9]*\.[a-zA-Z]*/
|
105
106
|
major = /com\/[a-zA-Z0-9]*/.match(major).to_s.gsub('com/','')
|
106
107
|
end
|
@@ -133,6 +134,32 @@ module Imgurr
|
|
133
134
|
storage.save
|
134
135
|
end
|
135
136
|
|
137
|
+
# Public: Capture and image and upload to imgur
|
138
|
+
#
|
139
|
+
# Note: Only supported on OS X for now
|
140
|
+
# Returns nothing
|
141
|
+
def capture
|
142
|
+
unless Platform.darwin?
|
143
|
+
puts "Capture command is only supported on OS X for the time being."
|
144
|
+
return
|
145
|
+
end
|
146
|
+
|
147
|
+
image_path = "#{ENV['HOME']}/.imgurr.temp.png"
|
148
|
+
Platform.capture('-W', image_path)
|
149
|
+
|
150
|
+
# User might have canceled or it takes some time to write to disk.
|
151
|
+
# Check up to 3 times with 1 sec delay
|
152
|
+
3.times do
|
153
|
+
if File.exist?(image_path)
|
154
|
+
puts "Uploading screenshot..."
|
155
|
+
upload(image_path)
|
156
|
+
File.delete(image_path)
|
157
|
+
break
|
158
|
+
end
|
159
|
+
sleep(1)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
136
163
|
# Public: build HTML image tag response
|
137
164
|
#
|
138
165
|
# Returns a properly formatted HTML <img> tag
|
@@ -231,6 +258,7 @@ module Imgurr
|
|
231
258
|
[--size=SIZE] Set image size ratio
|
232
259
|
[--tile="Title"] Set image title
|
233
260
|
[--desc="Desc" ] Set image description
|
261
|
+
imgurr capture Capture a screenshot and upload it (OS X only)
|
234
262
|
imgurr info <id> Print image information
|
235
263
|
imgurr delete <id> Deletes an image from imgur if the deletehash is found locally
|
236
264
|
imgurr delete <id> <deletehash> Deletes an image from imgur with the provided deletehash
|
data/lib/imgurr/platform.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# clipboard, pasteboard, or whatever they decide to call it.
|
9
9
|
#
|
10
10
|
# Source: https://github.com/holman/boom
|
11
|
-
#
|
11
|
+
#
|
12
12
|
module Imgurr
|
13
13
|
class Platform
|
14
14
|
class << self
|
@@ -37,7 +37,7 @@ module Imgurr
|
|
37
37
|
def open_command
|
38
38
|
if darwin?
|
39
39
|
'open'
|
40
|
-
elsif windows?
|
40
|
+
elsif windows?
|
41
41
|
'start'
|
42
42
|
else
|
43
43
|
'xdg-open'
|
@@ -69,7 +69,7 @@ module Imgurr
|
|
69
69
|
'xclip -selection clipboard'
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
# Public: copies a given URL value to the clipboard. This method is
|
74
74
|
# designed to handle multiple platforms.
|
75
75
|
#
|
@@ -79,6 +79,20 @@ module Imgurr
|
|
79
79
|
url
|
80
80
|
end
|
81
81
|
|
82
|
+
# Public: returns the command used to capture a screenshot
|
83
|
+
#
|
84
|
+
def capture_command
|
85
|
+
if darwin?
|
86
|
+
'screencapture'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Public: captures a screenshot and saves to `output`
|
91
|
+
#
|
92
|
+
def capture(args, output)
|
93
|
+
system("#{capture_command} #{args} #{output}")
|
94
|
+
end
|
95
|
+
|
82
96
|
# Public: opens the JSON file in an editor for you to edit. Uses the
|
83
97
|
# $EDITOR environment variable, or %EDITOR% on Windows for editing.
|
84
98
|
# This method is designed to handle multiple platforms.
|
@@ -100,4 +114,4 @@ module Imgurr
|
|
100
114
|
end
|
101
115
|
end
|
102
116
|
end
|
103
|
-
end
|
117
|
+
end
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgurr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Christophe Naud-Dulude
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: json
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.9.2
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.9.2
|
46
41
|
description: Imgurr is a ruby gem that lets you upload images to Imgur and manage
|
@@ -53,13 +48,14 @@ extra_rdoc_files:
|
|
53
48
|
- README.md
|
54
49
|
- LICENSE.md
|
55
50
|
files:
|
56
|
-
- README.md
|
57
|
-
- LICENSE.md
|
58
51
|
- Gemfile
|
59
52
|
- Gemfile.lock
|
60
|
-
-
|
53
|
+
- LICENSE.md
|
54
|
+
- README.md
|
61
55
|
- Rakefile
|
62
56
|
- bin/imgurr
|
57
|
+
- imgurr.gemspec
|
58
|
+
- lib/imgurr.rb
|
63
59
|
- lib/imgurr/color.rb
|
64
60
|
- lib/imgurr/command.rb
|
65
61
|
- lib/imgurr/imgurAPI.rb
|
@@ -67,7 +63,6 @@ files:
|
|
67
63
|
- lib/imgurr/numbers.rb
|
68
64
|
- lib/imgurr/platform.rb
|
69
65
|
- lib/imgurr/storage.rb
|
70
|
-
- lib/imgurr.rb
|
71
66
|
- test/1-upload.sh
|
72
67
|
- test/2-info.sh
|
73
68
|
- test/3-delete.sh
|
@@ -81,27 +76,26 @@ files:
|
|
81
76
|
homepage: https://github.com/Chris911/imgurr
|
82
77
|
licenses:
|
83
78
|
- MIT
|
79
|
+
metadata: {}
|
84
80
|
post_install_message:
|
85
81
|
rdoc_options:
|
86
|
-
- --charset=UTF-8
|
82
|
+
- "--charset=UTF-8"
|
87
83
|
require_paths:
|
88
84
|
- lib
|
89
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
86
|
requirements:
|
92
|
-
- -
|
87
|
+
- - ">="
|
93
88
|
- !ruby/object:Gem::Version
|
94
89
|
version: '0'
|
95
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
91
|
requirements:
|
98
|
-
- -
|
92
|
+
- - ">="
|
99
93
|
- !ruby/object:Gem::Version
|
100
94
|
version: '0'
|
101
95
|
requirements: []
|
102
96
|
rubyforge_project:
|
103
|
-
rubygems_version:
|
97
|
+
rubygems_version: 2.4.1
|
104
98
|
signing_key:
|
105
|
-
specification_version:
|
99
|
+
specification_version: 4
|
106
100
|
summary: Imgurr lets you upload images to imgur from the command line
|
107
101
|
test_files: []
|