sprout-as3-bundle 0.2.9 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sprout/as3/version.rb +3 -3
- data/lib/sprout/as3_tasks.rb +3 -0
- data/lib/sprout/fcsh_lexer.rb +144 -0
- data/lib/sprout/fcsh_service.rb +111 -0
- data/lib/sprout/fcsh_socket.rb +36 -0
- data/lib/sprout/generators/project/project_generator.rb +1 -0
- data/lib/sprout/generators/project/templates/MainClass.as +2 -1
- data/lib/sprout/generators/project/templates/XMLRunner.as +17 -0
- data/lib/sprout/generators/project/templates/rakefile.rb +4 -0
- data/lib/sprout/generators/test/templates/TestCase.as +2 -2
- data/lib/sprout/tasks/adl_documentation.rb +79 -45
- data/lib/sprout/tasks/adt_documentation.rb +45 -79
- data/lib/sprout/tasks/{asdoc_rdoc.rb → asdoc_documentation.rb} +0 -0
- data/lib/sprout/tasks/asdoc_task.rb +33 -2
- data/lib/sprout/tasks/fcsh.rb +10 -0
- data/lib/sprout/tasks/fdb_task.rb +226 -14
- data/lib/sprout/tasks/mxmlc_ci.rb +62 -0
- data/lib/sprout/tasks/mxmlc_helper.rb +18 -3
- data/lib/sprout/tasks/mxmlc_task.rb +21 -6
- data/lib/sprout/tasks/mxmlc_unit.rb +1 -1
- data/rakefile.rb +2 -1
- metadata +21 -11
- data/lib/sprout/tasks/adl_rdoc.rb +0 -88
- data/lib/sprout/tasks/adt_cert_rdoc.rb +0 -44
- data/lib/sprout/tasks/adt_rdoc.rb +0 -54
- data/lib/sprout/tasks/compc_rdoc.rb +0 -606
- data/lib/sprout/tasks/fcsh_task.rb +0 -12
- data/lib/sprout/tasks/mxmlc_rdoc.rb +0 -547
| @@ -227,7 +227,13 @@ EOF | |
| 227 227 | 
             
                  end
         | 
| 228 228 | 
             
                end
         | 
| 229 229 |  | 
| 230 | 
            +
                def exclude_expressions
         | 
| 231 | 
            +
                  @exclude_expressions ||= []
         | 
| 232 | 
            +
                end
         | 
| 233 | 
            +
             | 
| 230 234 | 
             
                def define # :nodoc:
         | 
| 235 | 
            +
                  apply_exclusions_from_expression unless @exclude_expressions.nil?
         | 
| 236 | 
            +
             | 
| 231 237 | 
             
                  super
         | 
| 232 238 | 
             
                  validate_templates
         | 
| 233 239 | 
             
                  CLEAN.add(output)
         | 
| @@ -248,7 +254,7 @@ EOF | |
| 248 254 | 
             
                    end
         | 
| 249 255 | 
             
                  end
         | 
| 250 256 | 
             
                end
         | 
| 251 | 
            -
             | 
| 257 | 
            +
             | 
| 252 258 | 
             
                protected
         | 
| 253 259 |  | 
| 254 260 | 
             
                def validate_templates
         | 
| @@ -258,7 +264,7 @@ EOF | |
| 258 264 | 
             
                    templates_path << templates_dir
         | 
| 259 265 | 
             
                  end
         | 
| 260 266 | 
             
                end
         | 
| 261 | 
            -
             | 
| 267 | 
            +
             | 
| 262 268 | 
             
                def execute(*args)
         | 
| 263 269 | 
             
                  update_helper_mode
         | 
| 264 270 | 
             
                  begin
         | 
| @@ -291,6 +297,31 @@ EOF | |
| 291 297 | 
             
                  end
         | 
| 292 298 | 
             
                end
         | 
| 293 299 |  | 
| 300 | 
            +
                # Requires that @exclude_expressions is not nil.
         | 
| 301 | 
            +
                def apply_exclusions_from_expression
         | 
| 302 | 
            +
                  FileList[@exclude_expressions].each do |file_path|
         | 
| 303 | 
            +
                    import_file = remove_source_path_from_file_path(file_path) || file_path
         | 
| 304 | 
            +
                    import_class = filename_to_import_class(import_file)
         | 
| 305 | 
            +
             | 
| 306 | 
            +
                    exclude_classes << import_class unless import_class.nil?
         | 
| 307 | 
            +
                  end
         | 
| 308 | 
            +
                end
         | 
| 309 | 
            +
             | 
| 310 | 
            +
                def remove_source_path_from_file_path(file)
         | 
| 311 | 
            +
                    source_path.each do |source_dir|
         | 
| 312 | 
            +
                      import_file = file.sub(Regexp.new("^#{source_dir}"),"")
         | 
| 313 | 
            +
                      return import_file if import_file != file
         | 
| 314 | 
            +
                    end
         | 
| 315 | 
            +
                    
         | 
| 316 | 
            +
                    return file
         | 
| 317 | 
            +
                end
         | 
| 318 | 
            +
             | 
| 319 | 
            +
                def filename_to_import_class(filename)
         | 
| 320 | 
            +
                  name = filename.scan(/\w+/)
         | 
| 321 | 
            +
                  # Ignore the AS file extension.
         | 
| 322 | 
            +
                  name[0..-2].join('.') unless name[-1] != 'as'
         | 
| 323 | 
            +
                end
         | 
