cloudapp 2.0.0.beta.9 → 2.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudapp (2.0.0.beta.9)
4
+ cloudapp (2.0.0.beta.10)
5
+ clipboard (~> 1.0.1)
5
6
  leadlight (~> 0.1.0)
6
7
  mime-types (~> 1.19)
7
8
  netrc (~> 0.7.7)
@@ -11,6 +12,7 @@ GEM
11
12
  remote: http://rubygems.org/
12
13
  specs:
13
14
  addressable (2.2.8)
15
+ clipboard (1.0.1)
14
16
  diff-lcs (1.1.3)
15
17
  fail-fast (1.0.0)
16
18
  faraday (0.8.1)
data/bin/cloudapp CHANGED
@@ -4,6 +4,7 @@ require 'cloudapp'
4
4
  require 'cloudapp/credentials'
5
5
  require 'cloudapp/cli/prompt'
6
6
  require 'cloudapp/service'
7
+ require 'clipboard'
7
8
 
8
9
  def service
9
10
  CloudApp::Service.using_token(token)
@@ -17,12 +18,21 @@ end
17
18
 
18
19
  def service_error_handler representation
19
20
  if representation.collection.error
20
- puts
21
- puts "! #{representation.collection.error.message}"
22
- puts
21
+ print_error representation.collection.error.message
23
22
  end
24
23
  end
25
24
 
25
+ def print_error message
26
+ $stderr.puts
27
+ $stderr.puts "! #{message}"
28
+ $stderr.puts
29
+ end
30
+
31
+ def error message
32
+ print_error message
33
+ exit 1
34
+ end
35
+
26
36
  def token
27
37
  Credentials.token
28
38
  end
@@ -31,11 +41,6 @@ def valid_token?
31
41
  !token.nil? and service.root.authorized?
32
42
  end
33
43
 
34
- def error error
35
- puts "ERROR: #{error}"
36
- exit 9
37
- end
38
-
39
44
  def valid_url? url
40
45
  error 'URL missing' if url.nil?
41
46
  error "#{ url } doesn't look like a valid URL" unless url =~ URI.regexp
@@ -53,10 +58,14 @@ def next_file
53
58
  end
54
59
 
55
60
  def print_version
56
- puts CloudApp::VERSION
61
+ $stdout.puts CloudApp::VERSION
57
62
  exit
58
63
  end
59
64
 
65
+ def copy content
66
+ Clipboard.copy content
67
+ end
68
+
60
69
 
61
70
  print_version if ARGV.delete('--version') || ARGV.delete('-v')
62
71
 
@@ -67,6 +76,7 @@ while not valid_token?
67
76
  end
68
77
 
69
78
  link = ARGV.delete('--direct') || ARGV.delete('-d') ? :embed : :canonical
79
+ copy = ARGV.delete('--no-copy').nil?
70
80
 
71
81
  case ARGV.shift
72
82
  when 'bookmark'
@@ -74,17 +84,25 @@ when 'bookmark'
74
84
  while url = ARGV.shift
75
85
  break unless valid_url? url
76
86
  bookmark = service.bookmark(url)
77
- puts bookmark.link(link)
87
+ exit 1 unless bookmark
88
+
89
+ url = bookmark.link(link)
90
+ copy url if copy
91
+ $stdout.puts url
78
92
  end
79
93
  when 'upload'
80
94
  while file = next_file
81
95
  break unless valid_file? file
82
96
  upload = service.upload(file)
83
- puts upload.link(link) if upload
97
+ exit 1 unless upload
98
+
99
+ url = upload.link(link)
100
+ copy url if copy
101
+ $stdout.puts url
84
102
  ARGF.skip
85
103
  end
86
104
  else
87
- puts <<EOS
105
+ $stderr.puts <<EOS
88
106
  Usage:
89
107
  cloudapp bookmark http://getcloudapp.com
90
108
  cloudapp upload screenshot.png
data/cloudapp.gemspec CHANGED
@@ -13,8 +13,8 @@ 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.9'
17
- s.date = '2012-12-28'
16
+ s.version = '2.0.0.beta.10'
17
+ s.date = '2012-12-29'
18
18
  s.rubyforge_project = 'cloudapp'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -43,9 +43,10 @@ Gem::Specification.new do |s|
43
43
 
44
44
  ## List your runtime dependencies here. Runtime dependencies are those
45
45
  ## that are needed for an end user to actually USE your code.
46
- s.add_dependency 'netrc', '~> 0.7.7'
46
+ s.add_dependency 'clipboard', '~> 1.0.1'
47
47
  s.add_dependency 'leadlight', '~> 0.1.0'
48
48
  s.add_dependency 'mime-types', '~> 1.19'
49
+ s.add_dependency 'netrc', '~> 0.7.7'
49
50
  s.add_dependency 'typhoeus', '~> 0.3.3'
50
51
 
51
52
  ## List your development dependencies here. Development dependencies are
@@ -4,10 +4,10 @@ module CloudApp
4
4
  module CLI
5
5
  class Prompt
