jsus 0.3.6 → 0.4.0
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/.travis.yml +2 -0
 - data/CHANGELOG +5 -0
 - data/Gemfile +7 -4
 - data/VERSION +1 -1
 - data/bin/jsus +1 -5
 - data/cucumber.yml +1 -1
 - data/features/command-line/external_dependency_resolution.feature +4 -4
 - data/features/command-line/generate_includes.feature +34 -0
 - data/features/command-line/mooforge_compatibility_layer.feature +1 -1
 - data/features/command-line/postproc.feature +12 -3
 - data/features/command-line/structure_json.feature +5 -40
 - data/features/data/ExternalDependencyWithExternalDependency/Leonardo/Source/Core.js +2 -2
 - data/features/step_definitions/cli_steps.rb +15 -9
 - data/features/support/env.rb +1 -1
 - data/jsus.gemspec +25 -7
 - data/lib/extensions/rgl.rb +2 -1
 - data/lib/jsus/cli.rb +43 -27
 - data/lib/jsus/container.rb +71 -51
 - data/lib/jsus/middleware.rb +2 -3
 - data/lib/jsus/package.rb +27 -129
 - data/lib/jsus/packager.rb +10 -6
 - data/lib/jsus/pool.rb +48 -20
 - data/lib/jsus/source_file.rb +119 -198
 - data/lib/jsus/tag.rb +72 -106
 - data/lib/jsus/util.rb +14 -4
 - data/lib/jsus/util/compressor.rb +1 -1
 - data/lib/jsus/util/documenter.rb +1 -1
 - data/lib/jsus/util/mixins.rb +7 -0
 - data/lib/jsus/util/mixins/operates_on_sources.rb +29 -0
 - data/lib/jsus/util/post_processor.rb +35 -0
 - data/lib/jsus/util/post_processor/base.rb +32 -0
 - data/lib/jsus/util/post_processor/moocompat12.rb +19 -0
 - data/lib/jsus/util/post_processor/mooltie8.rb +19 -0
 - data/lib/jsus/util/post_processor/semicolon.rb +18 -0
 - data/lib/jsus/util/validator/base.rb +3 -23
 - data/lib/jsus/util/watcher.rb +8 -6
 - data/spec/data/Extensions/app/javascripts/Core/Source/Hash.js +13 -0
 - data/spec/data/Extensions/app/javascripts/Core/Source/Mash.js +13 -0
 - data/spec/data/Extensions/app/javascripts/Core/package.yml +3 -1
 - data/spec/data/Extensions/app/javascripts/Orwik/Extensions/Mash.js +16 -0
 - data/spec/data/Extensions/app/javascripts/Orwik/package.yml +2 -1
 - data/spec/data/OutsideDependencies/app/javascripts/Orwik/package.yml +3 -3
 - data/spec/data/SimpleSources/dependent_source_one.js +15 -0
 - data/spec/data/SimpleSources/replacement_source_one.js +13 -0
 - data/spec/data/SimpleSources/simple_source_one.js +13 -0
 - data/spec/data/SimpleSources/simple_source_two.js +13 -0
 - data/spec/data/extension_1.js +15 -0
 - data/spec/data/extension_2.js +15 -0
 - data/spec/data/replacement.js +15 -0
 - data/spec/jsus/container_spec.rb +72 -14
 - data/spec/jsus/package_spec.rb +10 -128
 - data/spec/jsus/packager_spec.rb +11 -11
 - data/spec/jsus/pool_spec.rb +13 -22
 - data/spec/jsus/source_file_spec.rb +66 -215
 - data/spec/jsus/tag_spec.rb +24 -69
 - data/spec/jsus/util/documenter_spec.rb +1 -1
 - data/spec/jsus/util/post_processor/moocompat12_spec.rb +23 -0
 - data/spec/jsus/util/post_processor/mooltie8_spec.rb +23 -0
 - data/spec/jsus/util/post_processor/semicolon_spec.rb +21 -0
 - data/spec/jsus/util/post_processors/base_spec.rb +6 -0
 - data/spec/jsus/util/tree_spec.rb +3 -3
 - data/spec/jsus/util/validator/base_spec.rb +4 -2
 - data/spec/jsus/util/watcher_spec.rb +12 -2
 - data/spec/shared/mixins_segs.rb +38 -0
 - data/spec/spec_helper.rb +6 -0
 - metadata +28 -10
 - data/features/data/tmp2/package.js +0 -35
 - data/features/data/tmp2/scripts.json +0 -13
 - data/features/data/tmp2/tree.json +0 -26
 - data/lib/jsus/compiler.rb +0 -28
 - data/spec/shared/class_stubs.rb +0 -31
 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -15,12 +15,15 @@ group :development do 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              gem "jeweler"
         
     | 
| 
       17 
17 
     | 
    
         
             
              gem "murdoc", "~> 0.1.11"
         
     | 
| 
       18 
     | 
    
         
            -
              gem "ruby-debug19", :platforms => :ruby_19
         
     | 
| 
       19 
18 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
              unless ENV["CI"]
         
     | 
| 
      
 20 
     | 
    
         
            +
                gem "ruby-debug19", :platforms => :ruby_19
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                # FIXME: linecache being ruby1.9+only
         
     | 
| 
      
 23 
     | 
    
         
            +
                gem "linecache", "= 0.45", :platforms => :mri_18
         
     | 
| 
      
 24 
     | 
    
         
            +
                gem "ruby-debug",   :platforms => :mri_18
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
       22 
26 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              gem "ruby-debug",   :platforms => :ruby_18
         
     | 
| 
       24 
27 
     | 
    
         
             
              gem 'fssm'
         
     | 
| 
       25 
28 
     | 
    
         | 
| 
       26 
29 
     | 
    
         
             
              gem 'yuicompressor',    :require => false
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.4.0
         
     | 
    
        data/bin/jsus
    CHANGED
    
    | 
         @@ -68,7 +68,7 @@ cli = OptionParser.new do |opts| 
     | 
|
| 
       68 
68 
     | 
    
         
             
                options[:validators] = (validators || []).map {|v| v.downcase }
         
     | 
| 
       69 
