bpm 1.0.0.beta.5 → 1.0.0.beta.6
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/CHANGELOG.md +5 -0
 - data/TODO.md +18 -17
 - data/lib/bpm/pipeline/generated_asset.rb +64 -41
 - data/lib/bpm/pipeline/plugin_context.rb +24 -0
 - data/lib/bpm/pipeline/transport_processor.rb +3 -3
 - data/lib/bpm/pipeline.rb +2 -1
 - data/lib/bpm/project.rb +7 -1
 - data/lib/bpm/version.rb +1 -1
 - data/lib/bpm.rb +1 -0
 - data/spec/fixtures/projects/minitest/minitest.json +4 -2
 - data/spec/fixtures/projects/minitest/packages/uglyduck/minifier/main.js +3 -2
 - data/spec/fixtures/projects/minitrans/lib/main.js +3 -0
 - data/spec/fixtures/projects/minitrans/minitrans.json +25 -0
 - data/spec/fixtures/projects/minitrans/packages/transport/lib/main.js +1 -0
 - data/spec/fixtures/projects/minitrans/packages/transport/package.json +21 -0
 - data/spec/fixtures/projects/minitrans/packages/transport/transports/wrapper.js +6 -0
 - data/spec/fixtures/projects/minitrans/packages/uglyduck/lib/main.js +3 -0
 - data/spec/fixtures/projects/minitrans/packages/uglyduck/minifier/main.js +6 -0
 - data/spec/fixtures/projects/minitrans/packages/uglyduck/package.json +21 -0
 - data/spec/fixtures/projects/transporter/packages/transport/transports/wrapper.js +2 -2
 - data/spec/plugins/minifier_spec.rb +2 -2
 - data/spec/plugins/transport_spec.rb +38 -0
 - metadata +41 -56
 - data/backbone/LICENSE +0 -22
 - data/backbone/README +0 -25
 - data/backbone/Rakefile +0 -42
 - data/backbone/backbone-0.5.1.bpkg +0 -0
 - data/backbone/examples/backbone-localstorage.js +0 -84
 - data/backbone/examples/todos/destroy.png +0 -0
 - data/backbone/examples/todos/index.html +0 -87
 - data/backbone/examples/todos/todos.css +0 -311
 - data/backbone/examples/todos/todos.js +0 -258
 - data/backbone/index.html +0 -2606
 - data/backbone/index.js +0 -1
 - data/backbone/lib/backbone.js +0 -1149
 - data/backbone/lib/index.js +0 -1
 - data/backbone/package.json +0 -14
 - data/backbone/test/collection.js +0 -345
 - data/backbone/test/events.js +0 -70
 - data/backbone/test/model.coffee +0 -43
 - data/backbone/test/model.js +0 -424
 - data/backbone/test/noconflict.js +0 -12
 - data/backbone/test/router.js +0 -116
 - data/backbone/test/speed.js +0 -45
 - data/backbone/test/sync.js +0 -133
 - data/backbone/test/test-zepto.html +0 -30
 - data/backbone/test/test.html +0 -31
 - data/backbone/test/vendor/jquery-1.5.js +0 -8176
 - data/backbone/test/vendor/jslitmus.js +0 -649
 - data/backbone/test/vendor/json2.js +0 -481
 - data/backbone/test/vendor/qunit.css +0 -196
 - data/backbone/test/vendor/qunit.js +0 -1364
 - data/backbone/test/vendor/underscore-1.1.6.js +0 -807
 - data/backbone/test/vendor/zepto-0.6.js +0 -692
 - data/backbone/test/view.js +0 -137
 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,4 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
      
 2 
     | 
    
         
            +
              * bpm now passes a context object with build settings and a minify option
         
     | 
| 
      
 3 
     | 
    
         
            +
                to plugins - this will allow spade to support string loading.
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
            # 1.0.0.beta.5
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       2 
7 
     | 
    
         
             
              * bpm list now shows local dependencies by default.  Use bpm list --remote
         
     | 
