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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d136dd1be3cd96e46d3359a2fc270ab39189cac
4
- data.tar.gz: 23206eca9975343407645c32341ff386752ec4a5
3
+ metadata.gz: 199cd115461389608f5ff97c63560b8f7effd8f8
4
+ data.tar.gz: 24dc748ad34b90f80a9b6b3a41fe6c0d16ad0edf
5
5
  SHA512:
6
- metadata.gz: 5b3a2ffd8558afc9fde462e652d3ac2b7ab325aa8dc45f4d2a3bac6b5d9afd4105e3c94a5e42a78273f5ea9ded242b8110bd8324238ed629e4a0281659e2ebd3
7
- data.tar.gz: 7c14b5422e33d730bc7d52eb907b2428d5a4b73b8117f9a28835c100ceeeb27260d880926b5190b15f97e82fb641bcd85b8c5ca985cf4787fb638b478b0642bb
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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Harborapp
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harborapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Thompson