Class: Distil::ExternalProject
- Inherits:
-
Project
- Object
- Configurable
- Project
- Distil::ExternalProject
- Defined in:
- lib/distil/project/external-project.rb
Instance Attribute Summary
Attributes inherited from Configurable
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(config, parent = nil) ⇒ ExternalProject
constructor
A new instance of ExternalProject.
- #product_name(product_type, extension) ⇒ Object
- #up_to_date ⇒ Object
Methods inherited from Project
#clean, fetch_project_using_git, from_config
Methods included from ErrorReporter
#error, error, #ignore_warnings, #ignore_warnings=, #report, warning, #warning
Methods inherited from Configurable
#get_option, #get_options, option
Constructor Details
#initialize(config, parent = nil) ⇒ ExternalProject
Returns a new instance of ExternalProject.
16 17 18 19 20 21 22 23 |
# File 'lib/distil/project/external-project.rb', line 16 def initialize(config, parent=nil) if !config.has_key?("source_folder") config["source_folder"]= "build/$(mode)" end super(config, parent) self.output_folder= File.join(parent.output_folder, name) end |
Instance Method Details
#build ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/distil/project/external-project.rb', line 36 def build wd= Dir.getwd Dir.chdir(path) system build_command Dir.chdir(wd) # external projects aren't included in the output when weak linked, # they are just expected to be there, somehow. Like magic. return if WEAK_LINKAGE==linkage FileUtils.rm_r(output_folder) if File.directory?(output_folder) FileUtils.rm(output_folder) if File.symlink?(output_folder) if DEBUG_MODE==mode FileUtils.symlink(SourceFile.path_relative_to_folder(File.(source_folder), File.dirname(output_folder)), output_folder) else FileUtils.cp_r(File.(source_folder), output_folder) end end |
#product_name(product_type, extension) ⇒ Object
25 26 27 28 29 |
# File 'lib/distil/project/external-project.rb', line 25 def product_name(product_type, extension) info= Struct.new(:extension).new(extension) name= self.send("#{product_type.to_s}_name") Interpolated.value_of(name, info) end |
#up_to_date ⇒ Object
31 32 33 34 |
# File 'lib/distil/project/external-project.rb', line 31 def up_to_date build true end |