6
6
  def ask_for_credentials
7
- puts "Sign into CloudApp."
8
- print "Email: "
7
+ $stderr.puts "Sign into CloudApp."
8
+ $stderr.print "Email: "
9
9
  email = ask
10
- print "Password (typing will be hidden): "
10
+ $stderr.print "Password (typing will be hidden): "
11
11
  password = ask_for_password
12
12
  [ email, password ]
13
13
  end
@@ -16,7 +16,7 @@ module CloudApp
16
16
  def ask_for_password
17
17
  echo_off
18
18
  password = ask
19
- puts
19
+ $stderr.puts
20
20
  echo_on
21
21
  return password
22
22
  end
data/lib/cloudapp.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CloudApp
2
- VERSION = '2.0.0.beta.9'
2
+ VERSION = '2.0.0.beta.10'
3
3
  end
data/man/cloudapp.1 CHANGED
@@ -7,13 +7,13 @@
7
7
  \fBcloudapp\fR \- all the pleasures of cloudapp in a cli
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBcloudapp bookmark\fR [\fB\-\-direct\fR] \fIurl\fR [\fIurl\fR\.\.\.]
10
+ \fBcloudapp bookmark\fR [\fB\-\-direct\fR] [\fB\-\-no\-copy\fR] \fIurl\fR [\fIurl\fR\.\.\.]
11
11
  .
12
12
  .br
13
- \fBcloudapp upload\fR [\fB\-\-direct\fR] \fIfile\fR [\fIfile\fR\.\.\.]
13
+ \fBcloudapp upload\fR [\fB\-\-direct\fR] [\fB\-\-no\-copy\fR] \fIfile\fR [\fIfile\fR\.\.\.]
14
14
  .
15
15
  .SH "DESCRIPTION"
16
- Upload a file or share a bookmark with CloudApp\. The drop\'s share link will be printed to standard output\. Account credentials are stored in \fB~/\.netrc\fR\.
16
+ Upload a file or share a bookmark with CloudApp\. The drop\'s share link will be printed to standard output and copied to the system clipboard\. Account credentials are stored in \fB~/\.netrc\fR as defined by \fBftp\fR(1)\.
17
17
  .
18
18
  .P
19
19
  \fBcloudapp\fR requires ruby 1\.9\.3 or greater\.
@@ -24,25 +24,9 @@ Upload a file or share a bookmark with CloudApp\. The drop\'s share link will be
24
24
  \fB\-d\fR, \fB\-\-direct\fR
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
- .SH "EXIT STATUS"
28
- cloudapp may return one of several error codes if it encouters problems\.
29
- .
30
- .IP "\(bu" 4
31
- \fB0\fR Success
32
- .
33
- .IP "\(bu" 4
34
- \fB1\fR File exceeds the limits of the account\'s plan
35
- .
36
- .IP "\(bu" 4
37
- \fB9\fR Some horrible, unexpected thing has happened
38
- .
39
- .IP "" 0
40
- .
41
- .SH "FILES"
42
- .
43
27
  .TP
44
- \fB$HOME/\.netrc\fR
45
- Store account authentication token
28
+ \fB\-c\fR, \fB\-\-no\-copy\fR
29
+ Don\'t copy the new drop\'s link to the system clipboard\.
46
30
  .
47
31
  .SH "EXAMPLE"
48
32
  Upload a file:
@@ -114,6 +98,4 @@ http://cl\.ly/abc123/screenshot\.png
114
98
  .fi
115
99
  .
116
100
  .IP "" 0
117
- .
118
- .SH "SEE ALSO"
119
- \fBftp\fR(1)
101
+
data/man/cloudapp.1.html CHANGED
@@ -63,10 +63,7 @@
63
63
  <a href="#SYNOPSIS">SYNOPSIS</a>
64
64
  <a href="#DESCRIPTION">DESCRIPTION</a>
65
65
  <a href="#OPTIONS">OPTIONS</a>
66
- <a href="#EXIT-STATUS">EXIT STATUS</a>
67
- <a href="#FILES">FILES</a>
68
66
  <a href="#EXAMPLE">EXAMPLE</a>
69
- <a href="#SEE-ALSO">SEE ALSO</a>
70
67
  </div>
71
68
 
72
69
  <ol class='man-decor man-head man head'>
@@ -82,39 +79,23 @@
82
79
 
83
80
  <h2 id="SYNOPSIS">SYNOPSIS</h2>
84
81
 
85
- <p><code>cloudapp bookmark</code> [<code>--direct</code>] <var>url</var> [<var>url</var>...]<br />
86
- <code>cloudapp upload</code> [<code>--direct</code>] <var>file</var> [<var>file</var>...]</p>
82
+ <p><code>cloudapp bookmark</code> [<code>--direct</code>] [<code>--no-copy</code>] <var>url</var> [<var>url</var>...]<br />
83
+ <code>cloudapp upload</code> [<code>--direct</code>] [<code>--no-copy</code>] <var>file</var> [<var>file</var>...]</p>
87
84
 
