faastruby 0.5.19 → 0.5.20
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 +7 -0
- data/Gemfile.lock +2 -2
- data/lib/faastruby/cli.rb +6 -1
- data/lib/faastruby/cli/base_command.rb +1 -0
- data/lib/faastruby/cli/commands/account/base_command.rb +2 -0
- data/lib/faastruby/cli/commands/account/confirm.rb +4 -1
- data/lib/faastruby/cli/commands/account/signup.rb +0 -2
- data/lib/faastruby/cli/commands/function/deploy_to.rb +6 -2
- data/lib/faastruby/cli/commands/function/new.rb +4 -4
- data/lib/faastruby/cli/commands/project/deploy.rb +9 -5
- data/lib/faastruby/local.rb +11 -5
- data/lib/faastruby/server.rb +9 -4
- data/lib/faastruby/supported_runtimes.rb +3 -2
- data/lib/faastruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3e04a1ad4fa50f8e90c8affd5c16628da87e002a09ffeb3e169cb2bad891c72
|
4
|
+
data.tar.gz: e3dbcb01e86e5b67845790375cd1456c95dea6d095e0aff580f670a687a0cbf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ddb8c515d614fe73ce7f8ba1b4f05d4025ec4116e57dc9adb04a3fbee2f8711ba04f74d3398d276196f8d8efed27f11ffcd3cffc53d9af971337d58b9b81a7
|
7
|
+
data.tar.gz: 21dce789bdc3540b9a99175bd6dde42f2a11dd61e8c4d7f959023aa625028d320cf2a6f29783e2d1d8678532a74cc46f5cb5dd9f4ce19a16837c2a317a785cc5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.20 - Mar 24 2019
|
4
|
+
- Improved email regex.
|
5
|
+
- Display the correct error message when confirmation token is invalid
|
6
|
+
- Add option `--skip-dependencies` to the commands `deploy-to` and `deploy` to allow skipping of `bundle install` and `shards install`.
|
7
|
+
- Change Ruby runtimes to `2.5` and `2.6` and use the pessimistic version operator to compare Ruby versions and maintain backwards compatibility.
|
8
|
+
- Fix error message on `deploy-to` when workspace credentials are missing
|
9
|
+
|
3
10
|
## 0.5.19 - Mar 20 2019
|
4
11
|
- Fix bug preventing `faastruby deploy` from working when secrets are nil
|
5
12
|
|
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.20)
|
5
5
|
colorize (~> 0.8)
|
6
6
|
faastruby-rpc (~> 0.2.6)
|
7
7
|
listen (~> 3.1)
|
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
mustermann (1.0.3)
|
48
48
|
necromancer (0.4.0)
|
49
49
|
netrc (0.11.0)
|
50
|
-
oj (3.7.
|
50
|
+
oj (3.7.11)
|
51
51
|
pastel (0.7.2)
|
52
52
|
equatable (~> 0.5.0)
|
53
53
|
tty-color (~> 0.4.0)
|
data/lib/faastruby/cli.rb
CHANGED
@@ -46,7 +46,12 @@ module FaaStRuby
|
|
46
46
|
|
47
47
|
def self.check_ruby_version
|
48
48
|
require 'faastruby/supported_runtimes'
|
49
|
-
error("Unsupported Ruby version: #{RUBY_VERSION}\nSupported Ruby versions are: #{SUPPORTED_RUBY.join(", ")}") unless
|
49
|
+
error("Unsupported Ruby version: #{RUBY_VERSION}\nSupported Ruby versions are: #{SUPPORTED_RUBY.join(", ")}") unless version_match?(SUPPORTED_RUBY, RUBY_VERSION)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.version_match?(supported, current)
|
53
|
+
supported.each {|supported_version| return true if Gem::Dependency.new('', supported_version).match?('', current)}
|
54
|
+
return false
|
50
55
|
end
|
51
56
|
|
52
57
|
def self.check_region
|
@@ -1,6 +1,8 @@
|
|
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
|
4
6
|
require 'faastruby/user'
|
5
7
|
require 'faastruby/cli/new_credentials'
|
6
8
|
class AccountBaseCommand < BaseCommand
|
@@ -22,7 +22,10 @@ module FaaStRuby
|
|
22
22
|
user.confirmation_token = STDIN.gets.chomp
|
23
23
|
spinner = spin("Confirming your account...")
|
24
24
|
user.confirm_account!
|
25
|
-
|
25
|
+
if user.errors.any?
|
26
|
+
spinner.error
|
27
|
+
FaaStRuby::CLI.error(user.errors)
|
28
|
+
end
|
26
29
|
spinner.success
|
27
30
|
user.save_credentials
|
28
31
|
puts "Login successful!"
|
@@ -1,8 +1,6 @@
|
|
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([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
|
6
4
|
require 'faastruby/cli/commands/account/base_command'
|
7
5
|
require 'io/console'
|
8
6
|
class Signup < AccountBaseCommand
|
@@ -99,6 +99,8 @@ module FaaStRuby
|
|
99
99
|
--set-root # Set the function as the root route for the workspace.
|
100
100
|
--set-catch-all # Set the function as the catch-all route for the workspace.
|
101
101
|
--dont-create-workspace # Don't try to create the workspace if it doesn't exist.
|
102
|
+
--skip-dependencies # Don't try to install Gems or Shards before creating
|
103
|
+
# the deployment package
|
102
104
|
)
|
103
105
|
end
|
104
106
|
|
@@ -120,7 +122,7 @@ module FaaStRuby
|
|
120
122
|
end
|
121
123
|
|
122
124
|
def shards_install
|
123
|
-
return true unless File.file?('shard.yml')
|
125
|
+
return true unless File.file?('shard.yml') && @options['skip_dependencies'].nil?
|
124
126
|
# puts "[#{@function_name}] Verifying dependencies" unless @options["quiet"]
|
125
127
|
system('shards check > /dev/null') || system('shards install')
|
126
128
|
rescue Errno::EPIPE
|
@@ -128,7 +130,7 @@ module FaaStRuby
|
|
128
130
|
end
|
129
131
|
|
130
132
|
def bundle_install
|
131
|
-
return true unless File.file?('Gemfile')
|
133
|
+
return true unless File.file?('Gemfile') && @options['skip_dependencies'].nil?
|
132
134
|
# puts "* [#{@function_name}] Verifying dependencies" unless @options["quiet"]
|
133
135
|
system('bundle check >/dev/null') || system('bundle install')
|
134
136
|
rescue Errno::EPIPE
|
@@ -185,6 +187,8 @@ module FaaStRuby
|
|
185
187
|
@options['is_catch_all'] = true
|
186
188
|
when '--dont-create-workspace'
|
187
189
|
@options['dont_create_workspace'] = true
|
190
|
+
when '--skip-dependencies'
|
191
|
+
@options['skip_dependencies'] = true
|
188
192
|
else
|
189
193
|
FaaStRuby::CLI.error("Unknown argument: #{option}")
|
190
194
|
end
|
@@ -17,7 +17,7 @@ module FaaStRuby
|
|
17
17
|
parse_options
|
18
18
|
@base_dir ||= @function_name
|
19
19
|
@options['runtime_name'] ||= 'ruby'
|
20
|
-
@options['runtime_version'] ||=
|
20
|
+
@options['runtime_version'] ||= CURRENT_MINOR_RUBY
|
21
21
|
if @options['blank_template']
|
22
22
|
@options['template'] = FaaStRuby::Template.new(type: 'local', source: Template.gem_template_path_for('example-blank', runtime: @options['runtime_name'] || 'ruby'))
|
23
23
|
else
|
@@ -34,7 +34,7 @@ module FaaStRuby
|
|
34
34
|
@yaml_content['name'] = @function_name
|
35
35
|
@options['runtime_name'], @options['runtime_version'] = @yaml_content['runtime']&.split(':')
|
36
36
|
@options['runtime_name'] ||= 'ruby'
|
37
|
-
@options['runtime_version'] ||=
|
37
|
+
@options['runtime_version'] ||= CURRENT_MINOR_RUBY
|
38
38
|
else
|
39
39
|
@yaml_content = yaml_for(@options['runtime_name'])
|
40
40
|
end
|
@@ -143,14 +143,14 @@ module FaaStRuby
|
|
143
143
|
{
|
144
144
|
'cli_version' => FaaStRuby::VERSION,
|
145
145
|
'name' => @function_name,
|
146
|
-
'runtime' => @options['runtime'] ||
|
146
|
+
'runtime' => @options['runtime'] || DEFAULT_RUBY_RUNTIME
|
147
147
|
}
|
148
148
|
else
|
149
149
|
{
|
150
150
|
'cli_version' => FaaStRuby::VERSION,
|
151
151
|
'name' => @function_name,
|
152
152
|
'before_build' => [],
|
153
|
-
'runtime' => @options['runtime'] ||
|
153
|
+
'runtime' => @options['runtime'] || DEFAULT_RUBY_RUNTIME,
|
154
154
|
'test_command' => test_command
|
155
155
|
}
|
156
156
|
end
|
@@ -48,12 +48,12 @@ module FaaStRuby
|
|
48
48
|
jobs << Thread.new do
|
49
49
|
function_config = YAML.load(File.read("#{function_path}/faastruby.yml"))
|
50
50
|
function_name = function_config['name']
|
51
|
-
msg = function_name == 'public' ? "Uploading static assets in '#{function_name}'" : "Deploying function '#{function_path}'"
|
51
|
+
msg = function_name == 'public' ? "Uploading static assets in '#{function_name}'" : "Deploying function from '#{function_path}'"
|
52
52
|
spinner = @spinners.register "[:spinner] #{msg}"
|
53
53
|
spinner.auto_spin
|
54
54
|
# puts "[#{function_path}] Entering folder '#{function_path}'"
|
55
55
|
# Dir.chdir function_path
|
56
|
-
cmd = "cd #{function_path} && faastruby deploy-to #{@workspace} --quiet --dont-create-workspace"
|
56
|
+
cmd = "cd #{function_path} && faastruby deploy-to #{@workspace} --quiet --dont-create-workspace #{'--skip-dependencies' if @options['skip_dependencies']}"
|
57
57
|
cmd += " --set-root" if @root_to == function_name
|
58
58
|
cmd += " --set-catch-all" if @catch_all == function_name
|
59
59
|
secrets = secrets_for(function_name)
|
@@ -100,7 +100,7 @@ module FaaStRuby
|
|
100
100
|
continue = has_credentials || try_to_create.call
|
101
101
|
unless continue
|
102
102
|
connect_spinner.error
|
103
|
-
FaaStRuby::CLI.error("Unable to deploy project to workspace '#{workspace}'. Make sure you have the credentials, or try a different environment name.\nExample: faastruby deploy --
|
103
|
+
FaaStRuby::CLI.error("Unable to deploy project to workspace '#{workspace}'. Make sure you have the credentials, or try a different environment name.\nExample: faastruby deploy --env #{@options['environment']}-#{(rand * 100).to_i}")
|
104
104
|
end
|
105
105
|
connect_spinner.success
|
106
106
|
true
|
@@ -122,9 +122,11 @@ module FaaStRuby
|
|
122
122
|
puts "Usage: faastruby #{self.class.help}"
|
123
123
|
puts %(
|
124
124
|
-f,--function FUNCTION_PATH # Specify the path to the function directory in your local machine.
|
125
|
-
#
|
126
|
-
# -f path/to/function1 -f path/to/function2
|
125
|
+
# This argument can be repeated many times for multiple functions.
|
126
|
+
# Example: -f path/to/function1 -f path/to/function2
|
127
127
|
-e,--env ENVIRONMENT # ENVIRONMENT is added to the project's name to compose the workspace name.
|
128
|
+
--skip-dependencies # Don't try to install Gems or Shards before creating
|
129
|
+
# the deployment package
|
128
130
|
)
|
129
131
|
end
|
130
132
|
|
@@ -133,6 +135,8 @@ module FaaStRuby
|
|
133
135
|
while @args.any?
|
134
136
|
option = @args.shift
|
135
137
|
case option
|
138
|
+
when '--skip-dependencies'
|
139
|
+
@options['skip_dependencies'] = true
|
136
140
|
when '--skip-create-workspace'
|
137
141
|
@options['skip_create_workspace'] = true
|
138
142
|
when '--function', '-f'
|
data/lib/faastruby/local.rb
CHANGED
@@ -26,12 +26,17 @@ module FaaStRuby
|
|
26
26
|
|
27
27
|
def self.crystal_present_and_supported?
|
28
28
|
debug "self.crystal_present_and_supported?"
|
29
|
-
system("which crystal >/dev/null") &&
|
29
|
+
system("which crystal >/dev/null") && version_match?(SUPPORTED_CRYSTAL, get_crystal_version)
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.ruby_present_and_supported?
|
33
33
|
debug "self.ruby_present_and_supported?"
|
34
|
-
system("which ruby >/dev/null") &&
|
34
|
+
system("which ruby >/dev/null") && version_match?(SUPPORTED_RUBY, RUBY_VERSION)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.version_match?(supported, current)
|
38
|
+
supported.each {|supported_version| return true if Gem::Dependency.new('', supported_version).match?('', current)}
|
39
|
+
return false
|
35
40
|
end
|
36
41
|
|
37
42
|
def self.check_if_logged_in
|
@@ -52,7 +57,7 @@ module FaaStRuby
|
|
52
57
|
RUBY_ENABLED = ruby_present_and_supported?
|
53
58
|
unless RUBY_ENABLED || CRYSTAL_ENABLED
|
54
59
|
puts "\n[ERROR] You need to have one of the following 'language:version' pairs in order to use FaaStRuby Local."
|
55
|
-
puts SUPPORTED_RUNTIMES.join(', ') + "\n"
|
60
|
+
puts SUPPORTED_RUNTIMES.join(', ') + "\n\n"
|
56
61
|
exit 1
|
57
62
|
end
|
58
63
|
SERVER_ROOT = Dir.pwd
|
@@ -62,10 +67,11 @@ module FaaStRuby
|
|
62
67
|
SYNC_ENABLED = ENV['SYNC'] && check_if_logged_in
|
63
68
|
CRYSTAL_VERSION = get_crystal_version.freeze
|
64
69
|
DEFAULT_CRYSTAL_RUNTIME = "crystal:#{CRYSTAL_VERSION}".freeze
|
65
|
-
DEFAULT_RUBY_RUNTIME = "ruby:#{
|
70
|
+
DEFAULT_RUBY_RUNTIME = "ruby:#{CURRENT_MINOR_RUBY}".freeze
|
66
71
|
FUNCTIONS_EVENT_QUEUE = Queue.new
|
67
72
|
PUBLIC_EVENT_QUEUE = Queue.new
|
68
|
-
|
73
|
+
puts "Using '#{DEFAULT_RUBY_RUNTIME}' as default Ruby runtime." if RUBY_ENABLED
|
74
|
+
puts "Using '#{DEFAULT_CRYSTAL_RUNTIME}' as default Crystal runtime." if CRYSTAL_ENABLED
|
69
75
|
def self.workspace
|
70
76
|
debug "self.workspace"
|
71
77
|
return "#{project_config['name']}-#{DEPLOY_ENVIRONMENT}-#{project_config['identifier']}" if project_config['identifier']
|
data/lib/faastruby/server.rb
CHANGED
@@ -9,18 +9,23 @@ module FaaStRuby
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.crystal_present_and_supported?
|
12
|
-
system("which crystal >/dev/null") &&
|
12
|
+
system("which crystal >/dev/null") && version_match?(SUPPORTED_CRYSTAL, get_crystal_version)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.ruby_present_and_supported?
|
16
|
-
system("which ruby >/dev/null") &&
|
16
|
+
system("which ruby >/dev/null") && version_match?(SUPPORTED_RUBY, RUBY_VERSION)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.version_match?(supported, current)
|
20
|
+
supported.each {|supported_version| return true if Gem::Dependency.new('', supported_version).match?('', current)}
|
21
|
+
return false
|
17
22
|
end
|
18
23
|
|
19
24
|
CRYSTAL_ENABLED = crystal_present_and_supported?
|
20
25
|
RUBY_ENABLED = ruby_present_and_supported?
|
21
26
|
unless RUBY_ENABLED || CRYSTAL_ENABLED
|
22
27
|
puts "\n[ERROR] You need to have one of the following language:version pairs in order to use FaaStRuby Local."
|
23
|
-
puts SUPPORTED_RUNTIMES.join(', ') + "\n"
|
28
|
+
puts SUPPORTED_RUNTIMES.join(', ') + "\n\n"
|
24
29
|
exit 1
|
25
30
|
end
|
26
31
|
SERVER_ROOT = Dir.pwd
|
@@ -39,7 +44,7 @@ module FaaStRuby
|
|
39
44
|
CHDIR_MUTEX = Mutex.new
|
40
45
|
CRYSTAL_VERSION = get_crystal_version.freeze
|
41
46
|
DEFAULT_CRYSTAL_RUNTIME = "crystal:#{CRYSTAL_VERSION}".freeze
|
42
|
-
DEFAULT_RUBY_RUNTIME = "ruby:#{
|
47
|
+
DEFAULT_RUBY_RUNTIME = "ruby:#{CURRENT_MINOR_RUBY}".freeze
|
43
48
|
require 'faastruby/server/logger'
|
44
49
|
require 'faastruby/server/project_config'
|
45
50
|
require 'faastruby/server/local'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module FaaStRuby
|
2
2
|
# It is important that they are sorted in version order!
|
3
|
-
SUPPORTED_RUBY = ['2.5.
|
3
|
+
SUPPORTED_RUBY = ['~> 2.5.0', '~> 2.6.0']
|
4
4
|
SUPPORTED_CRYSTAL = ['0.27.0', '0.27.2']
|
5
5
|
CRYSTAL_LATEST = SUPPORTED_CRYSTAL.last
|
6
6
|
RUBY_LATEST = SUPPORTED_RUBY.last
|
7
|
-
SUPPORTED_RUNTIMES =
|
7
|
+
SUPPORTED_RUNTIMES = ['ruby:2.5', 'ruby:2.6'] + SUPPORTED_CRYSTAL.map{|version| "crystal:#{version}"}
|
8
|
+
CURRENT_MINOR_RUBY = RUBY_VERSION.split('.')[0..1].join('.')
|
8
9
|
end
|
data/lib/faastruby/version.rb
CHANGED
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.20
|
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-03-
|
11
|
+
date: 2019-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|