| 
       3 
8 
     | 
    
         
             
                to get remote.
         
     | 
| 
       4 
9 
     | 
    
         
             
              * better compatibility with npm - "summary" field is optional and "url" is
         
     | 
    
        data/TODO.md
    CHANGED
    
    | 
         @@ -1,27 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Things To Do
         
     | 
| 
       1 
2 
     | 
    
         | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              be used to resolve formats.
         
     | 
| 
       4 
     | 
    
         
            -
              
         
     | 
| 
       5 
     | 
    
         
            -
            * minify then transport -> this will allow for string loading.
         
     | 
| 
      
 3 
     | 
    
         
            +
            ## Important Features
         
     | 
| 
       6 
4 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            *  
     | 
| 
      
 5 
     | 
    
         
            +
              * Multiple format support.  Format processors supplied by dependencies 
         
     | 
| 
      
 6 
     | 
    
         
            +
                should
         
     | 
| 
      
 7 
     | 
    
         
            +
                be used to resolve formats.
         
     | 
| 
      
 8 
     | 
    
         
            +
              * HTML manifest support [in general we need a way for packages to generate 
         
     | 
| 
      
 9 
     | 
    
         
            +
                new assets]
         
     | 
| 
      
 10 
     | 
    
         
            +
              * cache-friendly URLs
         
     | 
| 
      
 11 
     | 
    
         
            +
              * HTML files should be able to process as templates using a template plugin
         
     | 
| 
      
 12 
     | 
    
         
            +
              * Can we use YAML instead of JSON?
         
     | 
| 
      
 13 
     | 
    
         
            +
              * Changing a dependency in a package.json should rebuild all files in 
         
     | 
| 
      
 14 
     | 
    
         
            +
                preview mode (in case the transport was modified)
         
     | 
| 
       8 
15 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            * HTML files should be able to process as templates using a template plugin
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            * Can we use YAML instead of JSON?
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            * Changing a dependency in a package.json should rebuild all files in preview mode (in case the transport was modified)
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            * make work with JS that is placed at the root of the package. (i.e. lib = .)
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            * figure out why requiring LibGems takes so long; really slows down launch
         
     | 
| 
      
 16 
     | 
    
         
            +
            ## Lower Priority
         
     | 
| 
       20 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
              * figure out why requiring LibGems takes so long; really slows down launch
         
     | 
| 
      
 19 
     | 
    
         
            +
              * Make LibGems & bpm compatible with ruby 1.8.7
         
     | 
| 
      
 20 
     | 
    
         
            +
              * make work with JS that is placed at the root of the package. 
         
     | 
| 
      
 21 
     | 
    
         
            +
                (i.e. lib = .)
         
     | 
| 
       21 
22 
     | 
    
         | 
| 
       22 
23 
     | 
    
         
             
            ----------------
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
            #  
     | 
| 
      
 25 
     | 
    
         
            +
            # Usage Scenarios
         
     | 
| 
       25 
26 
     | 
    
         | 
| 
       26 
27 
     | 
    
         
             
            ## New user with existing app using bpm to manage dependencies
         
     | 
| 
       27 
28 
     | 
    
         | 
| 
         @@ -8,6 +8,62 @@ module BPM 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  'text/css' => ['css', 'pipeline_css'],
         
     | 
| 
       9 
9 
     | 
    
         
             
                  'application/javascript' => ['lib', 'pipeline_libs']
         
     | 
| 
       10 
10 
     | 
    
         
             
                }
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                def self.generating_asset
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @generating_asset && @generating_asset.last
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                
         
     | 
| 
      
 16 
     | 
    
         
            +
                def self.push_generating_asset(asset)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @generating_asset ||= []
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @generating_asset.push asset
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
                
         
     | 
| 
      
 21 
     | 
    
         
            +
                def self.pop_generating_asset
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @generating_asset && @generating_asset.pop
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def build_settings
         
     | 