88
85
  <h2 id="DESCRIPTION">DESCRIPTION</h2>
89
86
 
90
87
  <p>Upload a file or share a bookmark with CloudApp. The drop's share link will be
91
- printed to standard output. Account credentials are stored in <code>~/.netrc</code>.</p>
88
+ printed to standard output and copied to the system clipboard. Account
89
+ credentials are stored in <code>~/.netrc</code> as defined by <code>ftp</code>(1).</p>
92
90
 
93
91
  <p><strong>cloudapp</strong> requires ruby 1.9.3 or greater.</p>
94
92
 
95
93
  <h2 id="OPTIONS">OPTIONS</h2>
96
94
 
97
95
  <dl>
98
- <dt><code>-d</code>, <code>--direct</code></dt><dd>Print the drop's direct link after creation. The direct link is suitable for
99
- use in places that expect a link to a file like an HTML IMG tag.</dd>
100
- </dl>
101
-
102
-
103
- <h2 id="EXIT-STATUS">EXIT STATUS</h2>
104
-
105
- <p>cloudapp may return one of several error codes if it encouters problems.</p>
106
-
107
- <ul>
108
- <li><code>0</code> Success</li>
109
- <li><code>1</code> File exceeds the limits of the account's plan</li>
110
- <li><code>9</code> Some horrible, unexpected thing has happened</li>
111
- </ul>
112
-
113
-
114
- <h2 id="FILES">FILES</h2>
115
-
116
- <dl>
117
- <dt><code>$HOME/.netrc</code></dt><dd>Store account authentication token</dd>
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
+ use in places that expect a link to a file like an HTML IMG tag.</p></dd>
98
+ <dt><code>-c</code>, <code>--no-copy</code></dt><dd><p>Don't copy the new drop's link to the system clipboard.</p></dd>
118
99
  </dl>
119
100
 
120
101
 
@@ -151,10 +132,6 @@ http://cl.ly/abc123
151
132
  http://cl.ly/abc123/screenshot.png
152
133
  </code></pre>
153
134
 
154
- <h2 id="SEE-ALSO">SEE ALSO</h2>
155
-
156
- <p><code>ftp</code>(1)</p>
157
-
158
135
 
159
136
  <ol class='man-decor man-foot man foot'>
160
137
  <li class='tl'></li>
data/man/cloudapp.1.ronn CHANGED
@@ -3,13 +3,14 @@ cloudapp(1) -- all the pleasures of cloudapp in a cli
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `cloudapp bookmark` [`--direct`] <url> [<url>...]<br>
7
- `cloudapp upload` [`--direct`] <file> [<file>...]
6
+ `cloudapp bookmark` [`--direct`] [`--no-copy`] <url> [<url>...]<br>
7
+ `cloudapp upload` [`--direct`] [`--no-copy`] <file> [<file>...]
8
8
 
9
9
  ## DESCRIPTION
10
10
 
11
11
  Upload a file or share a bookmark with CloudApp. The drop's share link will be
12
- printed to standard output. Account credentials are stored in `~/.netrc`.
12
+ printed to standard output and copied to the system clipboard. Account
13
+ credentials are stored in `~/.netrc` as defined by `ftp`(1).
13
14
 
14
15
  **cloudapp** requires ruby 1.9.3 or greater.
15
16
 
@@ -19,18 +20,8 @@ printed to standard output. Account credentials are stored in `~/.netrc`.
19
20
  Print the drop's direct link after creation. The direct link is suitable for
20
21
  use in places that expect a link to a file like an HTML IMG tag.
21
22
 
22
- ## EXIT STATUS
23
-
24
- cloudapp may return one of several error codes if it encouters problems.
25
-
26
- - `0` Success
27
- - `1` File exceeds the limits of the account's plan
28
- - `9` Some horrible, unexpected thing has happened
29
-
30
- ## FILES
31
-
32
- - `$HOME/.netrc`:
33
- Store account authentication token
23
+ - `--no-copy`:
24
+ Don't copy the new drop's link to the system clipboard.
34
25
 
35
26
  ## EXAMPLE
36
27
 
@@ -59,7 +50,3 @@ Print the drop's direct link:
59
50
 
60
51
  $ cloudapp upload --direct screenshot.png
61
52
  http://cl.ly/abc123/screenshot.png
62
-
63
- ## SEE ALSO
64
-
65
- `ftp`(1)
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.9
4
+ version: 2.0.0.beta.10
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,16 +9,16 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2012-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: netrc
15
+ name: clipboard
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.7.7
21
+ version: 1.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.7.7
29
+ version: 1.0.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: leadlight
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.19'
62
+ - !ruby/object:Gem::Dependency
63
+ name: netrc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.7.7
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.7.7
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: typhoeus
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -171,9 +187,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
187
  - - ! '>='
172
188
  - !ruby/object:Gem::Version
173
189
  version: '0'
174
- segments:
175
- - 0
176
- hash: -2960018242600154187
177
190
  required_rubygems_version: !ruby/object:Gem::Requirement
178
191
  none: false
179
192
  requirements: