Class: Target
Instance Attribute Summary collapse
Attributes inherited from Configurable
#options
Class Method Summary
collapse
Instance Method Summary
collapse
#get_options, option, option_alias
Constructor Details
#initialize(name, settings, project) ⇒ Target
Returns a new instance of Target.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/target.rb', line 9
def initialize(name, settings, project)
super(settings, project)
@project= project
@target_name= name
@@current= self
@tasks= []
@extras.each { |task_name, task_settings|
next if (tasks && !tasks.include?(task_name))
t= Task.by_name(task_name)
@tasks << t.new(self, task_settings)
}
@warning_count=0
@error_count=0
end
|
Instance Attribute Details
#error_count ⇒ Object
Returns the value of attribute error_count.
5
6
7
|
# File 'lib/target.rb', line 5
def error_count
@error_count
end
|
#target_name ⇒ Object
Returns the value of attribute target_name.
5
6
7
|
# File 'lib/target.rb', line 5
def target_name
@target_name
end
|
#warning_count ⇒ Object
Returns the value of attribute warning_count.
5
6
7
|
# File 'lib/target.rb', line 5
def warning_count
@warning_count
end
|
Class Method Details
.current ⇒ Object
28
29
30
|
# File 'lib/target.rb', line 28
def self.current
@@current
end
|
Instance Method Details
#error(message, file = "", line_number = 0) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/target.rb', line 32
def error(message, file="", line_number=0)
@error_count+=1
if (file && line_number)
printf("%s:%d: error: %s\n", file, line_number, message)
else
printf("error: %s\n", message)
end
end
|
#find_file(file) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/target.rb', line 59
def find_file(file)
external_projects.each { |project|
path= File.expand_path(File.join(project["include"], file))
if (File.exists?(path))
source_file= SourceFile.from_path(path)
source_file.file_path= file
return source_file
end
}
nil
end
|
#finish ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/target.rb', line 83
def finish
@tasks.each { |t|
t.finish if t.need_to_build
t.build_assets
}
@tasks.each { |t|
t.cleanup
}
puts "#{@error_count} error(s), #{@warning_count} warning(s)#{ignore_warnings ? " ignored" : ""}"
end
|
#process_files ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/target.rb', line 71
def process_files
@tasks.each { |t|
t.find_files
next if !t.need_to_build
t.validate_files
t.document_files
t.process_files
}
end
|
#products ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/target.rb', line 51
def products
products= []
@tasks.each { |task|
products.concat(task.products)
}
products
end
|
#warning(message, file = "", line_number = 0) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'lib/target.rb', line 41
def warning(message, file="", line_number=0)
@warning_count+=1
return if (ignore_warnings)
if (file && line_number)
printf("%s:%d: warning: %s\n", file, line_number, message)
else
printf("warning: %s\n", message)
end
end
|