Class: Emplace::Project
- Inherits:
-
Object
- Object
- Emplace::Project
- Defined in:
- lib/emplace.rb
Instance Method Summary collapse
- #build! ⇒ Object
- #build_dir ⇒ Object
- #clean! ⇒ Object
- #cmake! ⇒ Object
- #dist_dir ⇒ Object
- #extract! ⇒ Object
- #fetch!(url) ⇒ Object
-
#initialize(name, impl = Emplace.load_env) ⇒ Project
constructor
A new instance of Project.
- #module_dir ⇒ Object
- #package! ⇒ Object
- #test! ⇒ Object
- #vendor_dir ⇒ Object
Constructor Details
#initialize(name, impl = Emplace.load_env) ⇒ Project
Returns a new instance of Project.
6 7 8 9 |
# File 'lib/emplace.rb', line 6 def initialize(name, impl = Emplace.load_env) @name = name @impl = impl end |
Instance Method Details
#build! ⇒ Object
30 31 32 |
# File 'lib/emplace.rb', line 30 def build! @impl.build build_dir end |
#build_dir ⇒ Object
13 14 15 |
# File 'lib/emplace.rb', line 13 def build_dir 'build' end |
#clean! ⇒ Object
22 23 24 25 26 |
# File 'lib/emplace.rb', line 22 def clean! FileUtils.rm_rf build_dir FileUtils.rm_rf dist_dir FileUtils.rm_rf vendor_dir end |
#cmake! ⇒ Object
27 28 29 |
# File 'lib/emplace.rb', line 27 def cmake! @impl.cmake @name, module_dir, build_dir, dist_dir end |
#dist_dir ⇒ Object
16 17 18 |
# File 'lib/emplace.rb', line 16 def dist_dir 'dist' end |
#extract! ⇒ Object
39 40 41 |
# File 'lib/emplace.rb', line 39 def extract! @impl.extract @name, vendor_dir end |
#fetch!(url) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/emplace.rb', line 42 def fetch!(url) package = @impl.package_name(@name) IO.popen(['curl', '-fsSL', File.join(url, package)]) {|source| @impl.write_file(package, vendor_dir) {|dest| IO.copy_stream(source, dest) } } end |
#module_dir ⇒ Object
10 11 12 |
# File 'lib/emplace.rb', line 10 def module_dir File.join(File.dirname(File.dirname(__FILE__)), 'modules') end |
#package! ⇒ Object
36 37 38 |
# File 'lib/emplace.rb', line 36 def package! @impl.package @name, dist_dir end |
#test! ⇒ Object
33 34 35 |
# File 'lib/emplace.rb', line 33 def test! @impl.test build_dir end |
#vendor_dir ⇒ Object
19 20 21 |
# File 'lib/emplace.rb', line 19 def vendor_dir 'vendor' end |