| 
      
 26 
     | 
    
         
            +
                  ret = environment.project.build_settings[asset_name] 
         
     | 
| 
      
 27 
     | 
    
         
            +
                  (ret && ret['bpm:settings']) || {}
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                def minify_body(data)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  
         
     | 
| 
      
 32 
     | 
    
         
            +
                  project = environment.project
         
     | 
| 
      
 33 
     | 
    
         
            +
                  minifier_name = project.minifier_name asset_name
         
     | 
| 
      
 34 
     | 
    
         
            +
                  minifier_name = minifier_name.keys.first if minifier_name
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  if minifier_name && content_type == 'application/javascript'
         
     | 
| 
      
 37 
     | 
    
         
            +
                    pkg = project.package_from_name minifier_name
         
     | 
| 
      
 38 
     | 
    
         
            +
                    if pkg.nil?
         
     | 
| 
      
 39 
     | 
    
         
            +
                      raise MinifierNotFoundError.new(minifier_name)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    minifier_plugin_name = pkg.bpm_minifier
         
     | 
| 
      
 43 
     | 
    
         
            +
                    if minifier_plugin_name.nil?
         
     | 
| 
      
 44 
     | 
    
         
            +
                      raise MinifierNotFoundError.new(minifier_name)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                    plugin_ctx = environment.plugin_context_for minifier_plugin_name
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                    # slice out the header at the top - we don't want the minifier to 
         
     | 
| 
      
 50 
     | 
    
         
            +
                    # touch it.
         
     | 
| 
      
 51 
     | 
    
         
            +
                    header   = data.match /^(\/\* ====.+====\*\/)$/m
         
     | 
| 
      
 52 
     | 
    
         
            +
                    if header
         
     | 
| 
      
 53 
     | 
    
         
            +
                      header = header[0] + "\n"
         
     | 
| 
      
 54 
     | 
    
         
            +
                      data   = data[header.size..-1]
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                    V8::C::Locker() do
         
     | 
| 
      
 58 
     | 
    
         
            +
                      plugin_ctx["CTX"]  = BPM::PluginContext.new(pkg)
         
     | 
| 
      
 59 
     | 
    
         
            +
                      plugin_ctx["DATA"] = data
         
     | 
| 
      
 60 
     | 
    
         
            +
                      data = plugin_ctx.eval("BPM_PLUGIN.minify(DATA, CTX)")
         
     | 
| 
      
 61 
     | 
    
         
            +
                    end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                    data = header+data if header
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                  data
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
       11 
67 
     | 
    
         | 
| 
       12 
68 
     | 
    
         
             
              protected
         
     | 
| 
       13 
69 
     | 
    
         | 
| 
         @@ -18,53 +74,20 @@ module BPM 
     | 
|
| 
       18 
74 
     | 
    
         
             
              private
         
     | 
| 
       19 
75 
     | 
    
         | 
| 
       20 
76 
     | 
    
         
             
                def build_source
         
     | 
| 
       21 
     | 
    
         
            -
                   
     | 
| 
      
 77 
     | 
    
         
            +
                  self.class.push_generating_asset self
         
     | 
| 
      
 78 
     | 
    
         
            +
                  ret = minify super
         
     | 
| 
      
 79 
     | 
    
         
            +
                  self.class.pop_generating_asset
         
     | 
| 
      
 80 
     | 
    
         
            +
                  ret
         
     | 
| 
       22 
81 
     | 
    
         
             
                end
         
     | 
| 
       23 
82 
     | 
    
         | 
| 
       24 
83 
     | 
    
         
             
                def minify(hash)
         
     | 
| 
       25 
84 
     | 
    
         
             
                  return hash if environment.mode == :debug
         
     | 
| 
       26 
85 
     | 
    
         | 
| 
       27 
86 
     | 
    
         
             
                  hash = environment.cache_hash("#{pathname}:minify", id) do
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                    if minifier_name && content_type == 'application/javascript'
         
     | 
