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



58
59
60
# File 'lib/evm/builder.rb', line 58

def autogen
  run_command './autogen.sh'
end

#build_pathObject



74
75
76
# File 'lib/evm/builder.rb', line 74

def build_path
  File.join(builds_path, @name)
end

#builds_pathObject



70
71
72
# File 'lib/evm/builder.rb', line 70

def builds_path
  File.join(Evm::LOCAL_PATH, 'tmp')
end

#configureObject



62
63
64
# File 'lib/evm/builder.rb', line 62

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

#copy(from, to) ⇒ Object



90
91
92
# File 'lib/evm/builder.rb', line 90

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



54
55
56
# File 'lib/evm/builder.rb', line 54

def install(&block)
  yield
end

#installation_pathObject



82
83
84
# File 'lib/evm/builder.rb', line 82

def installation_path
  File.join(installations_path, @name)
end

#installations_pathObject



78
79
80
# File 'lib/evm/builder.rb', line 78

def installations_path
  Evm::LOCAL_PATH
end

#linux(&block) ⇒ Object



45
46
47
# File 'lib/evm/builder.rb', line 45

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

#make(target) ⇒ Object



66
67
68
# File 'lib/evm/builder.rb', line 66

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

#option(name, value = nil) ⇒ Object



49
50
51
52
# File 'lib/evm/builder.rb', line 49

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

#osx(&block) ⇒ Object



41
42
43
# File 'lib/evm/builder.rb', line 41

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

#platform_nameObject



86
87
88
# File 'lib/evm/builder.rb', line 86

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
38
39
# File 'lib/evm/builder.rb', line 26

def tar_gz(url)
  tar_file_path = File.join(builds_path, @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

  FileUtils.mkdir(build_path)

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