Class: FaaStRuby::Command::Function::FunctionBaseCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/faastruby/cli/commands/function/base_command.rb

Direct Known Subclasses

Build, DeployTo, New, RemoveFrom, Run, Test, UpdateContext

Instance Method Summary collapse

Methods inherited from BaseCommand

#has_user_logged_in?, #help, #load_credentials, #say, spin, #spin, #write_file

Instance Method Details

#load_yamlObject

— Example YAML name: example test:

command: "rspec"
on_fail:
  build: false
  deploy: false


13
14
15
16
17
18
# File 'lib/faastruby/cli/commands/function/base_command.rb', line 13

def load_yaml
  FaaStRuby::CLI.error("It looks like you created this function with an old version of faastruby. Please run 'faastruby upgrade'.") if File.file?('handler.rb') && !File.file?('faastruby.yml')
  FaaStRuby::CLI.error("Could not find file 'faastruby.yml' in the current directory") if !File.file?('faastruby.yml') && @options['function_name'].nil?
  @yaml_config = YAML.load(File.read('./faastruby.yml'))
  FaaStRuby::CLI.error("Could read function name from 'faastruby.yml'. Make sure you have a key 'name: FUNCTION_NAME' in that file!") unless @yaml_config['name']
end