Class: AsProject::SWFMill

Inherits:
RemoteFileTask show all
Defined in:
lib/tasks/swfmill.rb

Instance Attribute Summary collapse

Attributes inherited from RemoteFileTask

#osx_extracted_file, #osx_mounted_path, #osx_url, #unix_extracted_file, #unix_url, #user_task, #win_extracted_file, #win_url

Instance Method Summary collapse

Methods inherited from RemoteFileTask

#clean_path, #define_user_task, #execute, #extracted_file_path, #user

Constructor Details

#initialize(name, do_not_define = false) ⇒ SWFMill

Returns a new instance of SWFMill.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tasks/swfmill.rb', line 14

def initialize(name, do_not_define=false)
  @simple = true
  @input = nil
  @template = nil
  @input_expr = nil
  @output = nil
  @options = []
  @version = '0.2.12' 
  @win_url = "http://www.swfmill.org/releases/swfmill-#{version}-win32.zip"
  @win_extracted_file = "/swfmill-#{version}-win32/swfmill.exe"
  @osx_url = "http://swfmill.org/releases/swfmill-#{version}-macosx.tar.gz"
  @osx_extracted_file = "swfmill-#{version}-macosx/swfmill"
  @unix_url = nil
  @unix_extracted_file = nil
  super(name, true)
  define unless do_not_define
end

Instance Attribute Details

#inputObject

Returns the value of attribute input.



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

def input
  @input
end

#input_exprObject

Returns the value of attribute input_expr.



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

def input_expr
  @input_expr
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#outputObject

Returns the value of attribute output.



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

def output
  @output
end

#simpleObject

Returns the value of attribute simple.



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

def simple
  @simple
end

#templateObject

Returns the value of attribute template.



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

def template
  @template
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#defineObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/tasks/swfmill.rb', line 36

def define
  super
  
  if(@input.nil?)
    raise SWFMillError.new('SWFMill task requires that input be set')
  end
  
  if(@output.nil?)
    raise SWFMillError.new('SWFMill task requires that output be set')
  end
  
  if(File.directory?(input))
    @input = define_xml_task(input).xml_file
  end
  
  file input
  file output => input do |f|
    cleaned_options = []
    option_list.each do |item|
      cleaned_options << clean_path(item)
    end
    execute(cleaned_options.join(' '))
  end

  desc "#{name} using SWFMill"
  task name => [input, output]
  
  CLEAN.add(output)

  self
end

#define_xml_task(path) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/tasks/swfmill.rb', line 68

def define_xml_task(path)
  # build the input xml file automatically
  # Based on a directory full of images...
  if(@template.nil?)
    raise SWFMillError.new('If input is a directory, you must assign a template to use for the generated xml document')
  end
  
  return SWFMillInput.new(path, template, input_expr)
end

#option_listObject



78
79
80
81
82
83
84
# File 'lib/tasks/swfmill.rb', line 78

def option_list
  result = @options.dup
  result << "simple" if simple
  result << input if input
  result << output if output
  return result
end

#remote_task_nameObject



32
33
34
# File 'lib/tasks/swfmill.rb', line 32

def remote_task_name
  return "swfmill-#{version}"
end