Class: Lambchop::Client
- Inherits:
-
Object
- Object
- Lambchop::Client
- Defined in:
- lib/lambchop/client.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, path, options = {}) ⇒ Client
constructor
A new instance of Client.
- #start ⇒ Object
Constructor Details
#initialize(source, path, options = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 |
# File 'lib/lambchop/client.rb', line 6 def initialize(source, path, = {}) @source = source @path = path @client = [:client] || Aws::Lambda::Client.new @options = end |
Class Method Details
.start(source, path, options = {}) ⇒ Object
2 3 4 |
# File 'lib/lambchop/client.rb', line 2 def self.start(source, path, = {}) self.new(source, path, ).start end |
Instance Method Details
#start ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lambchop/client.rb', line 13 def start src = @source if @options[:use_erb] src = ERB.new(src, nil, '-').result end src = Lambchop::Utils.remove_shebang(src) config, src = Lambchop::Utils.parse_magic_comment(src) config['function_name'] ||= File.basename(@path, '.js') config['runtime'] ||= 'nodejs' function_name = config['function_name'] include_files = config.delete('include_files') create_or_update_function(config, src, include_files) exit if @options[:detach] trap(:INT) { exit } unless Lambchop::Utils.debug? Lambchop::WatchDog.start(function_name, @options[:watch_dog] || {}) sleep end |