Class: Daedalus::Program
- Inherits:
-
Path
- Object
- Path
- Daedalus::Program
show all
- Defined in:
- lib/daedalus.rb
Instance Attribute Summary
Attributes inherited from Path
#data, #path
Instance Method Summary
collapse
Methods inherited from Path
#artifacts_path, #basename, #data_path, #save!
Constructor Details
#initialize(path, files) ⇒ Program
Returns a new instance of Program.
790
791
792
793
|
# File 'lib/daedalus.rb', line 790
def initialize(path, files)
super path
@files = files.sort_by { |x| x.path }
end
|
Instance Method Details
#build(ctx) ⇒ Object
831
832
833
834
835
|
# File 'lib/daedalus.rb', line 831
def build(ctx)
ctx.log.inc!
ctx.pre_link objects
ctx.link @path, objects
end
|
#clean ⇒ Object
837
838
839
840
841
842
843
844
845
|
# File 'lib/daedalus.rb', line 837
def clean
@files.each do |f|
f.clean if f.respond_to? :clean
end
File.unlink @path if File.exist?(@path)
File.unlink data_path if File.exist?(data_path)
Dir.rmdir artifacts_path if Dir.entries(artifacts_path).empty?
end
|
#consider(ctx, tasks) ⇒ Object
826
827
828
829
|
# File 'lib/daedalus.rb', line 826
def consider(ctx, tasks)
@files.each { |x| x.consider(ctx, tasks) }
tasks.post << self unless tasks.empty? and File.exist?(@path)
end
|
#describe(ctx) ⇒ Object
847
848
849
850
851
852
853
|
# File 'lib/daedalus.rb', line 847
def describe(ctx)
puts "Program: #{@path}"
@files.each do |f|
f.describe(ctx)
end
end
|
#file_info(ctx, files) ⇒ Object
855
856
857
858
859
860
861
862
863
864
|
# File 'lib/daedalus.rb', line 855
def file_info(ctx, files)
files.each do |n|
obj = @files.find { |x| x.path == n }
if obj
obj.info(ctx)
else
puts "Unable to find file: #{n}"
end
end
end
|
#objects ⇒ Object
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
|
# File 'lib/daedalus.rb', line 795
def objects
objects = []
archives = []
@files.each do |x|
if x.respond_to? :object_path
if File.extname(x.object_path) == ".a"
archives << x.object_path
else
objects << x.object_path
end
else
x.objects.each do |obj|
if File.extname(obj) == ".a"
archives << obj
else
objects << obj
end
end
end
end
objects.sort + archives
end
|