appfront 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: 505d73e7f8af1914c2103171441ba6e705bcd073
4
- data.tar.gz: cf4ae7841945f10427fcf413cb867866b9c45bb7
3
+ metadata.gz: adaee53b066fd818cefd758ffdbc09e81c43e688
4
+ data.tar.gz: 33cf0053028244547452efcdcba11271141682bd
5
5
  SHA512:
6
- metadata.gz: accd83b850c4cf86a43b757b63dd8d65e1541d76c4d1ab50eaad252d4bfada70003163a9a6b3724f80c76b0f8091b3e1e7c3fb8ef024da18c0fa2d5e20bff740
7
- data.tar.gz: a66551fd5579be5222de0271f4e7d129beae87699f8a00fc9a6252f01f4e776f4a441e38cc168005bbc001f5f7836fcc456fea33609d20d017a1ce67e865e40f
6
+ metadata.gz: e7a64a3d4181002c11c45142729e25328775b2b7977b2b127c0eac36529f85e116c262591a12bdc9054c4b4bd07087f2f9f6993de0c1b56d961adc7603f844b1
7
+ data.tar.gz: a66b2cc424506296d3fa484aab4f205b76bf52139e726dfeccbb004da6a79cd07dec9ada52a3b138ca28c00414bc1588e4f3309b1406e3613df758101220f46f
@@ -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,
@@ -24,7 +24,7 @@ module Appfront::Command
24
24
  exit 0
25
25
  end
26
26
 
27
- unless (klass == 'login' or cmd == 'auth:login')
27
+ unless (klass == 'login' or cmd == 'auth:login' or klass == 'signup')
28
28
  Appfront::Command::Auth.authenticate!
29
29
  end
30
30
 
@@ -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.logout(*opts)
7
- Appfront::Command::Auth.logout
6
+ def self.signup(*opts)
7
+ Appfront::Command::Auth.signup
8
8
  end
9
9
 
10
- def self.signup(*opts)
11
- puts 'Please go to: https://appfront.io/signup'
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.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.1
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-10 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netrc