Sha256: 932eb9545f0d45fab24af0c13fbf3f342ab1120d3b45ef5b49737406e4c9323b

Contents?: true

Size: 947 Bytes

Versions: 30

Compression:

Stored size: 947 Bytes

Contents

require 'ostruct'
module FaaStRuby
  module Command
    module Function
      class FunctionBaseCommand < BaseCommand
        # --- Example YAML
        # name: example
        # test:
        #   command: "rspec"
        #   on_fail:
        #     build: false
        #     deploy: false
        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
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
faastruby-0.5.10 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.9 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.8 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.7 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.6 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.5 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.4 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.3 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.2 lib/faastruby/cli/commands/function/base_command.rb
faastruby-0.5.0 lib/faastruby/cli/commands/function/base_command.rb