Class: Zeno::Solution

Inherits:
Object
  • Object
show all
Defined in:
lib/zeno/solution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Solution

Returns a new instance of Solution.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/zeno/solution.rb', line 32

def initialize(opts)
  @name = opts['name']
  @basepath = opts['path']
  @ref = opts['ref']
  @libs = opts['libs']
  @path = "#{@basepath}/#{@name}"
  @apps = opts['apps']
  @target = opts['target']
  @uploader = opts['uploader']

  raise Zeno::ApplicationAlreadyExistsError if File.directory? @path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/zeno/solution.rb', line 21

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



21
22
23
# File 'lib/zeno/solution.rb', line 21

def path
  @path
end

Instance Method Details

#createObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/zeno/solution.rb', line 45

def create
  FileUtils.mkdir_p @path unless File.directory? @path
  Dir.chdir @path

  version = Zeno.parse_target(@ref)
  etaos_path = "etaos-#{version}"
  Zeno.download(Dir.pwd, @ref)

  # Create applications
  @apps.each do |app|
    application = Zeno::Application.new(app, etaos_path, @libs, @target, @uploader)
    application.create
    application.generate
  end
end