lib/faastruby/cli/commands/project/deploy.rb in faastruby-0.5.19 vs lib/faastruby/cli/commands/project/deploy.rb in faastruby-0.5.20
- old
+ new
@@ -46,16 +46,16 @@
try_workspace(@workspace, connect_spinner)
@options['functions'].each do |function_path|
jobs << Thread.new do
function_config = YAML.load(File.read("#{function_path}/faastruby.yml"))
function_name = function_config['name']
- msg = function_name == 'public' ? "Uploading static assets in '#{function_name}'" : "Deploying function '#{function_path}'"
+ msg = function_name == 'public' ? "Uploading static assets in '#{function_name}'" : "Deploying function from '#{function_path}'"
spinner = @spinners.register "[:spinner] #{msg}"
spinner.auto_spin
# puts "[#{function_path}] Entering folder '#{function_path}'"
# Dir.chdir function_path
- cmd = "cd #{function_path} && faastruby deploy-to #{@workspace} --quiet --dont-create-workspace"
+ cmd = "cd #{function_path} && faastruby deploy-to #{@workspace} --quiet --dont-create-workspace #{'--skip-dependencies' if @options['skip_dependencies']}"
cmd += " --set-root" if @root_to == function_name
cmd += " --set-catch-all" if @catch_all == function_name
secrets = secrets_for(function_name)
secrets_json = Oj.dump(secrets) if secrets
cmd += " --context '#{secrets_json}'" if secrets_json
@@ -98,11 +98,11 @@
try_to_create = Proc.new {system("faastruby create-workspace #{workspace} > /dev/null 2>&1")}
has_credentials = system("faastruby list-workspace #{workspace} > /dev/null 2>&1")
continue = has_credentials || try_to_create.call
unless continue
connect_spinner.error
- 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 --deploy-env #{@options['environment']}-#{(rand * 100).to_i}")
+ 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}")
end
connect_spinner.success
true
end
@@ -120,20 +120,24 @@
def usage
puts "Usage: faastruby #{self.class.help}"
puts %(
-f,--function FUNCTION_PATH # Specify the path to the function directory in your local machine.
- # This argument can be repeated many times for multiple functions. Example:
- # -f path/to/function1 -f path/to/function2
+ # This argument can be repeated many times for multiple functions.
+ # Example: -f path/to/function1 -f path/to/function2
-e,--env ENVIRONMENT # ENVIRONMENT is added to the project's name to compose the workspace name.
+--skip-dependencies # Don't try to install Gems or Shards before creating
+ # the deployment package
)
end
def parse_options
@options = {'functions' => []}
while @args.any?
option = @args.shift
case option
+ when '--skip-dependencies'
+ @options['skip_dependencies'] = true
when '--skip-create-workspace'
@options['skip_create_workspace'] = true
when '--function', '-f'
@options['functions'] << @args.shift
when '--env', '-e'