8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/aml/Build.rb', line 8
def initialize(attribute=nil)
@argument = Argument.new()
@argument.define('[b]uild', nil, 'input file path and name', true)
@argument.define('[s]elf[c]losing', true, 'enable self closing tags')
@argument.define('[p]ath', nil, 'output file path')
@argument.define('[n]ame', nil, 'output file name')
@argument.define('[e]xtension', 'html', 'output file extension')
@argument.define('[o]utput', nil, 'output file path and name')
@argument.define('[h]elp', false, 'list all arguments')
@argument.parse(attribute)
if @argument.get('build') != nil.to_s
@argument.set('path', File.dirname(@argument.get('build'))) if @argument.get('path') == nil.to_s
@argument.set('name', File.basename(@argument.get('build'),'.*')) if @argument.get('name') == nil.to_s
if @argument.get('output') == nil.to_s
@argument.set('output', File.join(@argument.get('path'), @argument.get('name') + '.' + @argument.get('extension')))
else
@argument.set('path', File.dirname(@argument.get('output')))
@argument.set('name', File.basename(@argument.get('output'),'.*'))
@argument.set('extension', File.extname(@argument.get('output'))[1..-1])
end
end
if @argument.get('selfclosing').to_s.downcase == 'true'
@@selfClosing = %w[area base basefont bgsound br col frame hr img isindex input keygen link meta param source track wbr]
elsif @argument.get('selfclosing').to_s.downcase != 'false'
@@selfClosing = @argument.get('selfclosing').to_s.downcase.split(',')
@argument.set('selfclosing','custom')
end
if @argument.show_help?
@argument.show_help
elsif @argument.has_requirements?
@compile = Compile.new(@argument)
@compile.process
@compile.post_process
if @compile.log.select{|k|k[:fail]==true}.count == 0
console
process_complete
else
console
end
else
@argument.show_required
end
end
|