| 324 | 
            +
             | 
| 294 325 | 
             
              end
         | 
| 295 326 | 
             
            end
         | 
| 296 327 |  | 
| @@ -25,29 +25,132 @@ module Sprout #:nodoc: | |
| 25 25 | 
             
              #   end
         | 
| 26 26 | 
             
              #
         | 
| 27 27 | 
             
              # You can also point the FDBTask at HTML pages. These pages will be 
         | 
| 28 | 
            -
              # launched in your default  | 
| 28 | 
            +
              # launched in your default browser. You will need to manually install
         | 
| 29 29 | 
             
              # a debug Flash Player in that particular browser.
         | 
| 30 | 
            -
              #  | 
| 30 | 
            +
              # 
         | 
| 31 | 
            +
              # To use a browser instead of the desktop Flash Player, simply point the
         | 
| 31 32 | 
             
              # file argument at an HTML document or remote URL. The SWF file loaded
         | 
| 32 | 
            -
              # must be compiled using the -debug flag  | 
| 33 | 
            -
              # debugger.
         | 
| 33 | 
            +
              # must be compiled using the -debug flag, and executed in a debug Flash Player
         | 
| 34 | 
            +
              # in order to connect to properly connect to the debugger.
         | 
| 34 35 | 
             
              #   fdb :debug do |t|
         | 
| 35 36 | 
             
              #     t.file = 'bin/SomeProject-debug.html'
         | 
| 36 37 | 
             
              #     t.run
         | 
| 37 38 | 
             
              #     t.continue
         | 
| 38 39 | 
             
              #   end
         | 
| 39 40 | 
             
              #
         | 
| 41 | 
            +
              # .h3 Continuous Integration
         | 
| 42 | 
            +
              #
         | 
| 43 | 
            +
              # The FDBTask is also the only effective way to execute SWF content
         | 
| 44 | 
            +
              # in front of a CI (continuous integration) tool like Cruise Control.
         | 
| 45 | 
            +
              # The biggest problem facing SWF execution for CI is uncaught
         | 
| 46 | 
            +
              # runtime exceptions. The debug Flash Player throws uncaught exceptions
         | 
| 47 | 
            +
              # up to the operating system GUI layer where a user must manually dismiss
         | 
| 48 | 
            +
              # a dialog. In addition to blocking the CI process indefinitely, these
         | 
| 49 | 
            +
              # messages are also difficult to capture and log. 
         | 
| 50 | 
            +
              #
         | 
| 51 | 
            +
              # Using Sprouts and the FDBTask, we can capture these messages along
         | 
| 52 | 
            +
              # with additonal information (e.g. local variables and a complete stack trace)
         | 
| 53 | 
            +
              # about the state of the SWF file, and then cleanly exit the Flash Player
         | 
| 54 | 
            +
              # and log this information.
         | 
| 55 | 
            +
              #
         | 
| 56 | 
            +
              # The FDBTask has also been configured to work with the ASUnit XMLPrinter
         | 
| 57 | 
            +
              # so that an XML artifact is created and written to disk that includes
         | 
| 58 | 
            +
              # the results of running your test suites.
         | 
| 59 | 
            +
              # 
         | 
| 60 | 
            +
              # To use FDB with a CI tool do the following:
         | 
| 61 | 
            +
              #
         | 
| 62 | 
            +
              # 1) Create a new base runner class (we usually name this XMLRunner.as)
         | 
| 63 | 
            +
              # and make it look like the following:
         | 
| 64 | 
            +
              #
         | 
| 65 | 
            +
              #   package {
         | 
| 66 | 
            +
              #     import asunit.textui.TestRunner;
         | 
| 67 | 
            +
              #     import asunit.textui.XMLResultPrinter;
         | 
| 68 | 
            +
              # 
         | 
| 69 | 
            +
              #     public class XMLRunner extends TestRunner {
         | 
| 70 | 
            +
              # 
         | 
| 71 | 
            +
              #       public function XMLRunner() {
         | 
| 72 | 
            +
              #         setPrinter(new XMLResultPrinter());
         | 
| 73 | 
            +
              #         start(AllTests, null, TestRunner.SHOW_TRACE);
         | 
| 74 | 
            +
              #       }
         | 
| 75 | 
            +
              #     }
         | 
| 76 | 
            +
              #   }
         | 
| 77 | 
            +
              #
         | 
| 78 | 
            +
              # 2) Create a new MXMLCTask to compile the newly created runner.
         | 
| 79 | 
            +
              # NOTE: Be sure you set +debug+ to true, otherwise the SWF will
         | 
| 80 | 
            +
              # not connect to the debugger properly.
         | 
| 81 | 
            +
              #
         | 
| 82 | 
            +
              #   library :asunit3
         | 
| 83 | 
            +
              #
         | 
| 84 | 
            +
              #   desc 'Compile the CI SWF'
         | 
| 85 | 
            +
              #   mxmlc 'bin/XMLRunner.swf' => :asunit3 do |t|
         | 
| 86 | 
            +
              #     t.input = 'src/XMLRunner.as'
         | 
| 87 | 
            +
              #     t.debug = true
         | 
| 88 | 
            +
              #     t.source_path << 'test'
         | 
| 89 | 
            +
              #     # Add additional configuration here.
         | 
| 90 | 
            +
              #   end
         | 
| 91 | 
            +
              #
         | 
| 92 | 
            +
              # 3) Create a new FDBTask and set +kill_on_fault+ to true.
         | 
