Class: AsProject::SWFMillInput

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/swfmill_input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, template, input_expr = nil) ⇒ SWFMillInput

Returns a new instance of SWFMillInput.



10
11
12
13
14
15
16
17
18
19
# File 'lib/tasks/swfmill_input.rb', line 10

def initialize(path, template, input_expr=nil)
  @path = path
  @template = template
  if(input_expr.nil?)
    @input_expr = '/**/**/*'
  else
    @input_expr = input_expr
  end
  define
end

Instance Attribute Details

#input_exprObject

Returns the value of attribute input_expr.



6
7
8
# File 'lib/tasks/swfmill_input.rb', line 6

def input_expr
  @input_expr
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/tasks/swfmill_input.rb', line 6

def path
  @path
end

#templateObject

Returns the value of attribute template.



6
7
8
# File 'lib/tasks/swfmill_input.rb', line 6

def template
  @template
end

Instance Method Details

#defineObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tasks/swfmill_input.rb', line 21

def define
  if(@path.nil?)
    raise SWFMillInputError.new('SWFMillInput needs a valid input');
  end
  
  if(@template.nil?)
    raise SWFMillInputError.new('CompileSkins needs a valid template to use');
  end

  input_files = FileList.new(path + input_expr)
  file xml_file => input_files
  file xml_file => path
  file xml_file => template

  file xml_file do |f|
    write_xml(xml_file, input_files, path)
  end
  
  CLEAN.add(xml_file)
  self
end

#skin_nameObject



43
44
45
# File 'lib/tasks/swfmill_input.rb', line 43

def skin_name
  return File.basename(path).capitalize
end

#write_xml(file, files, base_dir) ⇒ Object



51
52
53
54
# File 'lib/tasks/swfmill_input.rb', line 51

def write_xml(file, files, base_dir)
  SWFMillInputResolver.new(template, file, files, base_dir)
  Logger.puts 'Created file at: ' + file
end

#xml_fileObject



47
48
49
# File 'lib/tasks/swfmill_input.rb', line 47

def xml_file
  return File.join(File.dirname(path), skin_name + '.xml')
end