Sha256: 0c17a1b2fe4e4a7abc16fa5efb0226d090dd7d72b4ad08763b77df62220ff394

Contents?: true

Size: 1.55 KB

Versions: 29

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby

##
# This is a Fake MXMLC executable that should
# support our test cases by performing exactly 
# the same tasks that MXMLC performs, but much
# faster. 
#
# This executable should be easily swapped with
# the real MXMLC binary for any test.
class FakeMXMLC

  def initialize args
    #puts ">> ARGS: #{args.inspect}"
    if(args.size == 2 && 
       args[0].include?('SomeFile.swf') &&
       args[1].include?('SomeFile.as'))
      compile_simple_swf args
    elsif args == ["-output=test/fixtures/air/simple/bin/SomeProject.swf", "test/fixtures/air/simple/SomeProject.as"]
      compile_amxmlc_swf args
    else
      raise "Unexpected args sent to mxmlc stub #{args.join(', ')}"
    end
  end

  private

  def compile_amxmlc_swf args
    path = args[0].split('=').pop
    compile_swf path
  end

  ##
  # /Users/lbayes/Library/Sprouts/1.0/cache/flex4/4.1.0.16076/bin/mxmlc -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as
  # Loading configuration file /Users/lbayes/Library/Sprouts/1.0/cache/flex4/4.1.0.16076/frameworks/flex-config.xml
  # /Users/lbayes/Projects/Sprouts/flashsdk/test/fixtures/mxmlc/simple/SomeFile.swf (558 bytes)
  def compile_simple_swf args
    path = File.expand_path(args[0].gsub(/-output=/, ''))
    compile_swf path
  end

  def compile_swf path
    File.open path, 'wb+' do |f|
      f.write swf_bytes
    end
    puts "#{File.expand_path(path)} (#{swf_bytes.size})"
  end

  def swf_bytes
    @swf_bytes ||= File.read 'test/fixtures/air/simple/SomeProject.swf'
  end

end

mxmlc = FakeMXMLC.new ARGV

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
h4oflashsdk-1.0.13 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.12 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.11 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.10 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.9 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.8 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.7 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.6 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.5 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.4 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.3 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.2 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.1 test/fixtures/sdk/mxmlc
h4oflashsdk-1.0.0 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.14 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.13 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.12 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.11 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.10 test/fixtures/sdk/mxmlc
flashsdk_sqe-0.0.9 test/fixtures/sdk/mxmlc