Class: OutputTask
- Inherits:
-
Task
show all
- Defined in:
- lib/tasks/output-task.rb
Instance Attribute Summary
Attributes inherited from Task
#assets, #included_files
Attributes inherited from Configurable
#options
Instance Method Summary
collapse
Methods inherited from Task
available_tasks, #build_assets, by_name, #cleanup, #copy_assets, #copy_assets_orig, #document_files, #find_files, #finish, #handles_file?, #include_file, inherited, #need_to_build, #process_files, #replace_tokens, #symlink_assets, task_index, #task_name, task_name, #validate_files
#get_options, option, option_alias
Constructor Details
#initialize(target, options) ⇒ OutputTask
Returns a new instance of OutputTask.
12
13
14
15
16
17
|
# File 'lib/tasks/output-task.rb', line 12
def initialize(target, options)
super(target, options)
@files_to_exclude= @options.exclude.to_a
@files_to_include= @options.include.to_a
FileUtils.mkdir_p(output_folder)
end
|
Instance Method Details
#minify(source) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/tasks/output-task.rb', line 35
def minify(source)
buffer= ""
IO.popen("java -jar #{$compressor} --type #{source_type}", "r+") { |pipe|
pipe.puts(source)
pipe.close_write
buffer= pipe.read
}
if ('css'==output_type)
return buffer.gsub(/\}/,"}\n").gsub(/.*@import url\(\".*\"\);/,'')
else
return buffer
end
end
|
#notice_text ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/tasks/output-task.rb', line 54
def notice_text
if (!@options.notice)
return ""
end
if (nil==@notice_text)
notice_file= @options.notice;
if (!File.exists?(notice_file))
@notice_text= ""
else
text= File.read(notice_file).strip
text= " #{text}".gsub(/\n/, "\n ")
@notice_text= "/*!\n#{text}\n*/\n\n"
end
end
return @notice_text
end
|
#output_extension ⇒ Object
27
28
29
|
# File 'lib/tasks/output-task.rb', line 27
def output_extension
output_type
end
|
#output_type ⇒ Object
19
20
21
|
# File 'lib/tasks/output-task.rb', line 19
def output_type
nil
end
|
#products ⇒ Object
31
32
33
|
# File 'lib/tasks/output-task.rb', line 31
def products
@products
end
|
#source_type ⇒ Object
23
24
25
|
# File 'lib/tasks/output-task.rb', line 23
def source_type
output_type
end
|