Class: Evm::Builder::Dsl
- Inherits:
-
Object
- Object
- Evm::Builder::Dsl
- Defined in:
- lib/evm/builder.rb
Instance Method Summary collapse
- #autogen ⇒ Object
- #build_path ⇒ Object
- #builds_path ⇒ Object
- #configure ⇒ Object
- #copy(from, to) ⇒ Object
- #git(url) ⇒ Object
-
#initialize ⇒ Dsl
constructor
A new instance of Dsl.
- #install(&block) ⇒ Object
- #installation_path ⇒ Object
- #installations_path ⇒ Object
- #linux(&block) ⇒ Object
- #make(target) ⇒ Object
- #option(name, value = nil) ⇒ Object
- #osx(&block) ⇒ Object
- #platform_name ⇒ Object
- #recipe(name, &block) ⇒ Object
- #tar_gz(url) ⇒ Object
Constructor Details
#initialize ⇒ Dsl
Returns a new instance of Dsl.
7 8 9 |
# File 'lib/evm/builder.rb', line 7 def initialize = [] end |
Instance Method Details
#autogen ⇒ Object
58 59 60 |
# File 'lib/evm/builder.rb', line 58 def autogen run_command './autogen.sh' end |
#build_path ⇒ Object
74 75 76 |
# File 'lib/evm/builder.rb', line 74 def build_path File.join(builds_path, @name) end |
#builds_path ⇒ Object
70 71 72 |
# File 'lib/evm/builder.rb', line 70 def builds_path File.join(Evm::LOCAL_PATH, 'tmp') end |
#configure ⇒ Object
62 63 64 |
# File 'lib/evm/builder.rb', line 62 def configure run_command './configure', * 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_path ⇒ Object
82 83 84 |
# File 'lib/evm/builder.rb', line 82 def installation_path File.join(installations_path, @name) end |
#installations_path ⇒ Object
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) << name << 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_name ⇒ Object
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| .set(progress) end .done FileUtils.mkdir(build_path) tar_file = Evm::TarFile.new(tar_file_path) tar_file.extract(builds_path, @name) end |