| 93 | 
            +
              #
         | 
| 94 | 
            +
              #   desc 'Execute the test harness for CI'
         | 
| 95 | 
            +
              #   fdb :cruise do |t|
         | 
| 96 | 
            +
              #     t.kill_on_fault = true
         | 
| 97 | 
            +
              #     t.file = 'bin/XMLRunner.swf'
         | 
| 98 | 
            +
              #     t.run
         | 
| 99 | 
            +
              #     t.continue
         | 
| 100 | 
            +
              #   end
         | 
| 101 | 
            +
              #
         | 
| 102 | 
            +
              # 4) Configure your CI task to call:
         | 
| 103 | 
            +
              # 
         | 
| 104 | 
            +
              #   rake cruise
         | 
| 105 | 
            +
              #
         | 
| 106 | 
            +
              # 5) That's it!
         | 
| 107 | 
            +
              #
         | 
| 40 108 | 
             
              class FDBTask < ToolTask
         | 
| 41 | 
            -
                 | 
| 42 | 
            -
                 | 
| 109 | 
            +
                TEST_RESULT_PRELUDE = '<XMLResultPrinter>'
         | 
| 110 | 
            +
                TEST_RESULT_CLOSING = '</XMLResultPrinter>'
         | 
| 111 | 
            +
                TEST_RESULT_FILE    = 'AsUnitResults.xml'
         | 
| 112 | 
            +
                
         | 
| 113 | 
            +
                # Relative or absolute path to where unit test results
         | 
| 114 | 
            +
                # should be written to disk.
         | 
| 115 | 
            +
                # This field can be used in conjunction with the AsUnit
         | 
| 116 | 
            +
                # XMLResultPrinter which will trace out JUnit style XML 
         | 
| 117 | 
            +
                # test results.
         | 
| 118 | 
            +
                # By telling fdb where to write those test results, it
         | 
| 119 | 
            +
                # will scan the trace output stream looking for +test_result_prelude+,
         | 
| 120 | 
            +
                # and +test_result_closing+. Once the closing is encountered, the
         | 
| 121 | 
            +
                # prelude and closing (and everything in between) will be written
         | 
| 122 | 
            +
                # to disk in the file identified by +test_result_file+, and fdb
         | 
| 123 | 
            +
                # will be closed down.
         | 
| 124 | 
            +
                attr_writer :test_result_file
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                # String that indicates the beginning of printable test results
         | 
| 127 | 
            +
                # Default value is '<XMLResultPrinter>'
         | 
| 128 | 
            +
                attr_writer :test_result_prelude
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                # String that indicates the closing of printable test results
         | 
| 131 | 
            +
                # Default value is '</XMLResultPrinter>'
         | 
| 132 | 
            +
                # See test_result_prelude for more info.
         | 
| 133 | 
            +
                attr_writer :test_result_closing
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                # Boolean value that tells fdb whether or not it should automatically
         | 
| 136 | 
            +
                # shut down when an exception is encountered. This feature is used to
         | 
| 137 | 
            +
                # prevent GUI prompts for unhandled exceptions, especially when running
         | 
| 138 | 
            +
                # a test harness under a continuous integration tool - like cruise control.
         | 
| 139 | 
            +
                # If an exception is encountered, fdb will automatically print the exception,
         | 
| 140 | 
            +
                # a full stack trace and all local variables in the function where the failure 
         | 
| 141 | 
            +
                # occured.
         | 
| 142 | 
            +
                attr_writer :kill_on_fault
         | 
| 43 143 |  | 
| 44 144 | 
             
                def initialize_task # :nodoc:
         | 
| 45 145 | 
             
                  @default_gem_name = 'sprout-flex3sdk-tool'
         | 
| 46 146 | 
             
                  @default_gem_path = 'bin/fdb'
         | 
| 147 | 
            +
                  @kill_on_fault = false
         | 
| 47 148 | 
             
                  @queue = []
         | 
| 48 149 | 
             
                end
         | 
| 49 150 |  | 
| 50 151 | 
             
                def define # :nodoc:
         | 
| 152 | 
            +
                  super
         | 
| 153 | 
            +
                  CLEAN.add(test_result_file)
         | 
| 51 154 | 
             
                  self
         | 
| 52 155 | 
             
                end
         | 
| 53 156 |  | 
| @@ -59,16 +162,35 @@ module Sprout #:nodoc: | |
| 59 162 | 
             
                  @stdout ||= $stdout
         | 
| 60 163 | 
             
                end
         | 
| 61 164 |  | 
| 165 | 
            +
                def validate_swf(swf)
         | 
| 166 | 
            +
                  # TODO: Ensure the SWF has been compiled with debugging
         | 
| 167 | 
            +
                  # turned on.
         | 
| 168 | 
            +
                  # I believe this will require actually parsing the SWF file and
         | 
| 169 | 
            +
                  # scanning for the EnableDebugger2 tag.
         | 
| 170 | 
            +
                  # http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf
         | 
| 171 | 
            +
                end
         | 
| 172 | 
            +
                
         | 
| 62 173 | 
             
                def execute(*args) # :nodoc:
         | 
| 63 | 
            -
                  #  | 
| 174 | 
            +
                  # Ensure that if we load a SWF it's been compiled with debugging turned on!
         | 
| 175 | 
            +
                  file_name = @file
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                  if(file_name.match(/\.swf$/))
         | 