69 
     | 
    
         
             
              end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
              opts.on('--postproc [*PROCESSORS]', Array, 'performs postprocessing. Available postprocs:\n* moocompat12 -- removes mootools 1.2compat tags and their contents\n* mooltIE8 -- removes mootools ltIE8 compat tags and their contents') do |postprocs|
         
     | 
| 
      
 71 
     | 
    
         
            +
              opts.on('--postproc [*PROCESSORS]', Array, 'performs postprocessing. Available postprocs:\n* moocompat12 -- removes mootools 1.2compat tags and their contents\n* mooltIE8 -- removes mootools ltIE8 compat tags and their contents\n* semicolon -- adds a semicolon in the beggining of every source file') do |postprocs|
         
     | 
| 
       72 
72 
     | 
    
         
             
                options[:postproc] = postprocs
         
     | 
| 
       73 
73 
     | 
    
         
             
              end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
         @@ -97,10 +97,6 @@ cli = OptionParser.new do |opts| 
     | 
|
| 
       97 
97 
     | 
    
         
             
                options[:without_scripts_info] = true
         
     | 
| 
       98 
98 
     | 
    
         
             
              end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
              opts.on_tail('--without-tree-info', 'do not generate tree.json') do
         
     | 
| 
       101 
     | 
    
         
            -
                options[:without_tree_info] = true
         
     | 
| 
       102 
     | 
    
         
            -
              end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
100 
     | 
    
         
             
              opts.on_tail('--watch', 'watch file system events for *.js files in subdirectories and rerun jsus with the same parameters') do
         
     | 
| 
       105 
101 
     | 
    
         
             
                options[:watch] = true
         
     | 
| 
       106 
102 
     | 
    
         
             
              end
         
     | 
    
        data/cucumber.yml
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            default: --format pretty --color
         
     | 
| 
      
 1 
     | 
    
         
            +
            default: "--format pretty --color --tags ~@wip"
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Feature: external dependencies
         
     | 
| 
       2 
2 
     | 
    
         
             
              In order to resolve dependencies, jsus should be able to preload them into
         
     | 
| 
       3 
3 
     | 
    
         
             
              pool.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       5 
5 
     | 
    
         
             
              Scenario: basic external dependency
         
     | 
| 
       6 
6 
     | 
    
         
             
                When I run "jsus ExternalDependency tmp -d ExternalDependency/Mootools"
         
     | 
| 
       7 
7 
     | 
    
         
             
                Then the following files should exist:
         
     | 
| 
         @@ -48,7 +48,7 @@ Feature: external dependencies 
     | 
|
| 
       48 
48 
     | 
    
         
             
                  */
         
     | 
| 
       49 
49 
     | 
    
         
             
                  """
         
     | 
| 
       50 
50 
     | 
    
         
             
                And file "tmp/package.js" should have "script: Core.js" before "script: Color.js"
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       52 
52 
     | 
    
         
             
              Scenario: external dependency with external dependency
         
     | 
| 
       53 
53 
     | 
    
         
             
                When I run "jsus ExternalDependencyWithExternalDependency tmp -d ExternalDependencyWithExternalDependency"
         
     | 
| 
       54 
54 
     | 
    
         
             
                Then the following files should exist:
         
     | 
| 
         @@ -67,7 +67,7 @@ Feature: external dependencies 
     | 
|
| 
       67 
67 
     | 
    
         
             
                  authors:
         
     | 
| 
       68 
68 
     | 
    
         
             
                    - Mark Abramov
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                  requires: 
     | 
| 
      
 70 
     | 
    
         
            +
                  requires:
         
     | 
| 
       71 
71 
     | 
    
         
             
                    - Mootools/Core
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
73 
     | 
    
         
             
                  provides: [Core]
         
     | 
| 
         @@ -117,4 +117,4 @@ Feature: external dependencies 
     | 
|
| 
       117 
117 
     | 
    
         
             
                  */
         
     | 
| 
       118 
118 
     | 
    
         
             
                  """
         
     | 
| 
       119 
119 
     | 
    
         
             
                And file "tmp/package.js" should have "Mootools fake core" before "Leonardo fake core"
         
     | 
| 
       120 
     | 
    
         
            -
                And file "tmp/package.js" should have "Leonardo fake core" before "script: Color.js"
         
     | 
| 
      
 120 
     | 
    
         
            +
                And file "tmp/package.js" should have "Leonardo fake core" before "script: Color.js"
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Feature: generate includes.js
         
     | 
| 
      
 2 
     | 
    
         
            +
              In order to be able to quickly iterate over js files, I need to be able to generate
         
     | 
| 
      
 3 
     | 
    
         
            +
              includes.js files with load instructions for browser in correct order.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              Scenario: using -g option
         
     | 
| 
      
 6 
     | 
    
         
            +
                When I run "jsus Basic tmp -g"
         
     | 
| 
      
 7 
     | 
    
         
            +
                Then the following files should exist:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  | tmp/includes.js    |
         
     | 
| 
      
 9 
     | 
    
         
            +
                And file "tmp/includes.js" should contain
         
     | 
| 
      
 10 
     | 
    
         
            +
                """
         
     | 
| 
      
 11 
     | 
    
         
            +
                Library/Color.js
         
     | 
| 
      
 12 
     | 
    
         
            +
                """
         
     | 
| 
      
 13 
     | 
    
         
            +
                And file "tmp/includes.js" should contain
         
     | 
| 
      
 14 
     | 
    
         
            +
                """
         
     | 
| 
      
 15 
     | 
    
         
            +
                Widget/Input/Input.Color.js
         
     | 
| 
      
 16 
     | 
    
         
            +
                """
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              Scenario: using --generate-include option to override includes root
         
     | 
| 
      
 19 
     | 
    
         
            +
                When I run "jsus Basic tmp --generate-includes=Basic/Source/Library"
         
     | 
| 
      
 20 
     | 
    
         
            +
                Then the following files should exist:
         
     | 
| 
      
 21 
     | 
    
         
            +
                  | tmp/includes.js    |
         
     | 
| 
      
 22 
     | 
    
         
            +
                And file "tmp/includes.js" should contain
         
     | 
