yassh 0.0.1 → 0.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/yassh +25 -0
- 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: 3d314baa9145fc2b16a4e29e0d1f84ff0985636f
|
4
|
+
data.tar.gz: d5b8f2e1f4a7785d1693bf8b57a32b670b901e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d432f62ff063cbac26775b743daaf0197705652a4de333f2c603b57adc6e651f1ef898db38149a4ebede2d148d3b0906672a75e34ef5b620334ae4460d72a0f
|
7
|
+
data.tar.gz: 8a3bbf7b0af254269e8b6a054e3d1ba6338b4cd028259928a18755e999065126e8bbf27b355e78dd2c10a384e4b4b0c4977bc6f218a328af00e6c7d6531a6213
|
data/bin/yassh
CHANGED
@@ -54,6 +54,31 @@ def authenticate(email, password)
|
|
54
54
|
$api["/auth"].post({username: email, password: password}.to_json).json
|
55
55
|
end
|
56
56
|
|
57
|
+
def signup(email, password)
|
58
|
+
$api["/accounts"].post({email: email, password: password}.to_json).json
|
59
|
+
end
|
60
|
+
|
61
|
+
command :signup do |c|
|
62
|
+
c.syntax = "yassh signup"
|
63
|
+
c.description = "Create a user account and store API key in ~/.config/yassh/"
|
64
|
+
c.action do |args, opts|
|
65
|
+
email = ask("Email: ")
|
66
|
+
pass = password
|
67
|
+
|
68
|
+
begin
|
69
|
+
signup(email, pass)
|
70
|
+
result = authenticate(email, pass)
|
71
|
+
dir_path = File.join(ENV["HOME"], ".config/yassh/")
|
72
|
+
FileUtils.mkdir_p(dir_path)
|
73
|
+
path = File.join(dir_path, "access_token")
|
74
|
+
File.write(path, result["access_token"] + "\n")
|
75
|
+
puts "Access token written to: #{path}"
|
76
|
+
# rescue RestClient::RequestFailed
|
77
|
+
# puts "Failed to signup"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
57
82
|
command :auth do |c|
|
58
83
|
c.syntax = "yassh auth"
|
59
84
|
c.description = "Authenticate your user account and store API key in ~/.config/yassh/"
|