| 178 | 
            +
                    validate_swf(file_name)
         | 
| 179 | 
            +
                  end
         | 
| 180 | 
            +
             | 
| 64 181 | 
             
                  buffer = FDBBuffer.new(get_executable, stdout)
         | 
| 182 | 
            +
                  buffer.test_result_file = test_result_file
         | 
| 183 | 
            +
                  buffer.test_result_prelude = test_result_prelude
         | 
| 184 | 
            +
                  buffer.test_result_closing = test_result_closing
         | 
| 185 | 
            +
                  buffer.kill_on_fault = kill_on_fault?
         | 
| 65 186 | 
             
                  buffer.wait_for_prompt
         | 
| 66 187 |  | 
| 67 188 | 
             
                  @queue.each do |command|
         | 
| 68 189 | 
             
                    handle_command(buffer, command)
         | 
| 69 190 | 
             
                  end
         | 
| 70 191 |  | 
| 71 | 
            -
                  buffer.join
         | 
| 192 | 
            +
                  buffer.join # wait here until the buffer is closed.
         | 
| 193 | 
            +
             | 
| 72 194 | 
             
                  self
         | 
| 73 195 | 
             
                end
         | 
| 74 196 |  | 
| @@ -95,6 +217,22 @@ module Sprout #:nodoc: | |
| 95 217 | 
             
                  @queue
         | 
| 96 218 | 
             
                end
         | 
| 97 219 |  | 
| 220 | 
            +
                def kill_on_fault?
         | 
| 221 | 
            +
                  @kill_on_fault
         | 
| 222 | 
            +
                end
         | 
| 223 | 
            +
                
         | 
| 224 | 
            +
                def test_result_file
         | 
| 225 | 
            +
                  @test_result_file ||= TEST_RESULT_FILE
         | 
| 226 | 
            +
                end
         | 
| 227 | 
            +
                
         | 
| 228 | 
            +
                def test_result_prelude
         | 
| 229 | 
            +
                  @test_result_prelude ||= TEST_RESULT_PRELUDE
         | 
| 230 | 
            +
                end
         | 
| 231 | 
            +
                
         | 
| 232 | 
            +
                def test_result_closing
         | 
| 233 | 
            +
                  @test_result_closing ||= TEST_RESULT_CLOSING
         | 
| 234 | 
            +
                end
         | 
| 235 | 
            +
                
         | 
| 98 236 | 
             
                # Print backtrace of all stack frames
         | 
| 99 237 | 
             
                def bt
         | 
| 100 238 | 
             
                  @queue << "bt"
         | 
| @@ -174,6 +312,12 @@ module Sprout #:nodoc: | |
| 174 312 | 
             
                def file=(file)
         | 
| 175 313 | 
             
                  @prerequisites << file
         | 
| 176 314 | 
             
                  @queue << "file #{file}"
         | 
| 315 | 
            +
                  @file = file
         | 
| 316 | 
            +
                end
         | 
| 317 | 
            +
                
         | 
| 318 | 
            +
                # alias for self.file=
         | 
| 319 | 
            +
                def input=(file)
         | 
| 320 | 
            +
                  self.file = file
         | 
| 177 321 | 
             
                end
         | 
| 178 322 |  | 
| 179 323 | 
             
                # Execute until current function returns
         | 
| @@ -303,7 +447,7 @@ module Sprout #:nodoc: | |
| 303 447 | 
             
                  @queue << "set #{value}"
         | 
| 304 448 | 
             
                end
         | 
| 305 449 |  | 
| 306 | 
            -
                # Sleep until some 'str' String is sent to the output
         | 
| 450 | 
            +
                # Sleep until some 'str' String is sent to the output,
         | 
| 307 451 | 
             
                def sleep_until(str)
         | 
| 308 452 | 
             
                  @queue << "sleep #{str}"
         | 
| 309 453 | 
             
                end
         | 
| @@ -347,6 +491,11 @@ module Sprout #:nodoc: | |
| 347 491 |  | 
| 348 492 | 
             
              # A buffer that provides clean blocking support for the fdb command shell
         | 
| 349 493 | 
             
              class FDBBuffer #:nodoc:
         | 
| 494 | 
            +
                attr_accessor :test_result_file
         | 
| 495 | 
            +
                attr_accessor :test_result_prelude
         | 
| 496 | 
            +
                attr_accessor :test_result_closing
         | 
| 497 | 
            +
                attr_writer :kill_on_fault
         | 
| 498 | 
            +
             | 
| 350 499 | 
             
                PLAYER_TERMINATED = 'Player session terminated'
         | 
| 351 500 | 
             
                EXIT_PROMPT = 'The program is running.  Exit anyway? (y or n)'
         | 
| 352 501 | 
             
                PROMPT = '(fdb) '
         | 
| @@ -363,6 +512,10 @@ module Sprout #:nodoc: | |
| 363 512 | 
             
                  listen exe
         | 
| 364 513 | 
             
                end
         | 
| 365 514 |  | 
| 515 | 
            +
                def kill_on_fault?
         | 
| 516 | 
            +
                  @kill_on_fault
         | 
| 517 | 
            +
                end
         | 
| 518 | 
            +
                
         | 
| 366 519 | 
             
                def user_input
         | 
| 367 520 | 
             
                  @user_input ||= $stdin
         | 
| 368 521 | 
             
                end
         | 
| @@ -388,6 +541,9 @@ module Sprout #:nodoc: | |
| 388 541 | 
             
                      $stdout.puts msg
         | 