| 
      
 23 
     | 
    
         
            +
                """
         
     | 
| 
      
 24 
     | 
    
         
            +
                Color.js
         
     | 
| 
      
 25 
     | 
    
         
            +
                """
         
     | 
| 
      
 26 
     | 
    
         
            +
                And file "tmp/includes.js" should not contain
         
     | 
| 
      
 27 
     | 
    
         
            +
                """
         
     | 
| 
      
 28 
     | 
    
         
            +
                Library/Color.js
         
     | 
| 
      
 29 
     | 
    
         
            +
                """
         
     | 
| 
      
 30 
     | 
    
         
            +
                And file "tmp/includes.js" should contain
         
     | 
| 
      
 31 
     | 
    
         
            +
                """
         
     | 
| 
      
 32 
     | 
    
         
            +
                ../Widget/Input/Input.Color.js
         
     | 
| 
      
 33 
     | 
    
         
            +
                """
         
     | 
| 
      
 34 
     | 
    
         
            +
                And file "tmp/includes.js" should have "Color.js" before "Input.Color.js"
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Feature: postprocessing
         
     | 
| 
       2 
     | 
    
         
            -
              In order to leave unneccessary compatibility code out, I should be able to 
     | 
| 
      
 2 
     | 
    
         
            +
              In order to leave unneccessary compatibility code out, I should be able to
         
     | 
| 
       3 
3 
     | 
    
         
             
              use postprocessing feature.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       5 
5 
     | 
    
         
             
              Scenario: compat12
         
     | 
| 
       6 
6 
     | 
    
         
             
                When I run "jsus Postprocessing/MootoolsCompat12 tmp --postproc moocompat12"
         
     | 
| 
       7 
7 
     | 
    
         
             
                Then the following files should exist:
         
     | 
| 
         @@ -37,7 +37,7 @@ Feature: postprocessing 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  """
         
     | 
| 
       38 
38 
     | 
    
         
             
                  var incompatible = true;
         
     | 
| 
       39 
39 
     | 
    
         
             
                  """
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       41 
41 
     | 
    
         
             
              Scenario: mooltIE8
         
     | 
| 
       42 
42 
     | 
    
         
             
                When I run "jsus Postprocessing/MootoolsLtIE8 tmp --postproc mooltIE8"
         
     | 
| 
       43 
43 
     | 
    
         
             
                Then the following files should exist:
         
     | 
| 
         @@ -73,3 +73,12 @@ Feature: postprocessing 
     | 
|
| 
       73 
73 
     | 
    
         
             
                  """
         
     | 
| 
       74 
74 
     | 
    
         
             
                  var incompatible = true;
         
     | 
| 
       75 
75 
     | 
    
         
             
                  """
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              Scenario: semicolon
         
     | 
| 
      
 78 
     | 
    
         
            +
                When I run "jsus Postprocessing/MootoolsLtIE8 tmp --postproc semicolon"
         
     | 
| 
      
 79 
     | 
    
         
            +
                Then the following files should exist:
         
     | 
| 
      
 80 
     | 
    
         
            +
                  | tmp/package.js |
         
     | 
| 
      
 81 
     | 
    
         
            +
                And file "tmp/package.js" should begin with
         
     | 
| 
      
 82 
     | 
    
         
            +
                  """
         
     | 
| 
      
 83 
     | 
    
         
            +
                  ;
         
     | 
| 
      
 84 
     | 
    
         
            +
                  """
         
     | 
| 
         @@ -1,42 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Feature: structure json files
         
     | 
| 
       2 
2 
     | 
    
         
             
              In order to have programmatic ability to introspect resulting packages, we
         
     | 
| 
       3 
3 
     | 
    
         
             
              generate some extra files.
         
     | 
| 
       4 
     | 
    
         
            -
              
         
     | 
| 
       5 
     | 
    
         
            -
              Scenario: auto-generation of tree.json and scripts.json
         
     | 
| 
       6 
     | 
    
         
            -
                When I run "jsus Basic tmp"
         
     | 
| 
       7 
     | 
    
         
            -
                Then the following files should exist:
         
     | 
| 
       8 
     | 
    
         
            -
                  | tmp/tree.json    |
         
     | 
| 
       9 
     | 
    
         
            -
                  | tmp/scripts.json |
         
     | 
| 
       10 
     | 
    
         
            -
                And file "tmp/tree.json" should contain valid JSON
         
     | 
| 
       11 
     | 
    
         
            -
                And file "tmp/tree.json" should contain JSON equivalent to
         
     | 
| 
       12 
     | 
    
         
            -
                  """
         
     | 
| 
       13 
     | 
    
         
            -
                  {
         
     | 
| 
       14 
     | 
    
         
            -
                    "Library": {
         
     | 
| 
       15 
     | 
    
         
            -
                      "Color": {
         
     | 
| 
       16 
     | 
    
         
            -
                        "desc": "A library to work with colors",
         
     | 
| 
       17 
     | 
    
         
            -
                        "requires": [
         
     | 
| 
       18 
4 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                          "Color"
         
     | 
| 
       22 
     | 
    
         
            -
                        ]
         
     | 
| 
       23 
     | 
    
         
            -
                      }
         
     | 
| 
       24 
     | 
    
         
            -
                    },
         
     | 
| 
       25 
     | 
    
         
            -
                    "Widget": {
         
     | 
| 
       26 
     | 
    
         
            -
                      "Input": {
         
     | 
| 
       27 
     | 
    
         
            -
                        "Input.Color": {
         
     | 
| 
       28 
     | 
    
         
            -
                          "desc": "Cool colorpicker for everyone to enjoy",
         
     | 
| 
       29 
     | 
    
         
            -
                          "requires": [
         
     | 
| 
       30 
     | 
    
         
            -
                            "Color"
         
     | 
| 
       31 
     | 
    
         
            -
                          ],
         
     | 
| 
       32 
     | 
    
         
            -
                          "provides": [
         
     | 
| 
       33 
     | 
    
         
            -
                            "Input.Color"
         
     | 
| 
       34 
     | 
    
         
            -
                          ]
         
     | 
| 
       35 
     | 
    
         
            -
                        }
         
     | 
| 
       36 
     | 
    
         
            -
                      }
         
     | 
| 
       37 
     | 
    
         
            -
                    }
         
     | 
| 
       38 
     | 
    
         
            -
                  }
         
     | 
| 
       39 
     | 
    
         
            -
                  """
         
     | 
