Class: RubyLambda::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_lambda/build.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_directory, options = {"native_extensions"=>false, 'file_name' => ''}) ⇒ Build

Returns a new instance of Build.



3
4
5
6
7
# File 'lib/ruby_lambda/build.rb', line 3

def initialize(current_directory, options = {"native_extensions"=>false, 'file_name' => ''})
  @current_directory  = current_directory
  @shell = Thor::Base.shell.new
  @options = options
end

Instance Method Details

#run(mute: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_lambda/build.rb', line 9

def run(mute: false)
  @mute = mute

  if @options['native_extensions']
    unless which('docker')
      @shell.say 'Can not find docker, you need to install docker if you want to build with native extensions', :red
      return
    end

    setup_gems_with_native_extensions
  else
    setup_gems
  end

  @shell.say('Setting up files to build', :yellow) unless @mute
  FileUtils.mkdir_p "#{@current_directory}/builds"

  @output_file = "#{@current_directory}/#{generate_build_name}"

  @shell.say('Adding files to zip', :yellow) unless @mute
  write
end