Class: OrigenSim::Artifacts::Artifact
- Inherits:
-
Object
- Object
- OrigenSim::Artifacts::Artifact
- Defined in:
- lib/origen_sim/simulator/artifacts.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(options) ⇒ Artifact
constructor
A new instance of Artifact.
- #populate ⇒ Object
- #populate_method ⇒ Object (also: #pop_method)
- #reconfigure(options) ⇒ Object
- #run_target ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(options) ⇒ Artifact
Returns a new instance of Artifact.
52 53 54 55 56 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 52 def initialize() @name = .delete(:name) @parent = .delete(:parent) @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 49 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
50 51 52 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 50 def parent @parent end |
Instance Method Details
#clean ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 90 def clean if File.exist?(run_target) if File.symlink?(run_target) File.unlink(run_target) else FileUtils.rm_r(run_target) end end end |
#populate ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 76 def populate unless Dir.exist?(run_target.dirname) FileUtils.mkdir_p(run_target.dirname) end if populate_method == :symlink File.symlink(target, run_target) elsif populate_method == :copy FileUtils.cp(target, run_target) else Origen.app.fail! "Cannot populate artifact :#{name} with populate method #{populate_method}!" end end |
#populate_method ⇒ Object Also known as: pop_method
71 72 73 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 71 def populate_method @options[:populate_method] || parent.artifact_populate_method end |
#reconfigure(options) ⇒ Object
100 101 102 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 100 def reconfigure() @options = end |
#run_target ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 62 def run_target run_target = Pathname(@options[:run_target] || parent.artifact_run_dir) if run_target.absolute? run_target.join(target.basename) else parent.artifact_run_dir.join(run_target).join(target.basename) end end |
#target ⇒ Object
58 59 60 |
# File 'lib/origen_sim/simulator/artifacts.rb', line 58 def target Pathname(@options[:target] || parent.artifact_dir) end |