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 @options = [] end |
Instance Method Details
#autogen ⇒ Object
56 57 58 |
# File 'lib/evm/builder.rb', line 56 def autogen run_command './autogen.sh' end |
#build_path ⇒ Object
72 73 74 |
# File 'lib/evm/builder.rb', line 72 def build_path builds_path.join(@name) end |
#builds_path ⇒ Object
68 69 70 |
# File 'lib/evm/builder.rb', line 68 def builds_path Evm.local.join('tmp') end |
#configure ⇒ Object
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_path ⇒ Object
80 81 82 |
# File 'lib/evm/builder.rb', line 80 def installation_path installations_path.join(@name) end |
#installations_path ⇒ Object
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_name ⇒ Object
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| .set(progress) end .done tar_file = Evm::TarFile.new(tar_file_path) tar_file.extract(builds_path) end |