| 
      
 5 
     | 
    
         
            +
              Scenario: auto-generation scripts.json
         
     | 
| 
      
 6 
     | 
    
         
            +
                When I run "jsus Basic tmp"
         
     | 
| 
       40 
7 
     | 
    
         
             
                And file "tmp/scripts.json" should contain valid JSON
         
     | 
| 
       41 
8 
     | 
    
         
             
                And file "tmp/scripts.json" should contain JSON equivalent to
         
     | 
| 
       42 
9 
     | 
    
         
             
                  """
         
     | 
| 
         @@ -44,13 +11,11 @@ Feature: structure json files 
     | 
|
| 
       44 
11 
     | 
    
         
             
                    "Package": {
         
     | 
| 
       45 
12 
     | 
    
         
             
                      "desc": "Jsus package with correct order set",
         
     | 
| 
       46 
13 
     | 
    
         
             
                      "provides": [
         
     | 
| 
       47 
     | 
    
         
            -
                        "Color",
         
     | 
| 
       48 
     | 
    
         
            -
                        "Input.Color"
         
     | 
| 
      
 14 
     | 
    
         
            +
                        "Package/Color",
         
     | 
| 
      
 15 
     | 
    
         
            +
                        "Package/Input.Color"
         
     | 
| 
       49 
16 
     | 
    
         
             
                      ],
         
     | 
| 
       50 
17 
     | 
    
         
             
                      "requires": [
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
18 
     | 
    
         
             
                      ]
         
     | 
| 
       53 
19 
     | 
    
         
             
                    }
         
     | 
| 
       54 
     | 
    
         
            -
                  } 
     | 
| 
      
 20 
     | 
    
         
            +
                  }
         
     | 
| 
       55 
21 
     | 
    
         
             
                  """
         
     | 
| 
       56 
     | 
    
         
            -
                
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            When /^I run "jsus (.*?)"$/ do |args|
         
     | 
| 
       2 
2 
     | 
    
         
             
              Dir.chdir DATA_DIR do
         
     | 
| 
       3 
3 
     | 
    
         
             
                `#{JSUS_CLI_PATH} #{args}`
         
     | 
| 
       4 
     | 
    
         
            -
              end 
     | 
| 
      
 4 
     | 
    
         
            +
              end
         
     | 
| 
       5 
5 
     | 
    
         
             
            end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Then /^the following files should exist:$/ do |table|
         
     | 
| 
         @@ -14,16 +14,22 @@ Then /^the following files should exist:$/ do |table| 
     | 
|
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            Then /^file "(.*?)" should contain$/ do |filename, content|
         
     | 
| 
       17 
     | 
    
         
            -
              Dir.chdir DATA_DIR do 
     | 
| 
      
 17 
     | 
    
         
            +
              Dir.chdir DATA_DIR do
         
     | 
| 
       18 
18 
     | 
    
         
             
                File.read(filename).should include(content)
         
     | 
| 
       19 
     | 
    
         
            -
              end 
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            Then /^file "(.*?)" should begin with$/ do |filename, content|
         
     | 
| 
      
 23 
     | 
    
         
            +
              Dir.chdir DATA_DIR do
         
     | 
| 
      
 24 
     | 
    
         
            +
                File.read(filename).index(content).should == 0
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
       20 
26 
     | 
    
         
             
            end
         
     | 
| 
       21 
27 
     | 
    
         | 
| 
       22 
28 
     | 
    
         | 
| 
       23 
29 
     | 
    
         
             
            Then /^file "(.*?)" should not contain$/ do |filename, content|
         
     | 
| 
       24 
     | 
    
         
            -
              Dir.chdir DATA_DIR do 
     | 
| 
      
 30 
     | 
    
         
            +
              Dir.chdir DATA_DIR do
         
     | 
| 
       25 
31 
     | 
    
         
             
                File.read(filename).should_not include(content)
         
     | 
| 
       26 
     | 
    
         
            -
              end 
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
       27 
33 
     | 
    
         
             
            end
         
     | 
| 
       28 
34 
     | 
    
         | 
| 
       29 
35 
     | 
    
         
             
            Then /^file "(.*?)" should contain valid JSON$/i do |filename|
         
     | 
| 
         @@ -31,7 +37,7 @@ Then /^file "(.*?)" should contain valid JSON$/i do |filename| 
     | 
|
| 
       31 
37 
     | 
    
         
             
                json = nil
         
     | 
| 
       32 
38 
     | 
    
         
             
                lambda { json = JSON.load(File.read(filename)) }.should_not raise_error
         
     | 
| 
       33 
39 
     | 
    
         
             
                json.should_not be_nil
         
     | 
| 
       34 
     | 
    
         
            -
              end 
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
       35 
41 
     | 
    
         
             
            end
         
     | 
| 
       36 
42 
     | 
    
         | 
| 
       37 
43 
     | 
    
         
             
            Then /^file "(.*?)" should contain JSON equivalent to$/i do |filename, expected_json|
         
     | 
| 
         @@ -39,7 +45,7 @@ Then /^file "(.*?)" should contain JSON equivalent to$/i do |filename, expected_ 
     | 
|
| 
       39 
45 
     | 
    
         
             
                json = JSON.load(File.read(filename))
         
     | 
| 
       40 
46 
     | 
    
         
             
                expected = JSON.load(expected_json)
         
     | 
| 
       41 
47 
     | 
    
         
             
                json.should == expected
         
     | 
| 
       42 
     | 
    
         
            -
              end 
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
       43 
49 
     | 
    
         
             
            end
         
     | 
| 
       44 
50 
     | 
    
         | 
| 
       45 
51 
     | 
    
         | 
| 
         @@ -49,7 +55,7 @@ Then /^file "(.*?)" should have "(.*?)" (before|after) "(.*?)"$/ do |filename, w 
     | 
|
| 
       49 
