Class: Evm::Builder::Dsl

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

Instance Method Summary collapse

Constructor Details

#initializeDsl

Returns a new instance of Dsl.



7
8
9
# File 'lib/evm/builder.rb', line 7

def initialize
  @options = []
end

Instance Method Details

#autogenObject



56
57
58
# File 'lib/evm/builder.rb', line 56

def autogen
  run_command './autogen.sh'
end

#build_pathObject



72
73
74
# File 'lib/evm/builder.rb', line 72

def build_path
  builds_path.join(@name)
end

#builds_pathObject



68
69
70
# File 'lib/evm/builder.rb', line 68

def builds_path
  Evm.local.join('tmp')
end

#configureObject



60
61
62
# File 'lib/evm/builder.rb', line 60

def configure
  run_command './configure', *@options
end

#copy(from, to) ⇒ Object



88
89
90
# File 'lib/evm/builder.rb', line 88

def copy(from, to)
  FileUtils.cp_r(from, to)
end

#git(url) ⇒ Object



17
18
19
20
21
22
23
24
# 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(&block) ⇒ Object



52
53
54
# File 'lib/evm/builder.rb', line 52

def install(&block)
  yield
end

#installation_pathObject



80
81
82
# File 'lib/evm/builder.rb', line 80

def installation_path
  installations_path.join(@name)
end

#installations_pathObject



76
77
78
# File 'lib/evm/builder.rb', line 76

def installations_path
  Evm.local
end

#linux(&block) ⇒ Object



43
44
45
# File 'lib/evm/builder.rb', line 43

def linux(&block)
  yield if Evm::Os.linux?
end

#make(target) ⇒ Object



64
65
66
# File 'lib/evm/builder.rb', line 64

def make(target)
  run_command 'make', target
end

#option(name, value = nil) ⇒ Object



47
48
49
50
# File 'lib/evm/builder.rb', line 47

def option(name, value = nil)
  @options << name
  @options << value if value
end

#osx(&block) ⇒ Object



39
40
41
# File 'lib/evm/builder.rb', line 39

def osx(&block)
  yield if Evm::Os.osx?
end

#platform_nameObject



84
85
86
# File 'lib/evm/builder.rb', line 84

def platform_name
  Evm::Os.platform_name
end

#recipe(name, &block) ⇒ Object



11
12
13
14
15
# File 'lib/evm/builder.rb', line 11

def recipe(name, &block)
  @name = name

  yield
end

#tar_gz(url) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/evm/builder.rb', line 26

def tar_gz(url)
  tar_file_path = builds_path.join(@name + '.tar.gz')

  remote_file = Evm::RemoteFile.new(url)
  remote_file.download(tar_file_path) do |progress|
    progress_bar.set(progress)
  end
  progress_bar.done

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