faastruby 0.5.24 → 0.5.25
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/LICENSE +29 -0
- data/lib/faastruby/api.rb +1 -1
- data/lib/faastruby/cli/commands/account/base_command.rb +50 -2
- data/lib/faastruby/cli/commands/account/confirm.rb +7 -4
- data/lib/faastruby/cli/commands/account/signup.rb +9 -19
- data/lib/faastruby/version.rb +1 -1
- data/lib/faastruby/workspace.rb +23 -27
- metadata +3 -3
- data/LICENSE.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f99fdbecd66b6624e2939182c800e9d226b5f81005e22c6b5e74d809bf9374b6
|
4
|
+
data.tar.gz: d633dbe4d532d078b3e6bbc5c86e603f90adbc683fbbcf46be2e1b27dea549f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cad5eec44d08743aed44a7e72fae5d3e6024e152a3472436c92c5f55e34ecc98834efce7b994cae255ff976742eea755df7a2c28810b5a1ae72b24921b46a80
|
7
|
+
data.tar.gz: 477f8ceeac2e2cbf2a1b414aec44a16ba2482c83994a2e11768ce6de8199a3a6426069cee361c47dfa67fc4dfef225c5b537227aa1bfc1d75606a7ec0982e3a3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.25 - Apr 25 2019
|
4
|
+
- Refactor API call and post-response processing in Workspace class
|
5
|
+
- Prompt user to confirm password as part of the signup process
|
6
|
+
- Fix bug preventing signups
|
7
|
+
|
3
8
|
## 0.5.24 - Apr 17 2019
|
4
9
|
- Add experimental support for Opal
|
5
10
|
- Add new project configuration keys: `opal_dir` and `opal_js_destination`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
faastruby (0.5.
|
4
|
+
faastruby (0.5.25)
|
5
5
|
colorize (~> 0.8)
|
6
6
|
faastruby-rpc (~> 0.2.7)
|
7
7
|
listen (~> 3.1)
|
@@ -114,7 +114,7 @@ GEM
|
|
114
114
|
strings-ansi (0.1.0)
|
115
115
|
thor (0.20.3)
|
116
116
|
tilt (2.0.9)
|
117
|
-
tmuxinator (0.
|
117
|
+
tmuxinator (0.16.0)
|
118
118
|
erubis (~> 2.6)
|
119
119
|
thor (~> 0.19, >= 0.15.0)
|
120
120
|
xdg (~> 2.2, >= 2.2.3)
|
@@ -131,7 +131,7 @@ GEM
|
|
131
131
|
tty-screen (~> 0.6.4)
|
132
132
|
unf (0.1.4)
|
133
133
|
unf_ext
|
134
|
-
unf_ext (0.0.7.
|
134
|
+
unf_ext (0.0.7.6)
|
135
135
|
unicode-display_width (1.5.0)
|
136
136
|
unicode_utils (1.4.0)
|
137
137
|
webmock (3.4.2)
|
data/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
BSD 3-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2018-2019, Paulo Arruda <paulo at faastruby dot io>
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
* Neither the name of faastRuby, the copyright holder nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/lib/faastruby/api.rb
CHANGED
@@ -134,7 +134,7 @@ module FaaStRuby
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
def
|
137
|
+
def delete_file(workspace_name:, relative_path:)
|
138
138
|
url = "#{@api_url}/workspaces/#{workspace_name}/static/sync"
|
139
139
|
payload = {
|
140
140
|
relative_path: relative_path
|
@@ -1,11 +1,59 @@
|
|
1
1
|
module FaaStRuby
|
2
2
|
module Command
|
3
3
|
module Account
|
4
|
-
PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,50}$/
|
5
|
-
EMAIL_REGEX = /\A[a-z0-9\-\.+]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
|
6
4
|
require 'faastruby/user'
|
7
5
|
require 'faastruby/cli/new_credentials'
|
6
|
+
|
7
|
+
PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,50}$/
|
8
|
+
EMAIL_REGEX = /\A[a-z0-9\-\.+]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
|
9
|
+
|
8
10
|
class AccountBaseCommand < BaseCommand
|
11
|
+
def password_is_confirmed?(password, password_confirmation)
|
12
|
+
return false if password.nil?
|
13
|
+
|
14
|
+
password == password_confirmation
|
15
|
+
end
|
16
|
+
|
17
|
+
def password_is_valid?(password)
|
18
|
+
password.match(PASSWORD_REGEX)
|
19
|
+
end
|
20
|
+
|
21
|
+
def prompt(command:, label:, secure: true)
|
22
|
+
puts ""
|
23
|
+
puts "#{command}"
|
24
|
+
print label
|
25
|
+
|
26
|
+
if secure
|
27
|
+
STDIN.noecho(&:gets).chomp
|
28
|
+
else
|
29
|
+
STDIN.gets.chomp
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def prompt_for_password
|
34
|
+
password = prompt(command: "\nNow type in a password. It must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % * ? &",
|
35
|
+
label: "Password: ")
|
36
|
+
|
37
|
+
until password_is_valid?(password) do
|
38
|
+
password = prompt(command: "\nYour password must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % * ? &\nPlease try again.".red,
|
39
|
+
label: "Password: ")
|
40
|
+
end
|
41
|
+
|
42
|
+
password
|
43
|
+
end
|
44
|
+
|
45
|
+
def prompt_to_confirm_password(password)
|
46
|
+
password_confirmation = prompt(command: "\nNow type that password again",
|
47
|
+
label: "Confirm password: ")
|
48
|
+
|
49
|
+
until password_is_confirmed?(password, password_confirmation)
|
50
|
+
print "\n\nHmm... those passwords did not match. Let's try again".red
|
51
|
+
|
52
|
+
password = prompt_for_password
|
53
|
+
password_confirmation = prompt(command: "\nNow type that password again",
|
54
|
+
label: "Confirm password: ")
|
55
|
+
end
|
56
|
+
end
|
9
57
|
end
|
10
58
|
end
|
11
59
|
end
|
@@ -14,6 +14,7 @@ module FaaStRuby
|
|
14
14
|
def run
|
15
15
|
user = User.new(email: @options['email'])
|
16
16
|
user.send_confirmation_code
|
17
|
+
error(errors: user.errors) if user.errors.any?
|
17
18
|
puts "\nYou should have received an email with a confirmation token."
|
18
19
|
puts "If you didn't receive an email:"
|
19
20
|
puts "- Make sure you sign up with the correct email address"
|
@@ -22,16 +23,18 @@ module FaaStRuby
|
|
22
23
|
user.confirmation_token = STDIN.gets.chomp
|
23
24
|
spinner = spin("Confirming your account...")
|
24
25
|
user.confirm_account!
|
25
|
-
if user.errors.any?
|
26
|
-
spinner.error
|
27
|
-
FaaStRuby::CLI.error(user.errors)
|
28
|
-
end
|
26
|
+
error(errors: user.errors) if user.errors.any?
|
29
27
|
spinner.success
|
30
28
|
user.save_credentials
|
31
29
|
puts "Login successful!"
|
32
30
|
migrate
|
33
31
|
end
|
34
32
|
|
33
|
+
def error(spinner: nil, errors:)
|
34
|
+
spinner&.error
|
35
|
+
FaaStRuby::CLI.error(errors)
|
36
|
+
end
|
37
|
+
|
35
38
|
def migrate
|
36
39
|
old_credentials = File.expand_path("~/.faastruby.tor1")
|
37
40
|
return unless File.file?(old_credentials)
|
@@ -11,28 +11,23 @@ module FaaStRuby
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
|
15
|
-
|
16
|
-
email = STDIN.gets.chomp
|
14
|
+
email = prompt(command: "Welcome to FaaStRuby! Please enter your email address.", label: "Email: ", secure: false)
|
15
|
+
|
17
16
|
until email_is_valid?(email) do
|
18
|
-
|
19
|
-
print "Email: "
|
20
|
-
email = STDIN.gets.chomp
|
21
|
-
end
|
22
|
-
puts "\nNow type in a password. It must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % * ? &"
|
23
|
-
print "Password: "
|
24
|
-
password = STDIN.noecho(&:gets).chomp
|
25
|
-
until password_is_valid?(password) do
|
26
|
-
puts "\nYour password must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % * ? &\nPlease try again:".red
|
27
|
-
print "Password: "
|
28
|
-
password = STDIN.noecho(&:gets).chomp
|
17
|
+
email = prompt(command: "\nYou entered an invalid email address. Please try again.".red, label: "Email: ", secure: false)
|
29
18
|
end
|
19
|
+
|
20
|
+
password = prompt_for_password
|
21
|
+
|
22
|
+
prompt_to_confirm_password(password)
|
23
|
+
|
30
24
|
spinner = spin("Creating your account...")
|
31
25
|
user = User.create(email: email, password: password)
|
32
26
|
if user.errors.any?
|
33
27
|
spinner.error
|
34
28
|
FaaStRuby::CLI.error(user.errors)
|
35
29
|
end
|
30
|
+
|
36
31
|
spinner.success
|
37
32
|
exec("faastruby confirm-account --email #{email}")
|
38
33
|
exit 0
|
@@ -42,10 +37,6 @@ module FaaStRuby
|
|
42
37
|
email.match(EMAIL_REGEX)
|
43
38
|
end
|
44
39
|
|
45
|
-
def password_is_valid?(password)
|
46
|
-
password.match(PASSWORD_REGEX)
|
47
|
-
end
|
48
|
-
|
49
40
|
def self.help
|
50
41
|
"signup"
|
51
42
|
end
|
@@ -54,7 +45,6 @@ module FaaStRuby
|
|
54
45
|
puts "Usage: faastruby #{self.class.help}"
|
55
46
|
end
|
56
47
|
|
57
|
-
|
58
48
|
def parse_options
|
59
49
|
@options = {}
|
60
50
|
while @args.any?
|
data/lib/faastruby/version.rb
CHANGED
data/lib/faastruby/workspace.rb
CHANGED
@@ -29,65 +29,61 @@ module FaaStRuby
|
|
29
29
|
##### Instance methods
|
30
30
|
attr_accessor :name, :errors, :functions, :email, :object, :credentials, :updated_at, :created_at, :status_code, :provider, :runners_max, :runners_current, :static_metadata
|
31
31
|
|
32
|
-
def
|
33
|
-
response =
|
32
|
+
def make_request
|
33
|
+
response = yield
|
34
34
|
@status_code = response.code
|
35
35
|
@errors += response.errors if response.errors.any?
|
36
|
+
|
37
|
+
response
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
make_request { @api.destroy_workspace(@name) }
|
36
42
|
end
|
37
43
|
|
38
44
|
def deploy(package_file_name, root_to: false, catch_all: false, context: false)
|
39
|
-
|
40
|
-
|
41
|
-
@errors += response.errors if response.errors.any?
|
45
|
+
make_request { @api.deploy(workspace_name: @name, package: package_file_name, root_to: root_to, catch_all: catch_all, context: context) }
|
46
|
+
|
42
47
|
self
|
43
48
|
end
|
44
49
|
|
45
50
|
def refresh_credentials
|
46
|
-
response = @api.refresh_credentials(@name)
|
47
|
-
@status_code = response.code
|
51
|
+
response = make_request { @api.refresh_credentials(@name) }
|
48
52
|
@credentials = response.body[@name] unless response.body.nil?
|
49
|
-
|
53
|
+
|
50
54
|
self
|
51
55
|
end
|
52
56
|
|
53
57
|
def update_runners(value)
|
54
|
-
response = @api.update_runners(workspace_name: @name, runners_max: value)
|
58
|
+
response = make_request { @api.update_runners(workspace_name: @name, runners_max: value) }
|
55
59
|
@runners_max = response.body['runners_max'].to_i if response.body['runners_max'] rescue nil
|
56
|
-
|
57
|
-
@errors += response.errors if response.errors.any?
|
60
|
+
|
58
61
|
self
|
59
62
|
end
|
60
63
|
|
61
64
|
def fetch
|
62
|
-
response = @api.get_workspace_info(@name)
|
63
|
-
|
64
|
-
|
65
|
-
@errors += response.errors
|
66
|
-
else
|
67
|
-
parse_attributes(response.body)
|
68
|
-
end
|
65
|
+
response = make_request { @api.get_workspace_info(@name) }
|
66
|
+
parse_attributes(response.body) unless response.errors.any?
|
67
|
+
|
69
68
|
self
|
70
69
|
end
|
71
70
|
|
72
71
|
def upload_file(package_file_name, relative_path:)
|
73
|
-
|
74
|
-
|
75
|
-
@errors += response.errors if response.errors.any?
|
72
|
+
make_request { @api.upload_file(workspace_name: @name, package: package_file_name, relative_path: relative_path) }
|
73
|
+
|
76
74
|
self
|
77
75
|
end
|
78
76
|
|
79
77
|
def delete_file(relative_path:)
|
80
|
-
|
81
|
-
|
82
|
-
@errors += response.errors if response.errors.any?
|
78
|
+
make_request { @api.delete_file(workspace_name: @name, relative_path: relative_path) }
|
79
|
+
|
83
80
|
self
|
84
81
|
end
|
85
82
|
|
86
83
|
def static_metadata
|
87
|
-
response = @api.get_static_metadata(@name)
|
88
|
-
@status_code = response.code
|
89
|
-
@errors += response.errors if response.errors.any?
|
84
|
+
response = make_request { @api.get_static_metadata(@name) }
|
90
85
|
@static_metadata = response.body['metadata']
|
86
|
+
|
91
87
|
self
|
92
88
|
end
|
93
89
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faastruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Arruda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -291,7 +291,7 @@ files:
|
|
291
291
|
- CHANGELOG.md
|
292
292
|
- Gemfile
|
293
293
|
- Gemfile.lock
|
294
|
-
- LICENSE
|
294
|
+
- LICENSE
|
295
295
|
- README.md
|
296
296
|
- Rakefile
|
297
297
|
- bin/console
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Paulo Arruda
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|