55 
     | 
    
         
             
                contents = File.read(filename)
         
     | 
| 
       50 
56 
     | 
    
         
             
                position << contents.index(what)
         
     | 
| 
       51 
57 
     | 
    
         
             
                position << contents.index(other)
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       53 
59 
     | 
    
         
             
                case position
         
     | 
| 
       54 
60 
     | 
    
         
             
                when "before"
         
     | 
| 
       55 
61 
     | 
    
         
             
                  position[0].should < position[1]
         
     | 
| 
         @@ -57,4 +63,4 @@ Then /^file "(.*?)" should have "(.*?)" (before|after) "(.*?)"$/ do |filename, w 
     | 
|
| 
       57 
63 
     | 
    
         
             
                  position[1].should < position[0]
         
     | 
| 
       58 
64 
     | 
    
         
             
                end
         
     | 
| 
       59 
65 
     | 
    
         
             
              end
         
     | 
| 
       60 
     | 
    
         
            -
            end
         
     | 
| 
      
 66 
     | 
    
         
            +
            end
         
     | 
    
        data/features/support/env.rb
    CHANGED
    
    
    
        data/jsus.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{jsus}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.4.0"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Mark Abramov"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2011- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2011-11-01}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.default_executable = %q{jsus}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.description = %q{Javascript packager and dependency resolver}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.email = %q{markizko@gmail.com}
         
     | 
| 
         @@ -38,6 +38,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       38 
38 
     | 
    
         
             
                "features/command-line/compression.feature",
         
     | 
| 
       39 
39 
     | 
    
         
             
                "features/command-line/extensions.feature",
         
     | 
| 
       40 
40 
     | 
    
         
             
                "features/command-line/external_dependency_resolution.feature",
         
     | 
| 
      
 41 
     | 
    
         
            +
                "features/command-line/generate_includes.feature",
         
     | 
| 
       41 
42 
     | 
    
         
             
                "features/command-line/json_package.feature",
         
     | 
| 
       42 
43 
     | 
    
         
             
                "features/command-line/mooforge_compatibility_layer.feature",
         
     | 
| 
       43 
44 
     | 
    
         
             
                "features/command-line/postproc.feature",
         
     | 
| 
         @@ -88,16 +89,12 @@ Gem::Specification.new do |s| 
     | 
|
| 
       88 
89 
     | 
    
         
             
                "features/data/Replacements/Source/Library/Color.js",
         
     | 
| 
       89 
90 
     | 
    
         
             
                "features/data/Replacements/package.yml",
         
     | 
| 
       90 
91 
     | 
    
         
             
                "features/data/compression.min.js",
         
     | 
| 
       91 
     | 
    
         
            -
                "features/data/tmp2/package.js",
         
     | 
| 
       92 
     | 
    
         
            -
                "features/data/tmp2/scripts.json",
         
     | 
| 
       93 
     | 
    
         
            -
                "features/data/tmp2/tree.json",
         
     | 
| 
       94 
92 
     | 
    
         
             
                "features/step_definitions/cli_steps.rb",
         
     | 
| 
       95 
93 
     | 
    
         
             
                "features/support/env.rb",
         
     | 
| 
       96 
94 
     | 
    
         
             
                "jsus.gemspec",
         
     | 
| 
       97 
95 
     | 
    
         
             
                "lib/extensions/rgl.rb",
         
     | 
| 
       98 
96 
     | 
    
         
             
                "lib/jsus.rb",
         
     | 
| 
       99 
97 
     | 
    
         
             
                "lib/jsus/cli.rb",
         
     | 
| 
       100 
     | 
    
         
            -
                "lib/jsus/compiler.rb",
         
     | 
| 
       101 
98 
     | 
    
         
             
                "lib/jsus/container.rb",
         
     | 
| 
       102 
99 
     | 
    
         
             
                "lib/jsus/middleware.rb",
         
     | 
| 
       103 
100 
     | 
    
         
             
                "lib/jsus/package.rb",
         
     | 
| 
         @@ -112,6 +109,13 @@ Gem::Specification.new do |s| 
     | 
|
| 
       112 
109 
     | 
    
         
             
                "lib/jsus/util/file_cache.rb",
         
     | 
| 
       113 
110 
     | 
    
         
             
                "lib/jsus/util/inflection.rb",
         
     | 
| 
       114 
111 
     | 
    
         
             
                "lib/jsus/util/logger.rb",
         
     | 
| 
      
 112 
     | 
    
         
            +
                "lib/jsus/util/mixins.rb",
         
     | 
| 
      
 113 
     | 
    
         
            +
                "lib/jsus/util/mixins/operates_on_sources.rb",
         
     | 
| 
      
 114 
     | 
    
         
            +
                "lib/jsus/util/post_processor.rb",
         
     | 
| 
      
 115 
     | 
    
         
            +
                "lib/jsus/util/post_processor/base.rb",
         
     | 
| 
      
 116 
     | 
    
         
            +
                "lib/jsus/util/post_processor/moocompat12.rb",
         
     | 
| 
      
 117 
     | 
    
         
            +
                "lib/jsus/util/post_processor/mooltie8.rb",
         
     | 
| 
      
 118 
     | 
    
         
            +
                "lib/jsus/util/post_processor/semicolon.rb",
         
     | 
| 
       115 
119 
     | 
    
         
             
                "lib/jsus/util/tree.rb",
         
     | 
| 
       116 
120 
     | 
    
         
             
                "lib/jsus/util/validator.rb",
         
     | 
| 
       117 
121 
     | 
    
         
             
                "lib/jsus/util/validator/base.rb",
         
     | 
| 
         @@ -151,8 +155,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       151 
155 
     | 
    
         
             
                "spec/data/DependenciesWildcards/app/javascripts/Mash/Source/Mash.js",
         
     | 
| 
       152 
156 
     | 
    
         
             
                "spec/data/DependenciesWildcards/app/javascripts/Mash/package.yml",
         
     | 
| 
       153 
157 
     | 
    
         
             
                "spec/data/Extensions/app/javascripts/Core/Source/Class.js",
         
     | 
