Sha256: b43d91a6e0ee81bcfd277d21829c0925fb0ac83106af53e8373c24cae9ce92ec

Contents?: true

Size: 944 Bytes

Versions: 18

Compression:

Stored size: 944 Bytes

Contents

module FaaStRuby
  module Local
    class RubyFunction < Function
      include Local::Logger

      def self.default_gemfile
        faastruby_rpc_version = Gem::DependencyList.from_specs.select{|d| d.name == 'faastruby-rpc'}[0]&.version || '0.2.3'
        %(source 'https://rubygems.org'

group :test do
  gem 'rspec'
end
)
      end

      def yaml_hash
        debug "yaml_hash"
        hash = {
          'cli_version' => FaaStRuby::VERSION,
          'name' => @name,
          'runtime' => DEFAULT_RUBY_RUNTIME
        }
      end

      def write_handler
        debug "write_handler"
        content = "def handler(event)\n  # Write code here\n  \nend"
        file = "#{@absolute_folder}/handler.rb"
        if File.size(file) > 0
          puts "New Ruby function '#{@name}' detected."
        else
          File.write(file, content)
          puts "New Ruby function '#{@name}' initialized."
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
faastruby-0.5.26 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.25 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.24 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.23 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.22 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.21 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.20 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.19 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.18 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.17 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.16 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.15 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.14 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.13 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.12 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.11 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.10 lib/faastruby/local/functions/ruby.rb
faastruby-0.5.9 lib/faastruby/local/functions/ruby.rb