| 
       33 
     | 
    
         
            -
                      pkg = project.package_from_name minifier_name
         
     | 
| 
       34 
     | 
    
         
            -
                      if pkg.nil?
         
     | 
| 
       35 
     | 
    
         
            -
                        raise MinifierNotFoundError.new(minifier_name)
         
     | 
| 
       36 
     | 
    
         
            -
                      end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                      minifier_plugin_name = pkg.bpm_minifier
         
     | 
| 
       39 
     | 
    
         
            -
                      if minifier_plugin_name.nil?
         
     | 
| 
       40 
     | 
    
         
            -
                        raise MinifierNotFoundError.new(minifier_name)
         
     | 
| 
       41 
     | 
    
         
            -
                      end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                      plugin_ctx = environment.plugin_context_for minifier_plugin_name
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                      # slice out the header at the top - we don't want the minifier to 
         
     | 
| 
       46 
     | 
    
         
            -
                      # touch it.
         
     | 
| 
       47 
     | 
    
         
            -
                      data     = hash['source']
         
     | 
| 
       48 
     | 
    
         
            -
                      header   = data.match /^(\/\* ====.+====\*\/)$/m
         
     | 
| 
       49 
     | 
    
         
            -
                      if header
         
     | 
| 
       50 
     | 
    
         
            -
                        header = header[0] + "\n"
         
     | 
| 
       51 
     | 
    
         
            -
                        data   = data[header.size..-1]
         
     | 
| 
       52 
     | 
    
         
            -
                      end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                      V8::C::Locker() do
         
     | 
| 
       55 
     | 
    
         
            -
                        plugin_ctx["PACKAGE_INFO"] = pkg.as_json
         
     | 
| 
       56 
     | 
    
         
            -
                        plugin_ctx["DATA"]         = data
         
     | 
| 
       57 
     | 
    
         
            -
                        data = plugin_ctx.eval("BPM_PLUGIN.minify(DATA, PACKAGE_INFO)")
         
     | 
| 
       58 
     | 
    
         
            -
                      end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                      data = header+data if header
         
     | 
| 
       61 
     | 
    
         
            -
                      
         
     | 
| 
       62 
     | 
    
         
            -
                      { 'length' => Rack::Utils.bytesize(data),
         
     | 
| 
       63 
     | 
    
         
            -
                        'digest' => environment.digest.update(data).hexdigest,
         
     | 
| 
       64 
     | 
    
         
            -
                        'source' => data }
         
     | 
| 
       65 
     | 
    
         
            -
                    else
         
     | 
| 
       66 
     | 
    
         
            -
                      hash
         
     | 
| 
       67 
     | 
    
         
            -
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
                    data = minify_body hash['source']
         
     | 
| 
      
 88 
     | 
    
         
            +
                    { 'length' => Rack::Utils.bytesize(data),
         
     | 
| 
      
 89 
     | 
    
         
            +
                      'digest' => environment.digest.update(data).hexdigest,
         
     | 
| 
      
 90 
     | 
    
         
            +
                      'source' => data }
         
     | 
| 
       68 
91 
     | 
    
         
             
                  end
         
     | 
| 
       69 
92 
     | 
    
         | 
| 
       70 
93 
     | 
    
         
             
                  hash['length'] = Integer(hash['length']) if hash['length'].is_a?(String)
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BPM
         
     | 
| 
      
 2 
     | 
    
         
            +
              
         
     | 
| 
      
 3 
     | 
    
         
            +
              class PluginContext 
         
     | 
| 
      
 4 
     | 
    
         
            +
                
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :moduleId
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :package
         
     | 
| 
      
 7 
     | 
    
         
            +
                
         
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(pkg, module_id=nil)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @generating_asset = BPM::GeneratedAsset.generating_asset
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @package = pkg.as_json
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @moduleId = module_id
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
                
         
     | 
