class Evm::Builder::Dsl

Public Class Methods

new() click to toggle source
# File lib/evm/builder.rb, line 7
def initialize
  @options = []
end

Public Instance Methods

autogen() click to toggle source
# File lib/evm/builder.rb, line 51
def autogen
  run_command './autogen.sh'
end
build_path() click to toggle source
# File lib/evm/builder.rb, line 67
def build_path
  File.join(builds_path, @name)
end
builds_path() click to toggle source
# File lib/evm/builder.rb, line 63
def builds_path
  File.join(Evm.config[:path], 'tmp')
end
configure() click to toggle source
# File lib/evm/builder.rb, line 55
def configure
  run_command './configure', *@options
end
copy(from, to) click to toggle source
# File lib/evm/builder.rb, line 83
def copy(from, to)
  run_command "cp -a #{from} #{to}"
end
git(url) click to toggle source
# File lib/evm/builder.rb, line 17
def git(url)
  git_repo = Evm::Git.new(build_path)
  if git_repo.exist?
    git_repo.pull
  else
    git_repo.clone(url)
  end
end
install() { || ... } click to toggle source
# File lib/evm/builder.rb, line 47
def install(&block)
  yield
end
installation_path() click to toggle source
# File lib/evm/builder.rb, line 75
def installation_path
  File.join(installations_path, @name)
end
installations_path() click to toggle source
# File lib/evm/builder.rb, line 71
def installations_path
  Evm.config[:path]
end
linux() { || ... } click to toggle source
# File lib/evm/builder.rb, line 38
def linux(&block)
  yield if Evm::Os.linux?
end
make(target) click to toggle source
# File lib/evm/builder.rb, line 59
def make(target)
  run_command 'make', target
end
option(name, value = nil) click to toggle source
# File lib/evm/builder.rb, line 42
def option(name, value = nil)
  @options << name
  @options << value if value
end
osx() { || ... } click to toggle source
# File lib/evm/builder.rb, line 34
def osx(&block)
  yield if Evm::Os.osx?
end
platform_name() click to toggle source
# File lib/evm/builder.rb, line 79
def platform_name
  Evm::Os.platform_name
end
recipe(name) { || ... } click to toggle source
# File lib/evm/builder.rb, line 11
def recipe(name, &block)
  @name = name

  yield
end
tar_gz(url) click to toggle source
# File lib/evm/builder.rb, line 30
def tar_gz(url)
  tar_packaged(url, 'gz')
end
tar_xz(url) click to toggle source
# File lib/evm/builder.rb, line 26
def tar_xz(url)
  tar_packaged(url, 'xz')
end

Private Instance Methods

run_command(command, *args) click to toggle source
# File lib/evm/builder.rb, line 101
def run_command(command, *args)
  Dir.chdir(build_path) do
    system = Evm::System.new(command)
    system.run(*args)
  end
end
tar_packaged(url,extension) click to toggle source
# File lib/evm/builder.rb, line 89
def tar_packaged(url,extension)
  tar_file_path = File.join(builds_path, @name + '.tar.' + extension)

  remote_file = Evm::RemoteFile.new(url)
  remote_file.download(tar_file_path)

  FileUtils.mkdir(build_path)

  tar_file = Evm::TarFile.new(tar_file_path)
  tar_file.extract(builds_path, @name)
end