faastruby 0.5.15 → 0.5.16
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 +9 -0
- data/Gemfile.lock +1 -1
- data/lib/faastruby/cli/commands/account/signup.rb +3 -3
- data/lib/faastruby/cli/commands/function/deploy_to.rb +10 -4
- data/lib/faastruby/cli/commands/function/run.rb +10 -9
- data/lib/faastruby/cli/commands/function/update_context.rb +6 -2
- data/lib/faastruby/cli/commands/help.rb +24 -16
- data/lib/faastruby/cli/commands/project/deploy.rb +2 -2
- data/lib/faastruby/cli/commands/project/down.rb +10 -3
- data/lib/faastruby/cli/commands/project/new.rb +45 -45
- data/lib/faastruby/cli/commands/workspace/create.rb +1 -2
- data/lib/faastruby/cli/commands/workspace/update.rb +5 -1
- data/lib/faastruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c2140df8e1c0f5ab07372b83c80d26e7395b64a02d8e722b50e7acdfaa4a8a8
|
4
|
+
data.tar.gz: 73e3b0a89b4dea4393a09fc33ffec3fcadbdbfce2069ccc3cdb60d7e96ab064e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5d46a540b29c8d43f15e939a455a7046caf501756eb3187e85116296b7dcc8ca96c3d8a6acb7f12fad506ad120d530845b5090651fa1896d822bc58fa2543c8
|
7
|
+
data.tar.gz: aca215d48d18df5ba9609205a90a849ce0dd6ebb247f4210f6885831691b3271dca813baa9e2a67be0e4cef18b5ede29909c5361ba97de3b904313985e9b4f17
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.16 - unreleased
|
4
|
+
- Remove unused arguments from update workspace `run` method.
|
5
|
+
- Update Help
|
6
|
+
- Change the argument that measures the execution time on `run` to `--measure`
|
7
|
+
- Add argument to read context from STDIN when running `deploy-to`
|
8
|
+
- Switch default config files method from array to multiline string
|
9
|
+
- Allow passwords with up to 50 characters.
|
10
|
+
- Fix bug preventing `faastruby deploy` to deploy the secrets.
|
11
|
+
|
3
12
|
## 0.5.15 - Mar 18 2019
|
4
13
|
- Remove `nil` entries from error array before trying to print error messages
|
5
14
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
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,
|
4
|
+
PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,50}$/
|
5
5
|
EMAIL_REGEX = /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
|
6
6
|
require 'faastruby/cli/commands/account/base_command'
|
7
7
|
require 'io/console'
|
@@ -21,11 +21,11 @@ module FaaStRuby
|
|
21
21
|
print "Email: "
|
22
22
|
email = STDIN.gets.chomp
|
23
23
|
end
|
24
|
-
puts "\nNow type in a password. It must contain 8 to
|
24
|
+
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 @ $ ! % * ? &"
|
25
25
|
print "Password: "
|
26
26
|
password = STDIN.noecho(&:gets).chomp
|
27
27
|
until password_is_valid?(password) do
|
28
|
-
puts "\nYour password must contain 8 to
|
28
|
+
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
|
29
29
|
print "Password: "
|
30
30
|
password = STDIN.noecho(&:gets).chomp
|
31
31
|
end
|
@@ -90,10 +90,14 @@ module FaaStRuby
|
|
90
90
|
puts "\nUsage: faastruby #{self.class.help}"
|
91
91
|
puts %(
|
92
92
|
-f,--function PATH/TO/FUNCTION # Specify the directory where the function is.
|
93
|
-
--context
|
94
|
-
# accessible via 'event.context'
|
95
|
-
|
96
|
-
|
93
|
+
--context 'JSON_STRING' # The data to be stored as execution context
|
94
|
+
# in the cloud, accessible via 'event.context'
|
95
|
+
# from within your function.
|
96
|
+
# The context data must be a JSON String, and
|
97
|
+
# have maximum size of 4KB.
|
98
|
+
--context-from-stdin # Read context data from STDIN.
|
99
|
+
--set-root # Set the function as the root route for the workspace.
|
100
|
+
--set-catch-all # Set the function as the catch-all route for the workspace.
|
97
101
|
--dont-create-workspace # Don't try to create the workspace if it doesn't exist.
|
98
102
|
)
|
99
103
|
end
|
@@ -171,6 +175,8 @@ module FaaStRuby
|
|
171
175
|
Dir.chdir @args.shift
|
172
176
|
when '--context'
|
173
177
|
@options['context'] = @args.shift
|
178
|
+
when '--context-from-stdin'
|
179
|
+
@options['context'] = STDIN.gets.chomp
|
174
180
|
when '--quiet', '-q'
|
175
181
|
@options['quiet'] = true
|
176
182
|
when '--set-root'
|
@@ -39,15 +39,15 @@ module FaaStRuby
|
|
39
39
|
def usage
|
40
40
|
puts "\nUsage: faastruby #{self.class.help}"
|
41
41
|
puts %(
|
42
|
-
-b,--body 'DATA' # The request body
|
43
|
-
--stdin # Read the request body from STDIN
|
44
|
-
-m,--method METHOD # The request method
|
42
|
+
-b,--body 'DATA' # The request body.
|
43
|
+
--stdin # Read the request body from STDIN.
|
44
|
+
-m,--method METHOD # The request method.
|
45
45
|
-h,--header 'Header: Value' # Set a header. Can be used multiple times.
|
46
|
-
-f,--form 'a=1&b=2' # Send form data and set header 'Content-Type: application/x-www-form-urlencoded'
|
47
|
-
-j,--json '{"a":"1"}' # Send JSON data and set header 'Content-Type: application/json'
|
48
|
-
|
46
|
+
-f,--form 'a=1&b=2' # Send form data and set header 'Content-Type: application/x-www-form-urlencoded'.
|
47
|
+
-j,--json '{"a":"1"}' # Send JSON data and set header 'Content-Type: application/json'.
|
48
|
+
--measure # Return function execution time in the response headers.
|
49
49
|
-q,--query 'foo=bar' # Set a query parameter for the request. Can be used multiple times.
|
50
|
-
--curl #
|
50
|
+
--curl # Print the equivalent CURL command for the request and exit.
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
@@ -69,8 +69,9 @@ module FaaStRuby
|
|
69
69
|
@options['method'] = @args.shift.downcase
|
70
70
|
when '-h', '--header'
|
71
71
|
set_header
|
72
|
-
when '
|
73
|
-
@options['
|
72
|
+
when '--measure'
|
73
|
+
@options['headers'] ||= {}
|
74
|
+
@options['headers']['Benchmark'] = true
|
74
75
|
when '--curl'
|
75
76
|
@options['curl'] = true
|
76
77
|
when '-q', '--query'
|
@@ -35,8 +35,12 @@ module FaaStRuby
|
|
35
35
|
def usage
|
36
36
|
puts "\nUsage: faastruby #{self.class.help}"
|
37
37
|
puts %(
|
38
|
-
-d, --data '
|
39
|
-
|
38
|
+
-d, --data JSON_STRING' # The data to be stored as execution context
|
39
|
+
# in the cloud, accessible via 'event.context'
|
40
|
+
# from within your function.
|
41
|
+
# The context data must be a JSON String, and
|
42
|
+
# have maximum size of 4KB.
|
43
|
+
--stdin # Read context data from STDIN
|
40
44
|
)
|
41
45
|
end
|
42
46
|
|
@@ -7,19 +7,22 @@ module FaaStRuby
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
|
-
puts "faastRuby CLI - Manage workspaces and functions hosted at faastruby.io"
|
11
|
-
puts "Version: #{FaaStRuby::VERSION}"
|
12
|
-
puts
|
13
|
-
puts "Usage: faastruby [update] [OPTIONS] COMMAND [--help | -h] [ARGS]"
|
14
|
-
puts
|
15
|
-
puts "To update to the latest version, run: faastruby update"
|
16
|
-
puts
|
17
|
-
puts "OPTIONS:"
|
18
|
-
puts 'help, -h, --help # Displays this help'
|
19
|
-
puts '-v # Print version and exit'
|
20
|
-
puts '--region tor1 # Specify a region. "tor1" (default) is the only region available'
|
21
|
-
puts "\nCOMMANDS:"
|
22
10
|
puts %(
|
11
|
+
faastRuby CLI - Manage workspaces and functions hosted at faastruby.io
|
12
|
+
Version: #{FaaStRuby::VERSION}
|
13
|
+
|
14
|
+
Usage: faastruby [update] [OPTIONS] COMMAND [--help | -h] [ARGS]
|
15
|
+
|
16
|
+
To update to the latest version, run: faastruby update
|
17
|
+
|
18
|
+
OPTIONS:
|
19
|
+
help, -h, --help # Displays this help
|
20
|
+
-v # Print version and exit
|
21
|
+
--region tor1 # Specify a region. "tor1" (default) is the only
|
22
|
+
# region available at this time
|
23
|
+
|
24
|
+
COMMANDS:
|
25
|
+
|
23
26
|
Accounts:
|
24
27
|
signup
|
25
28
|
confirm-account # Send a token over email for account confirmation
|
@@ -27,7 +30,7 @@ Accounts:
|
|
27
30
|
logout
|
28
31
|
|
29
32
|
Functions:
|
30
|
-
new # Initialize a
|
33
|
+
new # Initialize a directory with a function template
|
31
34
|
deploy-to # Deploy a function to a cloud workspace
|
32
35
|
remove-from # Remove a function from a cloud workspace
|
33
36
|
run # Trigger the function via HTTP endpoint
|
@@ -36,17 +39,22 @@ Functions:
|
|
36
39
|
Projects:
|
37
40
|
new-project # Initialize a project in your local machine
|
38
41
|
deploy # Deploy all functions and static files of a project
|
42
|
+
down # Remove a workspace from the cloud. Must be executed
|
43
|
+
# from within a project directory.
|
39
44
|
|
40
45
|
Workspaces:
|
41
46
|
create-workspace # Create a cloud workspace
|
42
|
-
destroy-workspace #
|
47
|
+
destroy-workspace # Remove a workspace and all its functions
|
48
|
+
# from the cloud. Can't be undone.
|
43
49
|
list-workspace # List what's in a cloud workspace
|
44
|
-
cp # Copy a static file from your local machine to
|
50
|
+
cp # Copy a static file from your local machine to
|
51
|
+
# a cloud workspace
|
45
52
|
rm # Remove a static file from a cloud workspace
|
46
53
|
update-workspace # Update workspace settings
|
47
54
|
|
55
|
+
Run faastruby COMMAND --help for more details.
|
56
|
+
|
48
57
|
)
|
49
|
-
puts "Run faastruby COMMAND --help for more details."
|
50
58
|
end
|
51
59
|
end
|
52
60
|
end
|
@@ -18,7 +18,7 @@ module FaaStRuby
|
|
18
18
|
@options['functions'] += find_functions unless @options['functions'].any?
|
19
19
|
@options['environment'] ||= 'stage'
|
20
20
|
@project_yaml = YAML.load(File.read(PROJECT_YAML_FILE))['project'] rescue FaaStRuby::CLI.error("Could not find file 'project.yml'. Are you running this command from the project's folder?")
|
21
|
-
@project_secrets = YAML.load(File.read(PROJECT_SECRETS_FILE)) rescue {secrets: {}}
|
21
|
+
@project_secrets = YAML.load(File.read(PROJECT_SECRETS_FILE))['secrets'] rescue {secrets: {}}
|
22
22
|
@project_name = @project_yaml['name']
|
23
23
|
@root_to = @project_yaml['root_to'] || 'root'
|
24
24
|
@catch_all = @project_yaml['catch_all'] || 'catch-all'
|
@@ -124,7 +124,7 @@ module FaaStRuby
|
|
124
124
|
-f,--function FUNCTION_PATH # Specify the path to the function directory in your local machine.
|
125
125
|
# This argument can be repeated many times for multiple functions. Example:
|
126
126
|
# -f path/to/function1 -f path/to/function2
|
127
|
-
-e,--env ENVIRONMENT # ENVIRONMENT is added to the project name to compose the workspace name.
|
127
|
+
-e,--env ENVIRONMENT # ENVIRONMENT is added to the project's name to compose the workspace name.
|
128
128
|
)
|
129
129
|
end
|
130
130
|
|
@@ -31,10 +31,17 @@ module FaaStRuby
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def usage
|
34
|
-
puts "Usage: faastruby #{self.class.help}"
|
35
34
|
puts %(
|
36
|
-
|
37
|
-
|
35
|
+
|
36
|
+
Remove a workspace from the cloud.
|
37
|
+
Must be executed from within a project's directory.
|
38
|
+
|
39
|
+
Usage: faastruby #{self.class.help}
|
40
|
+
|
41
|
+
-e,--env ENVIRONMENT # ENVIRONMENT is added to the project's name to compose the workspace name.
|
42
|
+
# Defaults to 'stage'
|
43
|
+
|
44
|
+
)
|
38
45
|
end
|
39
46
|
|
40
47
|
def parse_options
|
@@ -121,54 +121,54 @@ module FaaStRuby
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def default_secrets_file
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
].join("\n")
|
124
|
+
%(secrets:
|
125
|
+
# Add secrets here and they will be available inside the function as "event.context"
|
126
|
+
# Example:
|
127
|
+
# prod:
|
128
|
+
# root:
|
129
|
+
# a_secret: bfe76f4557ffc2de901cb24e0f87436f
|
130
|
+
# another/function:
|
131
|
+
# another_secret: 4d1c281e.619a2489c.8b5d.dd945616d324
|
132
|
+
|
133
|
+
# 'stage' is the default environment when you start Local
|
134
|
+
# stage:
|
135
|
+
# root:
|
136
|
+
# a_secret: bfe76f4557ffc2de901cb24e0f87436f
|
137
|
+
# another/function:
|
138
|
+
# another_secret: 4d1c281e.619a2489c.8b5d.dd945616d324
|
139
|
+
)
|
141
140
|
end
|
142
141
|
|
143
142
|
def default_project_file
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
143
|
+
%(project:
|
144
|
+
# The project name
|
145
|
+
name: #{@project_name}
|
146
|
+
|
147
|
+
# The project identifier is used to ensure your workspaces will have unique names.
|
148
|
+
# This is not a secret, but don't lose it!
|
149
|
+
identifier: #{Digest::MD5.hexdigest(Time.now.to_s).slice(0..5)}
|
150
|
+
|
151
|
+
## The 'public' directory is where you put static files.
|
152
|
+
## Files will be served from there first, meaning that if
|
153
|
+
## you have a function at 'functions/product' and a folder
|
154
|
+
## 'public/product', the public one will take precedence.
|
155
|
+
## Defaults to 'public'.
|
156
|
+
# public_dir: public
|
157
|
+
|
158
|
+
## The name of the folder containing the project's functions.
|
159
|
+
## Defaults to 'functions'.
|
160
|
+
# functions_dir: functions
|
161
|
+
|
162
|
+
## The name of the function that will respond to requests made
|
163
|
+
## to '/'. Defaults to 'root'
|
164
|
+
# root_to: root
|
165
|
+
|
166
|
+
## The setting 'catch_all' allows you to capture requests to
|
167
|
+
## non-existing functions and send them to another function.
|
168
|
+
## This is useful for setting custom 404 pages, for example.
|
169
|
+
## Defaults to 'catch-all'.
|
170
|
+
# catch_all: catch-all
|
171
|
+
)
|
172
172
|
end
|
173
173
|
|
174
174
|
def tmuxinator_config
|
@@ -39,8 +39,7 @@ module FaaStRuby
|
|
39
39
|
def usage
|
40
40
|
puts "\nUsage: faastruby #{self.class.help}"
|
41
41
|
puts %(
|
42
|
-
--create-local-dir # Create a local
|
43
|
-
--local-only # Only create a local folder. Skip creating workspace on the cloud
|
42
|
+
--create-local-dir # Create a local directory with the workspace name.
|
44
43
|
)
|
45
44
|
end
|
46
45
|
|
@@ -14,7 +14,7 @@ module FaaStRuby
|
|
14
14
|
load_credentials
|
15
15
|
end
|
16
16
|
|
17
|
-
def run
|
17
|
+
def run
|
18
18
|
spinner = spin("Updating the number of runners to #{@options['runners_max']}...")
|
19
19
|
workspace = FaaStRuby::Workspace.new(name: @workspace_name)
|
20
20
|
workspace.update_runners(@options['runners_max'])
|
@@ -30,6 +30,10 @@ module FaaStRuby
|
|
30
30
|
puts "\nUsage: faastruby #{self.class.help}"
|
31
31
|
puts %(
|
32
32
|
--runners N # Assign N runners to the workspace.
|
33
|
+
# N must be an integer between 0 and 100.
|
34
|
+
# When set to 0, requests to any functions
|
35
|
+
# whithin the workspace will return HTTP error
|
36
|
+
# 429 - Too Many Requests.
|
33
37
|
)
|
34
38
|
end
|
35
39
|
|
data/lib/faastruby/version.rb
CHANGED