Class: EasyInstaller::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_installer/install.rb

Defined Under Namespace

Classes: RunInstall

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Installer

Returns a new instance of Installer.



8
9
10
# File 'lib/easy_installer/install.rb', line 8

def initialize(config)
  @config = config
end

Instance Method Details

#install(inputs = {}) ⇒ Object

Runs code in temporary directory

  • Args :

    • inputs -> Hash of inputs

  • Returns :

    • EasyInstaller::Sandbox



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/easy_installer/install.rb', line 17

def install(inputs = {})
  require "easy_installer/methods/#{@config.method}/install_helper"
    create_and_go_to_temp
    evaluate = Sandbox.new(@config.install_code(@config.method), inputs)
    evaluate.helpers << InstallHelper::ZipFile
    evaluate.helpers << InstallHelper
  evaluate.modules << EasyInstaller::Sandbox::Message
    result = evaluate.eval
    unless result
    raise evaluate.returned
  end
  @success = true 
  clear_temp
  
    evaluate
end

#returnedObject



34
35
36
# File 'lib/easy_installer/install.rb', line 34

def returned
  @returned
end

#success?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/easy_installer/install.rb', line 38

def success?
  @success
end