| 389 542 | 
             
                    end
         | 
| 390 543 |  | 
| 544 | 
            +
                    @inside_test_result = false
         | 
| 545 | 
            +
                    full_output = ''
         | 
| 546 | 
            +
                    test_result = ''
         | 
| 391 547 | 
             
                    char = ''
         | 
| 392 548 | 
             
                    line = ''
         | 
| 393 549 | 
             
                    while true do
         | 
| @@ -403,14 +559,49 @@ module Sprout #:nodoc: | |
| 403 559 | 
             
                        line = ''
         | 
| 404 560 | 
             
                      else
         | 
| 405 561 | 
             
                        line << char
         | 
| 562 | 
            +
                        full_output << char
         | 
| 563 | 
            +
                      end
         | 
| 564 | 
            +
             | 
| 565 | 
            +
                      if(@inside_test_result)
         | 
| 566 | 
            +
                        test_result << char
         | 
| 567 | 
            +
                      else
         | 
| 568 | 
            +
                        @output.print char
         | 
| 569 | 
            +
                        @output.flush
         | 
| 406 570 | 
             
                      end
         | 
| 407 571 |  | 
| 408 | 
            -
                       | 
| 409 | 
            -
             | 
| 572 | 
            +
                      if(!test_result_prelude.nil? && line.index(test_result_prelude))
         | 
| 573 | 
            +
                        test_result = test_result_prelude
         | 
| 574 | 
            +
                        @inside_test_result = true
         | 
| 575 | 
            +
                      end
         | 
| 576 | 
            +
                      
         | 
| 577 | 
            +
                      if(@inside_test_result && line.index(test_result_closing))
         | 
| 578 | 
            +
                        write_test_result(test_result)
         | 
| 579 | 
            +
                        @inside_test_result = false
         | 
| 580 | 
            +
                        Thread.new {
         | 
| 581 | 
            +
                          write("\n")
         | 
| 582 | 
            +
                          write('y')
         | 
| 583 | 
            +
                          write('kill')
         | 
| 584 | 
            +
                          write('y')
         | 
| 585 | 
            +
                          write('quit')
         | 
| 586 | 
            +
                        }
         | 
| 587 | 
            +
                      end
         | 
| 410 588 |  | 
| 411 589 | 
             
                      if(line == PROMPT || line.match(/\(y or n\) $/))
         | 
| 412 | 
            -
                         | 
| 590 | 
            +
                        full_output_cache = full_output
         | 
| 413 591 | 
             
                        line = ''
         | 
| 592 | 
            +
                        full_output = ''
         | 
| 593 | 
            +
                        @prompted = true
         | 
| 594 | 
            +
                        if(should_kill?(full_output_cache))
         | 
| 595 | 
            +
                          Thread.new {
         | 
| 596 | 
            +
                            wait_for_prompt
         | 
| 597 | 
            +
                            write('info stack') # Output the full stack trace
         | 
| 598 | 
            +
                            write('info locals') # Output local variables
         | 
| 599 | 
            +
                            write('kill') # Kill the running SWF file
         | 
| 600 | 
            +
                            write('y') # Confirm killing SWF
         | 
| 601 | 
            +
                            write('quit') # Quit FDB safely
         | 
| 602 | 
            +
                          }
         | 
| 603 | 
            +
                        end
         | 
| 604 | 
            +
             | 
