Class: CORL::Builder::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/CORL/builder/project.rb

Instance Method Summary collapse

Instance Method Details

#build_provider(provider_path, project_reference, environment, options = {}) ⇒ Object


Project interface operations



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/CORL/builder/project.rb', line 9

def build_provider(provider_path, project_reference, environment, options = {})
  config  = Config.ensure(options)
  path    = provider_path.to_s
  success = true

  info("Building project #{purple(project_reference)} into #{green(path)}", { :i18n => false })

  full_directory = File.join(network.directory, path)
  FileUtils.rm_rf(full_directory) if config.get(:clean, false)

  project = build_config.manage(:project, extended_config(:project, {
    :directory     => full_directory,
    :url           => project_reference,
    :create        => File.directory?(full_directory) ? false : true,
    :pull          => true,
    :internal_ip   => CORL.public_ip, # Needed for seeding Vagrant VMs
    :manage_ignore => false,
    :nucleon_file  => false
  }))
  unless project
    warn("Project #{cyan(path)} failed to initialize", { :i18n => false })
    success = false
  end
  if success
    #success("Build of project #{blue(path)} finished", { :i18n => false })
    network.ignore(path)
  end
  success
end