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.
730
731
732
733
|
# File 'lib/daedalus.rb', line 730
def initialize(path, files)
super path
@files = files.sort_by { |x| x.path }
end
|
Instance Method Details
#build(ctx) ⇒ Object
771
772
773
774
775
|
# File 'lib/daedalus.rb', line 771
def build(ctx)
ctx.log.inc!
ctx.pre_link objects
ctx.link @path, objects
end
|
#clean ⇒ Object
777
778
779
780
781
782
783
784
785
|
# File 'lib/daedalus.rb', line 777
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
766
767
768
769
|
# File 'lib/daedalus.rb', line 766
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
787
788
789
790
791
792
793
|
# File 'lib/daedalus.rb', line 787
def describe(ctx)
puts "Program: #{@path}"
@files.each do |f|
f.describe(ctx)
end
end
|
#file_info(ctx, files) ⇒ Object
795
796
797
798
799
800
801
802
803
804
|
# File 'lib/daedalus.rb', line 795
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
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
|
# File 'lib/daedalus.rb', line 735
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
|