| 414 605 | 
             
                      elsif(@pending_expression && line.match(/#{@pending_expression}/))
         | 
| 415 606 | 
             
                        @found_search = true
         | 
| 416 607 | 
             
                        @pending_expression = nil
         | 
| @@ -424,6 +615,27 @@ module Sprout #:nodoc: | |
| 424 615 | 
             
                  end
         | 
| 425 616 |  | 
| 426 617 | 
             
                end
         | 
| 618 | 
            +
                
         | 
| 619 | 
            +
                def should_kill?(message)
         | 
| 620 | 
            +
                  return (@kill_on_fault && fault_found?(message))
         | 
| 621 | 
            +
                end
         | 
| 622 | 
            +
                
         | 
| 623 | 
            +
                def fault_found?(message)
         | 
| 624 | 
            +
                  match = message.match(/\[Fault\]\s.*,.*$/) 
         | 
| 625 | 
            +
                  return !match.nil?
         | 
| 626 | 
            +
                end
         | 
| 627 | 
            +
                
         | 
| 628 | 
            +
                def clean_test_result(result)
         | 
| 629 | 
            +
                  return result.gsub(/^\[trace\]\s/m, '')
         | 
| 630 | 
            +
                end
         | 
| 631 | 
            +
                
         | 
| 632 | 
            +
                def write_test_result(result)
         | 
| 633 | 
            +
                  result = clean_test_result result
         | 
| 634 | 
            +
                  FileUtils.makedirs(File.dirname(test_result_file))
         | 
| 635 | 
            +
                  File.open(test_result_file, File::CREAT|File::TRUNC|File::RDWR) do |f|
         | 
| 636 | 
            +
                    f.puts(result)
         | 
| 637 | 
            +
                  end
         | 
| 638 | 
            +
                end
         | 
| 427 639 |  | 
| 428 640 | 
             
                # Block for the life of the input process
         | 
| 429 641 | 
             
                def join
         | 
| @@ -431,13 +643,13 @@ module Sprout #:nodoc: | |
| 431 643 | 
             
                  print PROMPT
         | 
| 432 644 | 
             
                  $stdout.flush
         | 
| 433 645 |  | 
| 434 | 
            -
                  Thread.new  | 
| 646 | 
            +
                  t = Thread.new {
         | 
| 435 647 | 
             
                    while true do
         | 
| 436 648 | 
             
                      msg = user_input.gets.chomp!
         | 
| 437 649 | 
             
                      @input.puts msg
         | 
| 438 650 | 
             
                      wait_for_prompt
         | 
| 439 651 | 
             
                    end
         | 
| 440 | 
            -
                   | 
| 652 | 
            +
                  }
         | 
| 441 653 |  | 
| 442 654 | 
             
                  @listener.join
         | 
| 443 655 | 
             
                end
         | 
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            module Sprout
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              
         | 
| 5 | 
            +
              # The MXMLCCruise helper wraps up the fdb and mxmlc unit test tasks by
         | 
| 6 | 
            +
              # using either a Singleton or provided ProjectModel instance.
         | 
| 7 | 
            +
              #
         | 
| 8 | 
            +
              # The simple case that uses a Singleton ProjectModel:
         | 
| 9 | 
            +
              #   ci :cruise
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              # Using a specific ProjectModel instance:
         | 
| 12 | 
            +
              #   project_model :model
         | 
| 13 | 
            +
              #
         | 
| 14 | 
            +
              #   ci :cruise => :model
         | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              # Configuring the proxied MXMLCTask
         | 
| 17 | 
            +
              #   ci :cruise do |t|
         | 
| 18 | 
            +
              #     t.link_report = 'LinkReport.rpt'
         | 
| 19 | 
            +
              #   end
         | 
| 20 | 
            +
              #
         | 
| 21 | 
            +
              class MXMLCCruise < MXMLCHelper
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def initialize(args, &block)
         | 
| 24 | 
            +
                  super
         | 
| 25 | 
            +
                  library :asunit3
         | 
| 26 | 
            +
                  
         | 
| 27 | 
            +
                  mxmlc output do |t|
         | 
| 28 | 
            +
                    configure_mxmlc t
         | 
| 29 | 
            +
                    configure_mxmlc_application t
         | 
| 30 | 
            +
                    t.debug = true
         | 
| 31 | 
            +
                    t.prerequisites << :asunit3
         | 
| 32 | 
            +
                    t.source_path << model.test_dir
         | 
| 33 | 
            +
                    
         | 
| 34 | 
            +
                    if(model.test_width && model.test_height)
         | 
| 35 | 
            +
                      t.default_size = "#{model.test_width} #{model.test_height}"
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                    yield t if block_given?
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  define_fdb
         | 
| 42 | 
            +
                  t = define_outer_task
         | 
| 43 | 
            +
                  t.prerequisites << output
         | 
| 44 | 
            +
                  t.prerequisites << player_task_name
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
                
         | 
| 47 | 
            +
                def create_output
         | 
| 48 | 
            +
                  return "#{create_output_base}XMLRunner.swf"
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                def create_input
         | 
| 52 | 
            +
                  input = super
         | 
| 53 | 
            +
                  input.gsub!(/#{input_extension}$/, "XMLRunner#{input_extension}") 
         | 
| 54 | 
            +
                  return input
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
              
         | 
| 57 | 
            +
              end
         | 
| 58 | 
            +
            end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            def ci(args, &block)
         | 
| 61 | 
            +
              return Sprout::MXMLCCruise.new(args, &block)
         | 
| 62 | 
            +
            end
         | 
| @@ -3,6 +3,8 @@ module Sprout # :nodoc: | |
| 3 3 | 
             
              class MXMLCHelper # :nodoc:
         | 
| 4 4 | 
             
                attr_reader :model
         | 
| 5 5 |  | 
| 6 | 
            +
                attr_accessor :use_fcsh
         | 
| 7 | 
            +
                
         | 
| 6 8 | 
             
                def initialize(args, &block)
         | 
| 7 9 | 
             
                  resolve_task_args(args)
         | 
| 8 10 | 
             
                  @model = get_model args
         | 
| @@ -51,9 +53,13 @@ module Sprout # :nodoc: | |
| 51 53 | 
             
                end
         | 
| 52 54 |  | 
| 53 55 | 
             
                def configure_mxmlc(compiler, is_asdoc=false)
         | 
| 54 | 
            -
                   | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 56 | 
            +
                  if(!is_asdoc)
         | 
| 57 | 
            +
                    compiler.input       = input
         | 
| 58 | 
            +
                    compiler.use_fcsh    = use_fcsh || model.use_fcsh
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  compiler.gem_name    = model.compiler_gem_name
         | 
| 62 | 
            +
                  compiler.gem_version = model.compiler_gem_version
         | 
| 57 63 |  | 
| 58 64 | 
             
                  # Set up library deps
         | 
| 59 65 | 
             
                  model.libraries.each do |lib|
         | 
| @@ -94,6 +100,15 @@ module Sprout # :nodoc: | |
| 94 100 | 
             
                  end
         | 
| 95 101 | 
             
                end
         | 
| 96 102 |  | 
| 103 | 
            +
                def define_fdb
         | 
| 104 | 
            +
                  fdb player_task_name do |t|
         | 
| 105 | 
            +
                    t.file = output_file
         | 
| 106 | 
            +
                    t.kill_on_fault = true
         | 
| 107 | 
            +
                    t.run
         | 
| 108 | 
            +
                    t.continue
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
                end
         | 
| 111 | 
            +
                
         | 
| 97 112 | 
             
                def define_outer_task
         | 
| 98 113 | 
             
                  t = task task_name
         | 
| 99 114 | 
             
                  self.prerequisites.each do |dep|
         | 
| @@ -60,6 +60,11 @@ module Sprout | |
| 60 60 | 
             
              #
         | 
| 61 61 | 
             
              class MXMLCTask < ToolTask
         | 
| 62 62 |  | 
| 63 | 
            +
                # Use a running instance of the FCSH command shell to speed up compilation.
         | 
| 64 | 
            +
                # You need to run 'rake fcsh:start' in another terminal before turning on 
         | 
| 65 | 
            +
                # this flag and compiling.
         | 
| 66 | 
            +
                attr_accessor :use_fcsh
         | 
| 67 | 
            +
             | 
| 63 68 | 
             
                # Interface and descriptions found here:
         | 
| 64 69 | 
             
                # http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001481.html
         | 
| 65 70 | 
             
                def initialize_task
         | 
| @@ -683,13 +688,9 @@ EOF | |
| 683 688 | 
             
                    end
         | 
| 684 689 | 
             
                  end
         | 
| 685 690 |  | 
| 686 | 
            -
                  if(!input.match(/.css/) && File.exists?(input))
         | 
| 691 | 
            +
                  if(input && !input.match(/.css/) && File.exists?(input))
         | 
| 687 692 | 
             
                    source_path << File.dirname(input)
         | 
| 688 693 | 
             
                  end
         | 
| 689 | 
            -
             | 
| 690 | 
            -
                  if(!input)
         | 
| 691 | 
            -
                    raise MXMLCError.new('MXMLCTask.input is a required field')
         | 
| 692 | 
            -
                  end
         | 
| 693 694 |  | 
| 694 695 | 
             
                  if(link_report)
         | 
| 695 696 | 
             
                    CLEAN.add(link_report)
         | 
| @@ -743,9 +744,23 @@ EOF | |
| 743 744 | 
             
                  end
         | 
| 744 745 | 
             
                end
         | 
| 745 746 |  | 
| 747 | 
            +
                def execute_with_fcsh(command)
         | 
| 748 | 
            +
                  begin
         | 
| 749 | 
            +
                    puts FCSHSocket.execute("mxmlc #{command}")
         | 
| 750 | 
            +
                  rescue FCSHError => fcsh_error
         | 
| 751 | 
            +
                    raise fcsh_error
         | 
| 752 | 
            +
                  rescue StandardError => std_error
         | 
| 753 | 
            +
                    raise StandardError("[ERROR] There was a problem connecting to the Flex Compiler SHell, run 'rake fcsh:start' in another terminal.")
         | 
| 754 | 
            +
                  end
         | 
| 755 | 
            +
                end
         | 
| 756 | 
            +
                
         | 
| 746 757 | 
             
                def execute(*args)
         | 
| 747 758 | 
             
                  begin
         | 
| 748 | 
            -
                     | 
| 759 | 
            +
                    if(@use_fcsh)
         | 
| 760 | 
            +
                      execute_with_fcsh(to_shell)
         | 
| 761 | 
            +
                    else
         | 
| 762 | 
            +
                      super
         | 
| 763 | 
            +
                    end
         | 
| 749 764 | 
             
                  rescue ExecutionError => e
         | 
| 750 765 | 
             
                    if(e.message.index('Warning:'))
         | 
| 751 766 | 
             
                      # MXMLC sends warnings to stderr....
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            module Sprout
         | 
| 3 3 |  | 
| 4 4 |  | 
| 5 | 
            -
              # The MXMLCUnit helper wraps up  | 
| 5 | 
            +
              # The MXMLCUnit helper wraps up flashplayer and mxmlc unit test tasks by
         | 
| 6 6 | 
             
              # using either a Singleton or provided ProjectModel instance.
         | 
| 7 7 | 
             
              #
         | 
| 8 8 | 
             
              # The simple case that uses a Singleton ProjectModel:
         | 
    
        data/rakefile.rb
    CHANGED
    
    | @@ -63,7 +63,8 @@ spec = Gem::Specification.new do |s| | |
| 63 63 | 
             
              s.rdoc_options        << '-i'             << '.'
         | 
| 64 64 | 
             
              s.files               = PKG_LIST.to_a
         | 
| 65 65 |  | 
| 66 | 
            -
              s.add_dependency('sprout', '>= 0.7. | 
| 66 | 
            +
              s.add_dependency('sprout', '>= 0.7.196')
         | 
| 67 | 
            +
              s.add_dependency('sprout-asunit3-library', '>= 3.2.6')
         | 
| 67 68 | 
             
            end
         | 
| 68 69 |  | 
| 69 70 | 
             
            Rake::GemPackageTask.new(spec) do |p|
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sprout-as3-bundle
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 1.0.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Pattern Park
         | 
| @@ -9,7 +9,7 @@ autorequire: sprout/as3 | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2009-01-06 00:00:00 -08:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -20,7 +20,17 @@ dependencies: | |
| 20 20 | 
             
                requirements: 
         | 
| 21 21 | 
             
                - - ">="
         | 
| 22 22 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 23 | 
            -
                    version: 0.7. | 
| 23 | 
            +
                    version: 0.7.196
         | 
| 24 | 
            +
                version: 
         | 
| 25 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 26 | 
            +
              name: sprout-asunit3-library
         | 
| 27 | 
            +
              type: :runtime
         | 
| 28 | 
            +
              version_requirement: 
         | 
| 29 | 
            +
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 30 | 
            +
                requirements: 
         | 
| 31 | 
            +
                - - ">="
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 33 | 
            +
                    version: 3.2.6
         | 
| 24 34 | 
             
                version: 
         | 
| 25 35 | 
             
            description: Code Generation and Rake Tasks for ActionScript 3.0 Development
         | 
| 26 36 | 
             
            email: projectsprouts@googlegroups.com
         | 
| @@ -42,6 +52,9 @@ files: | |
| 42 52 | 
             
            - lib/sprout/as3/version.rb
         | 
| 43 53 | 
             
            - lib/sprout/as3.rb
         | 
| 44 54 | 
             
            - lib/sprout/as3_tasks.rb
         | 
| 55 | 
            +
            - lib/sprout/fcsh_lexer.rb
         | 
| 56 | 
            +
            - lib/sprout/fcsh_service.rb
         | 
| 57 | 
            +
            - lib/sprout/fcsh_socket.rb
         | 
| 45 58 | 
             
            - lib/sprout/generators
         | 
| 46 59 | 
             
            - lib/sprout/generators/class
         | 
| 47 60 | 
             
            - lib/sprout/generators/class/class_generator.rb
         | 
| @@ -67,6 +80,7 @@ files: | |
| 67 80 | 
             
            - lib/sprout/generators/project/templates/rakefile.rb
         | 
| 68 81 | 
             
            - lib/sprout/generators/project/templates/README.txt
         | 
| 69 82 | 
             
            - lib/sprout/generators/project/templates/TestRunner.as
         | 
| 83 | 
            +
            - lib/sprout/generators/project/templates/XMLRunner.as
         | 
| 70 84 | 
             
            - lib/sprout/generators/suite
         | 
| 71 85 | 
             
            - lib/sprout/generators/suite/suite_generator.rb
         | 
| 72 86 | 
             
            - lib/sprout/generators/suite/templates
         | 
| @@ -80,27 +94,23 @@ files: | |
| 80 94 | 
             
            - lib/sprout/generators/test/USAGE
         | 
| 81 95 | 
             
            - lib/sprout/tasks
         | 
| 82 96 | 
             
            - lib/sprout/tasks/adl_documentation.rb
         | 
| 83 | 
            -
            - lib/sprout/tasks/adl_rdoc.rb
         | 
| 84 97 | 
             
            - lib/sprout/tasks/adl_task.rb
         | 
| 85 98 | 
             
            - lib/sprout/tasks/adt_cert_documentation.rb
         | 
| 86 | 
            -
            - lib/sprout/tasks/adt_cert_rdoc.rb
         | 
| 87 99 | 
             
            - lib/sprout/tasks/adt_documentation.rb
         | 
| 88 | 
            -
            - lib/sprout/tasks/adt_rdoc.rb
         | 
| 89 100 | 
             
            - lib/sprout/tasks/adt_task.rb
         | 
| 90 | 
            -
            - lib/sprout/tasks/ | 
| 101 | 
            +
            - lib/sprout/tasks/asdoc_documentation.rb
         | 
| 91 102 | 
             
            - lib/sprout/tasks/asdoc_task.rb
         | 
| 92 103 | 
             
            - lib/sprout/tasks/compc_documentation.rb
         | 
| 93 | 
            -
            - lib/sprout/tasks/compc_rdoc.rb
         | 
| 94 104 | 
             
            - lib/sprout/tasks/compc_task.rb
         | 
| 95 | 
            -
            - lib/sprout/tasks/ | 
| 105 | 
            +
            - lib/sprout/tasks/fcsh.rb
         | 
| 96 106 | 
             
            - lib/sprout/tasks/fdb_task.rb
         | 
| 107 | 
            +
            - lib/sprout/tasks/mxmlc_ci.rb
         | 
| 97 108 | 
             
            - lib/sprout/tasks/mxmlc_debug.rb
         | 
| 98 109 | 
             
            - lib/sprout/tasks/mxmlc_deploy.rb
         | 
| 99 110 | 
             
            - lib/sprout/tasks/mxmlc_document.rb
         | 
| 100 111 | 
             
            - lib/sprout/tasks/mxmlc_documentation.rb
         | 
| 101 112 | 
             
            - lib/sprout/tasks/mxmlc_flex_builder.rb
         | 
| 102 113 | 
             
            - lib/sprout/tasks/mxmlc_helper.rb
         | 
| 103 | 
            -
            - lib/sprout/tasks/mxmlc_rdoc.rb
         | 
| 104 114 | 
             
            - lib/sprout/tasks/mxmlc_stylesheet.rb
         | 
| 105 115 | 
             
            - lib/sprout/tasks/mxmlc_swc.rb
         | 
| 106 116 | 
             
            - lib/sprout/tasks/mxmlc_task.rb
         | 
| @@ -136,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 136 146 | 
             
            requirements: []
         | 
| 137 147 |  | 
| 138 148 | 
             
            rubyforge_project: sprout
         | 
| 139 | 
            -
            rubygems_version: 1. | 
| 149 | 
            +
            rubygems_version: 1.3.1
         | 
| 140 150 | 
             
            signing_key: 
         | 
| 141 151 | 
             
            specification_version: 2
         | 
| 142 152 | 
             
            summary: Project and Code Generators for ActionScript 3 Development
         |