Sha256: bdf0829002c6631e43d81750f0d9952045a71a2b931fa6d0d1e993b0296fb835

Contents?: true

Size: 1.31 KB

Versions: 11

Compression:

Stored size: 1.31 KB

Contents

module AsProject
  class SWFMillInputError < StandardError; end

  class SWFMillInput
    attr_accessor :path,
                  :template,
                  :input_expr
    
    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
    
    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
    
    def skin_name
      return File.basename(path).capitalize
    end
    
    def xml_file
      return File.join(File.dirname(path), skin_name + '.xml')
    end
    
    def write_xml(file, files, base_dir)
      SWFMillInputResolver.new(template, file, files, base_dir)
      Logger.puts 'Created file at: ' + file
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
asproject-0.1.118 lib/tasks/swfmill_input.rb
asproject-0.1.68 lib/tasks/swfmill_input.rb
asproject-0.1.60 lib/tasks/swfmill_input.rb
asproject-0.1.74 lib/tasks/swfmill_input.rb
asproject-0.1.69 lib/tasks/swfmill_input.rb
asproject-0.1.75 lib/tasks/swfmill_input.rb
asproject-0.1.71 lib/tasks/swfmill_input.rb
asproject-0.1.80 lib/tasks/swfmill_input.rb
asproject-0.1.84 lib/tasks/swfmill_input.rb
asproject-0.1.92 lib/tasks/swfmill_input.rb
asproject-0.1.89 lib/tasks/swfmill_input.rb