Sha256: be6da95bd77c91bda0328ee15e0d0c2087ad6be25017b779cfe3df903c34ce97

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

require 'digest/md5'
require 'fileutils'

module Sprout

  class RemoteFileTarget < FileTarget

    def move_player_lib
      path = File.join(File.dirname(__FILE__), "..", "..", "assets", "playerglobal.swc")
      to_path = File.join(unpacked_file, "frameworks", "libs", "player", "10.2")
      FileUtils.mkdir(to_path)
      FileUtils.cp(path, to_path)
    end

    private

    def load_unpack_or_ignore_archive
      if(!unpacked_files_exist?)
        if(!File.exists?(downloaded_file))
          bytes = download_archive
          write_archive bytes
        end

        # If we *just* downloaded the file,
        # use the bytes directly, otherwise
        # read them off disk from a previous
        # download attempt:
        bytes ||= File.open(downloaded_file, 'rb').read

        if should_unpack?(bytes, md5)
          unpack_archive
        end

        self.move_player_lib
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flashsdk_sqe-0.0.9 lib/sprout/remote_file_target.rb