cloudapp 2.0.0.beta.10 → 2.0.0.beta.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/cloudapp +34 -30
- data/cloudapp.gemspec +1 -1
- data/lib/cloudapp/cli/prompt.rb +8 -2
- data/lib/cloudapp.rb +1 -1
- data/man/cloudapp.1 +10 -9
- data/man/cloudapp.1.html +8 -7
- data/man/cloudapp.1.ronn +6 -5
- metadata +4 -1
data/Gemfile.lock
CHANGED
data/bin/cloudapp
CHANGED
@@ -28,6 +28,11 @@ def print_error message
|
|
28
28
|
$stderr.puts
|
29
29
|
end
|
30
30
|
|
31
|
+
def print_link link
|
32
|
+
$stdout.puts link
|
33
|
+
$stderr.puts link unless $stdout.tty?
|
34
|
+
end
|
35
|
+
|
31
36
|
def error message
|
32
37
|
print_error message
|
33
38
|
exit 1
|
@@ -41,22 +46,6 @@ def valid_token?
|
|
41
46
|
!token.nil? and service.root.authorized?
|
42
47
|
end
|
43
48
|
|
44
|
-
def valid_url? url
|
45
|
-
error 'URL missing' if url.nil?
|
46
|
-
error "#{ url } doesn't look like a valid URL" unless url =~ URI.regexp
|
47
|
-
true
|
48
|
-
end
|
49
|
-
|
50
|
-
def valid_file? file
|
51
|
-
error "File doesn't exist" if file.is_a? Errno::ENOENT
|
52
|
-
error 'File missing' if file.nil? or file == STDIN
|
53
|
-
not file.closed?
|
54
|
-
end
|
55
|
-
|
56
|
-
def next_file
|
57
|
-
ARGF.file rescue $!
|
58
|
-
end
|
59
|
-
|
60
49
|
def print_version
|
61
50
|
$stdout.puts CloudApp::VERSION
|
62
51
|
exit
|
@@ -66,6 +55,14 @@ def copy content
|
|
66
55
|
Clipboard.copy content
|
67
56
|
end
|
68
57
|
|
58
|
+
def validate_url url
|
59
|
+
error "#{url} doesn't look like a valid URL" unless url =~ URI.regexp
|
60
|
+
end
|
61
|
+
|
62
|
+
def validate_file path
|
63
|
+
error "#{path.inspect} doesn't exist" unless File.exists? path
|
64
|
+
end
|
65
|
+
|
69
66
|
|
70
67
|
print_version if ARGV.delete('--version') || ARGV.delete('-v')
|
71
68
|
|
@@ -75,32 +72,39 @@ while not valid_token?
|
|
75
72
|
Credentials.save_token token
|
76
73
|
end
|
77
74
|
|
78
|
-
|
79
|
-
copy
|
75
|
+
link_type = ARGV.delete('--direct') || ARGV.delete('-d') ? :embed : :canonical
|
76
|
+
copy = ARGV.delete('--no-copy').nil?
|
80
77
|
|
81
78
|
case ARGV.shift
|
82
79
|
when 'bookmark'
|
83
|
-
|
80
|
+
error 'Missing URL' if ARGV.empty?
|
81
|
+
|
82
|
+
link_type = :canonical # No such thing as an embed link for a bookmark.
|
84
83
|
while url = ARGV.shift
|
85
|
-
|
84
|
+
$stderr.print "Bookmarking #{url}... "
|
85
|
+
validate_url url
|
86
86
|
bookmark = service.bookmark(url)
|
87
87
|
exit 1 unless bookmark
|
88
88
|
|
89
|
-
|
90
|
-
copy
|
91
|
-
|
89
|
+
link = bookmark.link(link_type)
|
90
|
+
copy link if copy
|
91
|
+
print_link link
|
92
92
|
end
|
93
|
+
|
93
94
|
when 'upload'
|
94
|
-
|
95
|
-
|
96
|
-
|
95
|
+
error 'Missing file' if ARGV.empty?
|
96
|
+
|
97
|
+
while path = ARGV.shift
|
98
|
+
$stderr.print "Uploading #{File.basename(path)}... "
|
99
|
+
validate_file path
|
100
|
+
upload = service.upload(path)
|
97
101
|
exit 1 unless upload
|
98
102
|
|
99
|
-
|
100
|
-
copy
|
101
|
-
|
102
|
-
ARGF.skip
|
103
|
+
link = upload.link(link_type)
|
104
|
+
copy link if copy
|
105
|
+
print_link link
|
103
106
|
end
|
107
|
+
|
104
108
|
else
|
105
109
|
$stderr.puts <<EOS
|
106
110
|
Usage:
|
data/cloudapp.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'cloudapp'
|
16
|
-
s.version = '2.0.0.beta.
|
16
|
+
s.version = '2.0.0.beta.11'
|
17
17
|
s.date = '2012-12-29'
|
18
18
|
s.rubyforge_project = 'cloudapp'
|
19
19
|
|
data/lib/cloudapp/cli/prompt.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module CloudApp
|
4
4
|
module CLI
|
5
5
|
class Prompt
|
6
|
+
|
6
7
|
def ask_for_credentials
|
7
8
|
$stderr.puts "Sign into CloudApp."
|
8
9
|
$stderr.print "Email: "
|
@@ -21,8 +22,13 @@ module CloudApp
|
|
21
22
|
return password
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
# This part gratuitously copied from hub.
|
26
|
+
# https://github.com/defunkt/hub/blob/master/lib/hub/github_api.rb#L399-L400
|
27
|
+
NULL = defined?(File::NULL) ? File::NULL :
|
28
|
+
File.exist?('/dev/null') ? '/dev/null' : 'NUL'
|
29
|
+
|
30
|
+
def echo_on() with_tty { system "stty echo 2>#{NULL}" } end
|
31
|
+
def echo_off() with_tty { system "stty -echo 2>#{NULL}" } end
|
26
32
|
def with_tty(&block)
|
27
33
|
return unless $stdin.isatty
|
28
34
|
yield
|
data/lib/cloudapp.rb
CHANGED
data/man/cloudapp.1
CHANGED
@@ -25,7 +25,7 @@ Upload a file or share a bookmark with CloudApp\. The drop\'s share link will be
|
|
25
25
|
Print the drop\'s direct link after creation\. The direct link is suitable for use in places that expect a link to a file like an HTML IMG tag\.
|
26
26
|
.
|
27
27
|
.TP
|
28
|
-
\fB
|
28
|
+
\fB\-\-no\-copy\fR
|
29
29
|
Don\'t copy the new drop\'s link to the system clipboard\.
|
30
30
|
.
|
31
31
|
.SH "EXAMPLE"
|
@@ -59,41 +59,42 @@ http://cl\.ly/ghi789
|
|
59
59
|
.IP "" 0
|
60
60
|
.
|
61
61
|
.P
|
62
|
-
|
62
|
+
Bookmark a URL:
|
63
63
|
.
|
64
64
|
.IP "" 4
|
65
65
|
.
|
66
66
|
.nf
|
67
67
|
|
68
|
-
$ cloudapp
|
68
|
+
$ cloudapp bookmark http://getcloudapp\.com
|
69
|
+
http://cl\.ly/abc123
|
69
70
|
.
|
70
71
|
.fi
|
71
72
|
.
|
72
73
|
.IP "" 0
|
73
74
|
.
|
74
75
|
.P
|
75
|
-
|
76
|
+
Copy the drop\'s direct link:
|
76
77
|
.
|
77
78
|
.IP "" 4
|
78
79
|
.
|
79
80
|
.nf
|
80
81
|
|
81
|
-
$ cloudapp
|
82
|
-
http://cl\.ly/abc123
|
82
|
+
$ cloudapp upload \-\-direct screenshot\.png
|
83
|
+
http://cl\.ly/abc123/screenshot\.png
|
83
84
|
.
|
84
85
|
.fi
|
85
86
|
.
|
86
87
|
.IP "" 0
|
87
88
|
.
|
88
89
|
.P
|
89
|
-
Print the drop\'s
|
90
|
+
Print but don\'t copy the drop\'s link:
|
90
91
|
.
|
91
92
|
.IP "" 4
|
92
93
|
.
|
93
94
|
.nf
|
94
95
|
|
95
|
-
$ cloudapp upload \-\-
|
96
|
-
http://cl\.ly/abc123
|
96
|
+
$ cloudapp upload \-\-no\-copy screenshot\.png
|
97
|
+
http://cl\.ly/abc123
|
97
98
|
.
|
98
99
|
.fi
|
99
100
|
.
|
data/man/cloudapp.1.html
CHANGED
@@ -95,7 +95,7 @@ credentials are stored in <code>~/.netrc</code> as defined by <code>ftp</code>(1
|
|
95
95
|
<dl>
|
96
96
|
<dt><code>-d</code>, <code>--direct</code></dt><dd><p>Print the drop's direct link after creation. The direct link is suitable for
|
97
97
|
use in places that expect a link to a file like an HTML IMG tag.</p></dd>
|
98
|
-
<dt><code
|
98
|
+
<dt><code>--no-copy</code></dt><dd><p>Don't copy the new drop's link to the system clipboard.</p></dd>
|
99
99
|
</dl>
|
100
100
|
|
101
101
|
|
@@ -115,23 +115,24 @@ http://cl.ly/def456
|
|
115
115
|
http://cl.ly/ghi789
|
116
116
|
</code></pre>
|
117
117
|
|
118
|
-
<p>Copy the drop's share link to the clipboard on OS X:</p>
|
119
|
-
|
120
|
-
<pre><code>$ cloudapp upload screenshot.png | pbcopy
|
121
|
-
</code></pre>
|
122
|
-
|
123
118
|
<p>Bookmark a URL:</p>
|
124
119
|
|
125
120
|
<pre><code>$ cloudapp bookmark http://getcloudapp.com
|
126
121
|
http://cl.ly/abc123
|
127
122
|
</code></pre>
|
128
123
|
|
129
|
-
<p>
|
124
|
+
<p>Copy the drop's direct link:</p>
|
130
125
|
|
131
126
|
<pre><code>$ cloudapp upload --direct screenshot.png
|
132
127
|
http://cl.ly/abc123/screenshot.png
|
133
128
|
</code></pre>
|
134
129
|
|
130
|
+
<p>Print but don't copy the drop's link:</p>
|
131
|
+
|
132
|
+
<pre><code>$ cloudapp upload --no-copy screenshot.png
|
133
|
+
http://cl.ly/abc123
|
134
|
+
</code></pre>
|
135
|
+
|
135
136
|
|
136
137
|
<ol class='man-decor man-foot man foot'>
|
137
138
|
<li class='tl'></li>
|
data/man/cloudapp.1.ronn
CHANGED
@@ -37,16 +37,17 @@ Upload several files:
|
|
37
37
|
http://cl.ly/def456
|
38
38
|
http://cl.ly/ghi789
|
39
39
|
|
40
|
-
Copy the drop's share link to the clipboard on OS X:
|
41
|
-
|
42
|
-
$ cloudapp upload screenshot.png | pbcopy
|
43
|
-
|
44
40
|
Bookmark a URL:
|
45
41
|
|
46
42
|
$ cloudapp bookmark http://getcloudapp.com
|
47
43
|
http://cl.ly/abc123
|
48
44
|
|
49
|
-
|
45
|
+
Copy the drop's direct link:
|
50
46
|
|
51
47
|
$ cloudapp upload --direct screenshot.png
|
52
48
|
http://cl.ly/abc123/screenshot.png
|
49
|
+
|
50
|
+
Print but don't copy the drop's link:
|
51
|
+
|
52
|
+
$ cloudapp upload --no-copy screenshot.png
|
53
|
+
http://cl.ly/abc123
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.11
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -187,6 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- - ! '>='
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
hash: -179383608361943794
|
190
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
194
|
none: false
|
192
195
|
requirements:
|