| 
      
 158 
     | 
    
         
            +
                "spec/data/Extensions/app/javascripts/Core/Source/Hash.js",
         
     | 
| 
      
 159 
     | 
    
         
            +
                "spec/data/Extensions/app/javascripts/Core/Source/Mash.js",
         
     | 
| 
       154 
160 
     | 
    
         
             
                "spec/data/Extensions/app/javascripts/Core/package.yml",
         
     | 
| 
       155 
161 
     | 
    
         
             
                "spec/data/Extensions/app/javascripts/Orwik/Extensions/Class.js",
         
     | 
| 
      
 162 
     | 
    
         
            +
                "spec/data/Extensions/app/javascripts/Orwik/Extensions/Mash.js",
         
     | 
| 
       156 
163 
     | 
    
         
             
                "spec/data/Extensions/app/javascripts/Orwik/package.yml",
         
     | 
| 
       157 
164 
     | 
    
         
             
                "spec/data/ExternalDependencies/app/javascripts/Orwik/Source/Test.js",
         
     | 
| 
       158 
165 
     | 
    
         
             
                "spec/data/ExternalDependencies/app/javascripts/Orwik/package.yml",
         
     | 
| 
         @@ -193,9 +200,16 @@ Gem::Specification.new do |s| 
     | 
|
| 
       193 
200 
     | 
    
         
             
                "spec/data/OutsideDependencies/app/javascripts/Orwik/Source/Widget/Input/Input.js",
         
     | 
| 
       194 
201 
     | 
    
         
             
                "spec/data/OutsideDependencies/app/javascripts/Orwik/Source/Widget/Widget.js",
         
     | 
| 
       195 
202 
     | 
    
         
             
                "spec/data/OutsideDependencies/app/javascripts/Orwik/package.yml",
         
     | 
| 
      
 203 
     | 
    
         
            +
                "spec/data/SimpleSources/dependent_source_one.js",
         
     | 
| 
      
 204 
     | 
    
         
            +
                "spec/data/SimpleSources/replacement_source_one.js",
         
     | 
| 
      
 205 
     | 
    
         
            +
                "spec/data/SimpleSources/simple_source_one.js",
         
     | 
| 
      
 206 
     | 
    
         
            +
                "spec/data/SimpleSources/simple_source_two.js",
         
     | 
| 
       196 
207 
     | 
    
         
             
                "spec/data/bad_test_source_one.js",
         
     | 
| 
       197 
208 
     | 
    
         
             
                "spec/data/bad_test_source_two.js",
         
     | 
| 
      
 209 
     | 
    
         
            +
                "spec/data/extension_1.js",
         
     | 
| 
      
 210 
     | 
    
         
            +
                "spec/data/extension_2.js",
         
     | 
| 
       198 
211 
     | 
    
         
             
                "spec/data/mooforge_quirky_source.js",
         
     | 
| 
      
 212 
     | 
    
         
            +
                "spec/data/replacement.js",
         
     | 
| 
       199 
213 
     | 
    
         
             
                "spec/data/test_source_one.js",
         
     | 
| 
       200 
214 
     | 
    
         
             
                "spec/data/unicode_source.js",
         
     | 
| 
       201 
215 
     | 
    
         
             
                "spec/data/unicode_source_with_bom.js",
         
     | 
| 
         @@ -212,12 +226,16 @@ Gem::Specification.new do |s| 
     | 
|
| 
       212 
226 
     | 
    
         
             
                "spec/jsus/util/file_cache_spec.rb",
         
     | 
| 
       213 
227 
     | 
    
         
             
                "spec/jsus/util/inflection_spec.rb",
         
     | 
| 
       214 
228 
     | 
    
         
             
                "spec/jsus/util/logger_spec.rb",
         
     | 
| 
      
 229 
     | 
    
         
            +
                "spec/jsus/util/post_processor/moocompat12_spec.rb",
         
     | 
| 
      
 230 
     | 
    
         
            +
                "spec/jsus/util/post_processor/mooltie8_spec.rb",
         
     | 
| 
      
 231 
     | 
    
         
            +
                "spec/jsus/util/post_processor/semicolon_spec.rb",
         
     | 
| 
      
 232 
     | 
    
         
            +
                "spec/jsus/util/post_processors/base_spec.rb",
         
     | 
| 
       215 
233 
     | 
    
         
             
                "spec/jsus/util/tree_spec.rb",
         
     | 
| 
       216 
234 
     | 
    
         
             
                "spec/jsus/util/validator/base_spec.rb",
         
     | 
| 
       217 
235 
     | 
    
         
             
                "spec/jsus/util/validator/mooforge_spec.rb",
         
     | 
| 
       218 
236 
     | 
    
         
             
                "spec/jsus/util/watcher_spec.rb",
         
     | 
| 
       219 
237 
     | 
    
         
             
                "spec/jsus/util_spec.rb",
         
     | 
| 
       220 
     | 
    
         
            -
                "spec/shared/ 
     | 
| 
      
 238 
     | 
    
         
            +
                "spec/shared/mixins_segs.rb",
         
     | 
| 
       221 
239 
     | 
    
         
             
                "spec/spec_helper.rb"
         
     | 
| 
       222 
240 
     | 
    
         
             
              ]
         
     | 
| 
       223 
