harborapp 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/harbor +27 -0
- data/lib/harborapp/account.rb +6 -0
- data/lib/harborapp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199cd115461389608f5ff97c63560b8f7effd8f8
|
4
|
+
data.tar.gz: 24dc748ad34b90f80a9b6b3a41fe6c0d16ad0edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa980373e85a076a9911711402a2eb7d9b5b8b74373b54f2be517c5561297cc173c9359e57ba1581faeedd65d4129a6b0ca24f8f17448073a4e1ef29e2f020c
|
7
|
+
data.tar.gz: 20178141d821e2a330a18bbf8ec262bc9787e468e31dce3bf50dd567e86245554678c1f77a5bb7e9a881577632e063e541b76a3e60847e6b4694aa90afcb5e4f
|
data/bin/harbor
CHANGED
@@ -7,6 +7,29 @@ require 'io/console'
|
|
7
7
|
program :version, '0.0.1'
|
8
8
|
program :description, 'Command-line interface for https://harbor.madebymarket.com file transfer service.'
|
9
9
|
|
10
|
+
default_command :upload
|
11
|
+
|
12
|
+
command :signup do |c|
|
13
|
+
c.syntax = 'harbor signup, [options]'
|
14
|
+
c.summary = ''
|
15
|
+
c.description = ''
|
16
|
+
c.example 'description', 'command example'
|
17
|
+
c.action do |args, options|
|
18
|
+
puts "Register for a free harbor account using your email address and a password."
|
19
|
+
email = ask "email address: "
|
20
|
+
pw = password "choose password: "
|
21
|
+
pw_confirm = password "confirm password: "
|
22
|
+
account = Harborapp::Account.signup email, pw, pw_confirm
|
23
|
+
if account.success?
|
24
|
+
account.write_creds
|
25
|
+
puts "Account created, saving your credentials to #{File.expand_path("~/.harbor_auth")}."
|
26
|
+
puts "Once you have confirmed your account, you can run 'harbor --file /your/file.pdf' to upload files."
|
27
|
+
else
|
28
|
+
puts account.errors
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
10
33
|
command :login do |c|
|
11
34
|
c.syntax = 'harbor login, [options]'
|
12
35
|
c.summary = ''
|
@@ -33,6 +56,10 @@ command :upload do |c|
|
|
33
56
|
c.option '--file STRING', String, 'File to upload'
|
34
57
|
c.action do |args, options|
|
35
58
|
account = Harborapp::Account.from_creds
|
59
|
+
unless options.file
|
60
|
+
puts "Syntax: harbor --file /your/file.pdf"
|
61
|
+
exit 0
|
62
|
+
end
|
36
63
|
Harborapp.api_key = account.api_key
|
37
64
|
upload = Harborapp::Upload.get_curl_params(options.file)
|
38
65
|
upload.deliver
|
data/lib/harborapp/account.rb
CHANGED
@@ -10,6 +10,12 @@ module Harborapp
|
|
10
10
|
Harborapp::Api.request :post, "/login", params
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.signup(email, password, password_confirmation)
|
14
|
+
params = {:email => email, :password => password,
|
15
|
+
:password_confirmation => password_confirmation}
|
16
|
+
Harborapp::Api.request :post, "/signup", params
|
17
|
+
end
|
18
|
+
|
13
19
|
def write_creds
|
14
20
|
File.open(File.expand_path("~/.harbor_auth"), "w") do |f|
|
15
21
|
f.write({api_key: api_key, email: email}.to_json)
|
data/lib/harborapp/version.rb
CHANGED