appfront 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appfront/api.rb +13 -0
- data/lib/appfront/command.rb +1 -1
- data/lib/appfront/command/alias.rb +5 -5
- data/lib/appfront/command/auth.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adaee53b066fd818cefd758ffdbc09e81c43e688
|
4
|
+
data.tar.gz: 33cf0053028244547452efcdcba11271141682bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7a64a3d4181002c11c45142729e25328775b2b7977b2b127c0eac36529f85e116c262591a12bdc9054c4b4bd07087f2f9f6993de0c1b56d961adc7603f844b1
|
7
|
+
data.tar.gz: a66b2cc424506296d3fa484aab4f205b76bf52139e726dfeccbb004da6a79cd07dec9ada52a3b138ca28c00414bc1588e4f3309b1406e3613df758101220f46f
|
data/lib/appfront/api.rb
CHANGED
@@ -26,6 +26,18 @@
|
|
26
26
|
exit 1
|
27
27
|
end
|
28
28
|
|
29
|
+
def signup
|
30
|
+
return unless (@email && @pass)
|
31
|
+
|
32
|
+
@pass = RestClient.post(
|
33
|
+
"#{@host}/signup",
|
34
|
+
email: @email, password: @pass
|
35
|
+
)
|
36
|
+
rescue => e
|
37
|
+
puts e.response
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
|
29
41
|
def method_missing(m, *args, &block)
|
30
42
|
unless ['get', 'post', 'put', 'delete'].include? m.to_s
|
31
43
|
raise NoMethodError, "undefined method: #{m}"
|
@@ -51,6 +63,7 @@
|
|
51
63
|
if path != '/flow.yaml'
|
52
64
|
resource.send method, (args.first || {})
|
53
65
|
else
|
66
|
+
puts "method: #{method.to_sym}"
|
54
67
|
file = args.first[:file]
|
55
68
|
request = RestClient::Request.new(
|
56
69
|
:method => method.to_sym,
|
data/lib/appfront/command.rb
CHANGED
@@ -3,16 +3,16 @@ class Appfront::Command::Alias < Appfront::Command::Base
|
|
3
3
|
Appfront::Command::Auth.login
|
4
4
|
end
|
5
5
|
|
6
|
-
def self.
|
7
|
-
Appfront::Command::Auth.
|
6
|
+
def self.signup(*opts)
|
7
|
+
Appfront::Command::Auth.signup
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.
|
11
|
-
|
10
|
+
def self.logout(*opts)
|
11
|
+
Appfront::Command::Auth.logout
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.version(*opts)
|
15
|
-
puts 'Appfront CLI 1.0.
|
15
|
+
puts 'Appfront CLI 1.0.2'
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.ls(*opts)
|
@@ -24,6 +24,34 @@ class Appfront::Command::Auth < Appfront::Command::Base
|
|
24
24
|
true
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.signup
|
28
|
+
puts "Welcome to Appfront \n"
|
29
|
+
puts "Insert your credentials to signup"
|
30
|
+
|
31
|
+
print "email: "
|
32
|
+
email = ask
|
33
|
+
|
34
|
+
print "password: "
|
35
|
+
|
36
|
+
echo_off
|
37
|
+
pass = ask_for_password
|
38
|
+
echo_on
|
39
|
+
|
40
|
+
api = Appfront::API.new(email: email, password: pass)
|
41
|
+
key = api.signup
|
42
|
+
unless key
|
43
|
+
exit 1
|
44
|
+
puts "There was a problem during registration, please try it later. \n"
|
45
|
+
end
|
46
|
+
netrc.delete 'jarvis.appfront.io'
|
47
|
+
|
48
|
+
netrc['jarvis.appfront.io'] = email, key
|
49
|
+
netrc.save
|
50
|
+
puts "Registration complete, we've already logged you in... \n"
|
51
|
+
puts "Find out more by typing: appfront help\n"
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
27
55
|
def self.logout
|
28
56
|
netrc.delete 'jarvis.appfront.io'
|
29
57
|
netrc.save
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appfront
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: netrc
|