| 
      
 14 
     | 
    
         
            +
                def minify(body)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @generating_asset ? @generating_asset.minify_body(body) : body
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def settings
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @generating_asset ? @generating_asset.build_settings : {}
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
              
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -26,9 +26,9 @@ module BPM 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  out = ''
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                  V8::C::Locker() do
         
     | 
| 
       29 
     | 
    
         
            -
                    plugin_ctx[" 
     | 
| 
       30 
     | 
    
         
            -
                    plugin_ctx[" 
     | 
| 
       31 
     | 
    
         
            -
                    out = plugin_ctx.eval("BPM_PLUGIN.compileTransport(DATA,  
     | 
| 
      
 29 
     | 
    
         
            +
                    plugin_ctx["DATA"]  = data
         
     | 
| 
      
 30 
     | 
    
         
            +
                    plugin_ctx["CTX"]   = BPM::PluginContext.new(pkg, module_id)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    out = plugin_ctx.eval("BPM_PLUGIN.compileTransport(DATA, CTX, '#{filepath}');")
         
     | 
| 
       32 
32 
     | 
    
         
             
                  end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                  out + "\n\n"
         
     | 
    
        data/lib/bpm/pipeline.rb
    CHANGED
    
    | 
         @@ -20,6 +20,7 @@ module BPM 
     | 
|
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                # Pass in the project you want the pipeline to manage.
         
     | 
| 
       22 
22 
     | 
    
         
             
                def initialize(project, mode = :debug, include_preview = false)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  
         
     | 
| 
       23 
24 
     | 
    
         
             
                  @project = project
         
     | 
| 
       24 
25 
     | 
    
         
             
                  @mode    = mode
         
     | 
| 
       25 
26 
     | 
    
         
             
                  @plugin_contexts = {}
         
     | 
| 
         @@ -66,7 +67,7 @@ module BPM 
     | 
|
| 
       66 
67 
     | 
    
         | 
| 
       67 
68 
     | 
    
         
             
                      dep = project.local_deps.find { |dep| dep.name == target_name }
         
     | 
| 
       68 
69 
     | 
    
         
             
                      dep = project if project.name == target_name
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
       70 
71 
     | 
    
         
             
                      dir_paths = File.join(dep.root_path, dir_name)
         
     | 
| 
       71 
72 
     | 
    
         
             
                      if File.directory? dir_paths
         
     | 
| 
       72 
73 
     | 
    
         
             
                        dir_paths = Dir[File.join(dir_paths, '**', '*')]
         
     | 
    
        data/lib/bpm/project.rb
    CHANGED
    
    | 
         @@ -638,9 +638,12 @@ module BPM 
     | 
|
| 
       638 
638 
     | 
    
         | 
| 
       639 
639 
     | 
    
         
             
                    # Look up dependencies of dependencies
         
     | 
| 
       640 
640 
     | 
    
         
             
                    search_list += Array(pkg.dependencies)
         
     | 
| 
       641 
     | 
    
         
            -
                    search_list += Array(pkg.dependencies_development)
         
     | 
| 
       642 
641 
     | 
    
         
             
                    search_list += Array(pkg.dependencies_build)
         
     | 
| 
       643 
642 
     | 
    
         | 
| 
      
 643 
     | 
    
         
            +
                    if has_local_package? pkg.name
         
     | 
| 
      
 644 
     | 
    
         
            +
                      search_list += Array(pkg.dependencies_development)
         
     | 
| 
      
 645 
     | 
    
         
            +
                    end
         
     | 
| 
      
 646 
     | 
    
         
            +
             
     | 
| 
       644 
647 
     | 
    
         
             
                    ret << pkg
         
     | 
| 
       645 
648 
     | 
    
         
             
                  end
         
     | 
| 
       646 
649 
     | 
    
         | 
| 
         @@ -745,6 +748,9 @@ module BPM 
     | 
|
| 
       745 
748 
     | 
    
         
             
                    end
         
     | 
| 
       746 
749 
     | 
    
         
             
                  end
         
     | 
| 
       747 
750 
     | 
    
         | 
| 
      
 751 
     | 
    
         
            +
                  bpm_settings = ret[target_name]['bpm:settings'] ||= {}
         
     | 
| 
      
 752 
     | 
    
         
            +
                  ret[target_name]['bpm:settings'] = soft_merge(bpm_settings, opts)
         
     | 
| 
      
 753 
     | 
    
         
            +
                  
         
     | 
| 
       748 
754 
     | 
    
         
             
                end
         
     | 
| 
       749 
755 
     | 
    
         | 
| 
       750 
756 
     | 
    
         
             
                def project_settings_excludes(dep_name, target_name)
         
     | 
    
        data/lib/bpm/version.rb
    CHANGED
    
    
    
        data/lib/bpm.rb
    CHANGED
    
    | 
         @@ -19,6 +19,7 @@ module BPM 
     | 
|
| 
       19 
19 
     | 
    
         
             
              autoload :TransportProcessor,   'bpm/pipeline/transport_processor'
         
     | 
| 
       20 
20 
     | 
    
         
             
              autoload :SourceURLProcessor,   'bpm/pipeline/source_url_processor'
         
     | 
| 
       21 
21 
     | 
    
         
             
              autoload :PluginAsset,          'bpm/pipeline/plugin_asset'
         
     | 
| 
      
 22 
     | 
    
         
            +
              autoload :PluginContext,        'bpm/pipeline/plugin_context'
         
     | 
| 
       22 
23 
     | 
    
         
             
            end
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
            # The BPM constants need to be defined first
         
     | 
| 
         @@ -14,12 +14,14 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
              "bpm:build": {
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                "bpm_libs.js": {
         
     | 
| 
       17 
     | 
    
         
            -
                  "minifier": { "uglyduck": ">= 0" } 
     | 
| 
      
 17 
     | 
    
         
            +
                  "minifier": { "uglyduck": ">= 0" },
         
     | 
| 
      
 18 
     | 
    
         
            +
                  "uglyduck:where": "boston"
         
     | 
| 
       18 
19 
     | 
    
         
             
                },
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
                "minitest/bpm_libs.js": {
         
     | 
| 
       21 
22 
     | 
    
         
             
                  "directories": ["lib"],
         
     | 
| 
       22 
     | 
    
         
            -
                  "minifier": { "uglyduck": ">= 0" }
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "minifier": { "uglyduck": ">= 0" },
         
     | 
| 
      
 24 
     | 
    
         
            +
                  "uglyduck:where": "sanfran"
         
     | 
| 
       23 
25 
     | 
    
         
             
                }
         
     | 
| 
       24 
26 
     | 
    
         
             
              }
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            /*globals BPM_PLUGIN UGLYDUCK */
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            BPM_PLUGIN.minify = function(body,  
     | 
| 
      
 3 
     | 
    
         
            +
            BPM_PLUGIN.minify = function(body, context, pathname) {
         
     | 
| 
       4 
4 
     | 
    
         
             
              var whatIsUglyDuck = 'undefined' === typeof UGLYDUCK ? '(main not loaded)' : UGLYDUCK;
         
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
      
 5 
     | 
    
         
            +
              var whereIsUglyDuck = context.settings['uglyduck:where'] || '(build settings not found)'
         
     | 
| 
      
 6 
     | 
    
         
            +
              return "//MINIFIED START\nUGLY DUCK "+whatIsUglyDuck+whereIsUglyDuck+"\n"+body+"\n//MINIFIED END\n";
         
     | 
| 
       6 
7 
     | 
    
         
             
            };
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "name":         "minitrans",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "version":      "2.0.0",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "bpm":          "0.1.0",
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              "description":  "DESCRIPTION HERE",
         
     | 
| 
      
 7 
     | 
    
         
            +
              "author":       "YOUR NAME HERE",
         
     | 
| 
      
 8 
     | 
    
         
            +
              "homepage":     "URL",
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              "directories": {
         
     | 
| 
      
 11 
     | 
    
         
            +
                "lib":        "lib"
         
     | 
| 
      
 12 
     | 
    
         
            +
              },
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              "dependencies": {
         
     | 
| 
      
 15 
     | 
    
         
            +
                "transport":    "0.5.0"
         
     | 
| 
      
 16 
     | 
    
         
            +
              },
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
              "bpm:build": {
         
     | 
| 
      
 19 
     | 
    
         
            +
                "bpm_libs.js": {
         
     | 
| 
      
 20 
     | 
    
         
            +
                  "directories": ["lib"],
         
     | 
| 
      
 21 
     | 
    
         
            +
                  "minifier": "uglyduck"
         
     | 
| 
      
 22 
     | 
    
         
            +
                }
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
              
         
     | 
| 
      
 25 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            // TRANSPORT DEMO
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "name":         "transport",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "version":      "0.5.0",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "bpm":          "0.1.0",
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              "description":  "DESCRIPTION HERE",
         
     | 
| 
      
 7 
     | 
    
         
            +
              "author":       "YOUR NAME HERE",
         
     | 
| 
      
 8 
     | 
    
         
            +
              "homepage":     "URL",
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              "directories": {
         
     | 
| 
      
 11 
     | 
    
         
            +
                "lib":        "./lib",
         
     | 
| 
      
 12 
     | 
    
         
            +
                "test":       "./tests"
         
     | 
| 
      
 13 
     | 
    
         
            +
              },
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              "dependencies": {
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
              },
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              "bpm:transport": "transport/transports/wrapper"
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,6 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*globals BPM_PLUGIN UGLYDUCK */
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            BPM_PLUGIN.minify = function(body, pkg, moduleId, pathname) {
         
     | 
| 
      
 4 
     | 
    
         
            +
              var whatIsUglyDuck = 'undefined' === typeof UGLYDUCK ? '(main not loaded)' : UGLYDUCK;
         
     | 
| 
      
 5 
     | 
    
         
            +
              return "//MINIFIED START\nUGLY DUCK "+UGLYDUCK+"\n"+body+"\n//MINIFIED END\n";
         
     | 
| 
      
 6 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "name":         "uglyduck",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "version":      "1.0.0",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "bpm":          "0.1.0",
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              "description":  "DESCRIPTION HERE",
         
     | 
| 
      
 7 
     | 
    
         
            +
              "author":       "YOUR NAME HERE",
         
     | 
| 
      
 8 
     | 
    
         
            +
              "homepage":     "URL",
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              "directories": {
         
     | 
| 
      
 11 
     | 
    
         
            +
                "lib":        "lib",
         
     | 
| 
      
 12 
     | 
    
         
            +
                "minifier":   "minifier",
         
     | 
| 
      
 13 
     | 
    
         
            +
                "test":       "tests"
         
     | 
| 
      
 14 
     | 
    
         
            +
              },
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              "dependencies": {
         
     | 
| 
      
 17 
     | 
    
         
            +
              },
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              "bpm:minifier": "uglyduck/minifier/main"
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
     | 
    
         
            -
            BPM_PLUGIN.compileTransport = function(body,  
     | 
| 
       3 
     | 
    
         
            -
              return "define_transport(function() {\n"+body+"\n}), '"+ 
     | 
| 
      
 2 
     | 
    
         
            +
            BPM_PLUGIN.compileTransport = function(body, context, filename) {
         
     | 
| 
      
 3 
     | 
    
         
            +
              return "define_transport(function() {\n"+body+"\n}), '"+context['package'].name+"', '"+context.moduleId+"', '"+filename+"');";
         
     | 
| 
       4 
4 
     | 
    
         
             
            };
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
         @@ -29,7 +29,7 @@ describe BPM::Pipeline, 'minifier' do 
     | 
|
| 
       29 
29 
     | 
    
         
             
               This file is generated automatically by the bpm (http://www.bpmjs.org)    
         
     | 
| 
       30 
30 
     | 
    
         
             
               =========================================================================*/
         
     | 
| 
       31 
31 
     | 
    
         
             
            //MINIFIED START
         
     | 
| 
       32 
     | 
    
         
            -
            UGLY DUCK IS  
     | 
| 
      
 32 
     | 
    
         
            +
            UGLY DUCK IS UGLYboston
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
            //MINIFIED END
         
     | 
| 
         @@ -48,7 +48,7 @@ EOF 
     | 
|
| 
       48 
48 
     | 
    
         
             
               This file is generated automatically by the bpm (http://www.bpmjs.org)    
         
     | 
| 
       49 
49 
     | 
    
         
             
               =========================================================================*/
         
     | 
| 
       50 
50 
     | 
    
         
             
            //MINIFIED START
         
     | 
| 
       51 
     | 
    
         
            -
            UGLY DUCK IS  
     | 
| 
      
 51 
     | 
    
         
            +
            UGLY DUCK IS UGLYsanfran
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
            #{File.read(file_path)}
         
     | 
| 
       54 
54 
     | 
    
         
             
            //MINIFIED END
         
     | 
| 
         @@ -31,5 +31,43 @@ describe BPM::Pipeline, 'transport processor' do 
     | 
|
| 
       31 
31 
     | 
    
         
             
                asset = subject.find_asset 'transport/lib/main.js'
         
     | 
| 
       32 
32 
     | 
    
         
             
                asset.to_s.should == "// TRANSPORT DEMO\n"
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            describe BPM::Pipeline, 'transport processor w/ minifier' do
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              before do
         
     | 
| 
      
 40 
     | 
    
         
            +
                goto_home
         
     | 
| 
      
 41 
     | 
    
         
            +
                set_host
         
     | 
| 
      
 42 
     | 
    
         
            +
                reset_libgems bpm_dir.to_s
         
     | 
| 
      
 43 
     | 
    
         
            +
                start_fake(FakeGemServer.new)
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                FileUtils.cp_r project_fixture('minitrans'), '.'
         
     | 
| 
      
 46 
     | 
    
         
            +
                cd home('minitrans')
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                bpm 'rebuild'
         
     | 
| 
      
 49 
     | 
    
         
            +
                wait
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
              
         
     | 
| 
      
 52 
     | 
    
         
            +
              subject do
         
     | 
| 
      
 53 
     | 
    
         
            +
                project = BPM::Project.new home('minitrans')
         
     | 
| 
      
 54 
     | 
    
         
            +
                BPM::Pipeline.new project
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
              
         
     | 
| 
      
 57 
     | 
    
         
            +
              it "should invoke minifier in project" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                asset = subject.find_asset 'bpm_libs.js'
         
     | 
| 
      
 59 
     | 
    
         
            +
                exp_path = home('transporter', 'lib', 'main.js')
         
     | 
| 
      
 60 
     | 
    
         
            +
                expected = <<EOF
         
     | 
| 
      
 61 
     | 
    
         
            +
            (function() { //MINIFIED START
         
     | 
| 
      
 62 
     | 
    
         
            +
            UGLY DUCK IS UGLY
         
     | 
| 
      
 63 
     | 
    
         
            +
            //TRANSPORT
         
     | 
| 
      
 64 
     | 
    
         
            +
            transporter();
         
     | 
| 
      
 65 
     | 
    
         
            +
            //TRANSPORT
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            //MINIFIED END
         
     | 
| 
      
 68 
     | 
    
         
            +
             })()
         
     | 
| 
      
 69 
     | 
    
         
            +
            EOF
         
     | 
| 
      
 70 
     | 
    
         
            +
                asset.to_s.should include(expected.to_json)
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
       34 
72 
     | 
    
         | 
| 
       35 
73 
     | 
    
         
             
            end
         
     |