241 
     | 
    
         
             
              s.homepage = %q{http://github.com/jsus/jsus}
         
     | 
    
        data/lib/extensions/rgl.rb
    CHANGED
    
    | 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Extensions for Ruby Graph Library
         
     | 
| 
       1 
2 
     | 
    
         
             
            module RGL
         
     | 
| 
       2 
3 
     | 
    
         
             
              class TopsortedGraphHasCycles < Exception; end
         
     | 
| 
       3 
4 
     | 
    
         
             
              class DirectedAdjacencyGraph
         
     | 
| 
         @@ -5,7 +6,7 @@ module RGL 
     | 
|
| 
       5 
6 
     | 
    
         
             
                # cycles.
         
     | 
| 
       6 
7 
     | 
    
         
             
                #
         
     | 
| 
       7 
8 
     | 
    
         
             
                # @note Default implementation of topsort iterator is a bit faster, but it doesn't
         
     | 
| 
       8 
     | 
    
         
            -
                # 
     | 
| 
      
 9 
     | 
    
         
            +
                #       check for cycles.
         
     | 
| 
       9 
10 
     | 
    
         
             
                # @return [Array] sorted vertices list
         
     | 
| 
       10 
11 
     | 
    
         
             
                # @raise [TopsortedGraphHasCycles] if graph has cycles
         
     | 
| 
       11 
12 
     | 
    
         
             
                # @api public
         
     | 
    
        data/lib/jsus/cli.rb
    CHANGED
    
    | 
         @@ -10,8 +10,9 @@ module Jsus 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                    if options[:watch]
         
     | 
| 
       12 
12 
     | 
    
         
             
                      input_dirs = [ options[:input_dir], options[:deps_dir] ].compact
         
     | 
| 
      
 13 
     | 
    
         
            +
                      output_dir = options[:output_dir]
         
     | 
| 
       13 
14 
     | 
    
         
             
                      Jsus.logger.info "Jsus enters watch mode, it will watch your files for changes and relaunch itself"
         
     | 
| 
       14 
     | 
    
         
            -
                      Jsus::Util::Watcher.watch(input_dirs) do |filename|
         
     | 
| 
      
 15 
     | 
    
         
            +
                      Jsus::Util::Watcher.watch(input_dirs, output_dir) do |filename|
         
     | 
| 
       15 
16 
     | 
    
         
             
                        Jsus.logger.info "#{filename} changed, recompiling..."
         
     | 
| 
       16 
17 
     | 
    
         
             
                        new.launch
         
     | 
| 
       17 
18 
     | 
    
         
             
                        Jsus.logger.info "... done"
         
     | 
| 
         @@ -27,29 +28,31 @@ module Jsus 
     | 
|
| 
       27 
28 
     | 
    
         
             
                end
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
       29 
30 
     | 
    
         
             
                def setup_output_directory
         
     | 
| 
       30 
     | 
    
         
            -
                  output_dir =  
     | 
| 
       31 
     | 
    
         
            -
                  output_dir 
     | 
| 
      
 31 
     | 
    
         
            +
                  output_dir = File.expand_path(options[:output_dir])
         
     | 
| 
      
 32 
     | 
    
         
            +
                  FileUtils.mkdir_p(output_dir)
         
     | 
| 
       32 
33 
     | 
    
         
             
                  output_dir
         
     | 
| 
       33 
34 
     | 
    
         
             
                end
         
     | 
| 
       34 
35 
     | 
    
         | 
| 
       35 
36 
     | 
    
         
             
                def launch
         
     | 
| 
       36 
37 
     | 
    
         
             
                  checkpoint(:start)
         
     | 
| 
       37 
38 
     | 
    
         
             
                  @output_dir = setup_output_directory
         
     | 
| 
       38 
     | 
    
         
            -
                  @pool 
     | 
| 
       39 
     | 
    
         
            -
                  @package 
     | 
| 
      
 39 
     | 
    
         
            +
                  @pool       = preload_pool
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @package    = load_package
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @pool       << @package
         
     | 
| 
       40 
42 
     | 
    
         
             
                  display_pool_stats(@pool) if options[:display_pool_stats]
         
     | 
| 
       41 
     | 
    
         
            -
                  @package_content = compile_package(@package)
         
     | 
| 
       42 
     | 
    
         
            -
                  post_process!(@package_content, options[:postproc]) if options[:postproc]
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
      
 44 
     | 
    
         
            +
                  @resulting_sources = @resulting_sources_container = @pool.compile_package(@package)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  @resulting_sources = post_process(@resulting_sources, options[:postproc]) if options[:postproc]
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @package_content = compile_package(@resulting_sources)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  package_filename = File.join(@output_dir, @package.filename)
         
     | 
| 
       45 
48 
     | 
    
         | 
| 
       46 
49 
     | 
    
         
             
                  if options[:compress]
         
     | 
| 
       47 
     | 
    
         
            -
                    File.open(package_filename. 
     | 
| 
      
 50 
     | 
    
         
            +
                    File.open(package_filename.chomp(".js") + ".min.js", 'w') do |f|
         
     | 
| 
       48 
51 
     | 
    
         
             
                      f.write compress_package(@package_content)
         
     | 
| 
       49 
52 
     | 
    
         
             
                    end
         
     | 
| 
       50 
53 
     | 
    
         
             
                  end
         
     | 
| 
       51 
54 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                   
     | 
| 
      
 55 
     | 
    
         
            +
                  File.open(package_filename, 'w') {|f| f << @package_content  }
         
     | 
| 
       53 
56 
     | 
    
         | 
| 
       54 
57 
     | 
    
         
             
                  generate_supplemental_files
         
     | 
| 
       55 
58 
     | 
    
         
             
                  validate_sources
         
     | 
| 
         @@ -57,21 +60,21 @@ module Jsus 
     | 
|
| 
       57 
60 
     | 
    
         
             
                  generate_docs if options[:documented_classes] && !options[:documented_classes].empty?
         
     | 
| 
       58 
61 
     | 
    
         
             
                  output_benchmarks
         
     | 
| 
       59 
62 
     | 
    
         
             
                rescue Exception => e
         
     | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
      
 63 
     | 
    
         
            +
                  $stderr.puts "Exception was raised: #{e.inspect}\n\nBacktrace: #{e.backtrace.join("\n")}"
         
     | 
| 
       61 
64 
     | 
    
         
             
                end
         
     | 
| 
       62 
65 
     | 
    
         | 
| 
       63 
66 
     | 
    
         
             
                def preload_pool
         
     | 
| 
       64 
     | 
    
         
            -
                  if options[:deps_dir]
         
     | 
| 
      
 67 
     | 
    
         
            +
                  result = if options[:deps_dir]
         
     | 
| 
       65 
68 
     | 
    
         
             
                    Jsus::Pool.new(options[:deps_dir])
         
     | 
| 
       66 
69 
     | 
    
         
             
                  else
         
     | 
| 
       67 
70 
     | 
    
         
             
                    Jsus::Pool.new
         
     | 
| 
       68 
     | 
    
         
            -
                  end 
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  checkpoint(:pool)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  result
         
     | 
| 
       69 
74 
     | 
    
         
             
                end
         
     | 
| 
       70 
75 
     | 
    
         | 
| 
       71 
76 
     | 
    
         
             
                def load_package
         
     | 
| 
       72 
     | 
    
         
            -
                  package = Jsus::Package.new(Pathname.new(options[:input_dir]) 
     | 
| 
       73 
     | 
    
         
            -
                  package.include_dependencies!
         
     | 
| 
       74 
     | 
    
         
            -
                  checkpoint(:dependencies)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  package = Jsus::Package.new(Pathname.new(options[:input_dir]))
         
     | 
| 
       75 
78 
     | 
    
         
             
                  package
         
     | 
| 
       76 
79 
     | 
    
         
             
                end
         
     | 
| 
       77 
80 
     | 
    
         | 
| 
         @@ -92,21 +95,24 @@ EOF 
     | 
|
| 
       92 
95 
     | 
    
         
             
                def display_package(package)
         
     | 
| 
       93 
96 
     | 
    
         
             
                  result = "Package: #{package.name}\n"
         
     | 
| 
       94 
97 
     | 
    
         
             
                  package.source_files.to_a.sort_by {|sf| sf.filename}.each do |sf|
         
     | 
| 
       95 
     | 
    
         
            -
                    result << "    [#{sf. 
     | 
| 
       96 
     | 
    
         
            -
                    result << "        Provides: [#{sf. 
     | 
| 
       97 
     | 
    
         
            -
                    result << "        Requires: [#{sf. 
     | 
| 
      
 98 
     | 
    
         
            +
                    result << "    [#{sf.filename}]\n"
         
     | 
| 
      
 99 
     | 
    
         
            +
                    result << "        Provides: [#{sf.provides.map {|tag| tag.full_name }.join(", ")}]\n"
         
     | 
| 
      
 100 
     | 
    
         
            +
                    result << "        Requires: [#{sf.requires.map {|tag| tag.full_name }.join(", ")}]\n"
         
     | 
| 
       98 
101 
     | 
    
         
             
                  end
         
     | 
| 
       99 
102 
     | 
    
         
             
                  result << "\n"
         
     | 
| 
       100 
103 
     | 
    
         
             
                end
         
     | 
| 
       101 
104 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
                def compile_package( 
     | 
| 
       103 
     | 
    
         
            -
                   
     | 
| 
      
 105 
     | 
    
         
            +
                def compile_package(sources)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  result = Packager.new(sources).pack(nil)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  checkpoint(:compilation)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  result
         
     | 
| 
       104 
109 
     | 
    
         
             
                end
         
     | 
| 
       105 
110 
     | 
    
         | 
| 
       106 
111 
     | 
    
         
             
                # Modificate content string
         
     | 
| 
       107 
     | 
    
         
            -
                def post_process 
     | 
| 
       108 
     | 
    
         
            -
                   
     | 
| 
      
 112 
     | 
    
         
            +
                def post_process(source_files, processors)
         
     | 
| 
      
 113 
     | 
    
         
            +
                  result = Util::PostProcessor.process(source_files, processors)
         
     | 
| 
       109 
114 
     | 
    
         
             
                  checkpoint(:postproc)
         
     | 
| 
      
 115 
     | 
    
         
            +
                  result
         
     | 
| 
       110 
116 
     | 
    
         
             
                end
         
     | 
| 
       111 
117 
     | 
    
         | 
| 
       112 
118 
     | 
    
         
             
                def compress_package(content)
         
     | 
| 
         @@ -125,14 +131,24 @@ EOF 
     | 
|
| 
       125 
131 
     | 
    
         
             
                end
         
     | 
| 
       126 
132 
     | 
    
         | 
| 
       127 
133 
     | 
    
         
             
                def generate_supplemental_files
         
     | 
| 
       128 
     | 
    
         
            -
                   
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 134 
     | 
    
         
            +
                  unless options[:without_scripts_info]
         
     | 
| 
      
 135 
     | 
    
         
            +
                    File.open(options[:output_dir] + "/scripts.json", "w+") do |f|
         
     | 
| 
      
 136 
     | 
    
         
            +
                      scripts_hash = {
         
     | 
| 
      
 137 
     | 
    
         
            +
                        @package.name => {
         
     | 
| 
      
 138 
     | 
    
         
            +
                          :desc     => @package.description,
         
     | 
| 
      
 139 
     | 
    
         
            +
                          :provides => @resulting_sources_container.provides.map {|tag| tag.to_s},
         
     | 
| 
      
 140 
     | 
    
         
            +
                          :requires => @resulting_sources_container.requires.map {|tag| tag.to_s}
         
     | 
| 
      
 141 
     | 
    
         
            +
                        }
         
     | 
| 
      
 142 
     | 
    
         
            +
                      }
         
     | 
| 
      
 143 
     | 
    
         
            +
                      f.puts JSON.pretty_generate(scripts_hash)
         
     | 
| 
      
 144 
     | 
    
         
            +
                    end
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
       130 
146 
     | 
    
         
             
                  checkpoint(:supplemental_files)
         
     | 
| 
       131 
147 
     | 
    
         
             
                end
         
     | 
| 
       132 
148 
     | 
    
         | 
| 
       133 
149 
     | 
    
         
             
                def generate_includes
         
     | 
| 
       134 
     | 
    
         
            -
                  includes_root = Pathname.new(options[:includes_root] || @output_dir)
         
     | 
| 
       135 
     | 
    
         
            -
                   
     | 
| 
      
 150 
     | 
    
         
            +
                  includes_root = Pathname.new(options[:includes_root] || @output_dir).to_s
         
     | 
| 
      
 151 
     | 
    
         
            +
                  File.open(File.join(@output_dir, "includes.js"), "w+") {|f| f.puts Util::CodeGenerator.generate_includes(@resulting_sources.required_files(includes_root)) }
         
     | 
| 
       136 
152 
     | 
    
         
             
                  checkpoint(:includes)
         
     | 
| 
       137 
153 
     | 
    
         
             
                end
         
     | 
| 
       138 
154 
     | 
    
         |