bpm 0.1.4 → 1.0.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +20 -0
- data/README.md +1 -1
- data/TODO.md +90 -2
- data/bpm.gemspec +3 -3
- data/lib/bpm/cli/base.rb +103 -52
- data/lib/bpm/errors.rb +51 -0
- data/lib/bpm/init_generator.rb +1 -8
- data/lib/bpm/libgems_ext/libgems.rb +9 -0
- data/lib/bpm/local.rb +6 -11
- data/lib/bpm/package.rb +272 -178
- data/lib/bpm/pipeline/generated_asset.rb +88 -28
- data/lib/bpm/pipeline/plugin_asset.rb +8 -2
- data/lib/bpm/pipeline/source_url_processor.rb +16 -0
- data/lib/bpm/pipeline/transport_processor.rb +5 -3
- data/lib/bpm/pipeline.rb +33 -23
- data/lib/bpm/project.rb +492 -167
- data/lib/bpm/project_generator.rb +14 -1
- data/lib/bpm/remote.rb +6 -4
- data/lib/bpm/server.rb +4 -15
- data/lib/bpm/version.rb +2 -1
- data/lib/bpm.rb +2 -0
- data/man/bpm-add.1.ronn +22 -0
- data/man/bpm-build.1.ronn +22 -0
- data/man/bpm-compile.1.ronn +23 -0
- data/man/bpm-config.7.ronn +21 -0
- data/man/bpm-fetch.1.ronn +22 -0
- data/man/bpm-fetched.1.ronn +22 -0
- data/man/bpm-init.1.ronn +22 -0
- data/man/bpm-list.1.ronn +22 -0
- data/man/bpm-login.1.ronn +22 -0
- data/man/bpm-new.1.ronn +22 -0
- data/man/bpm-owner.1.ronn +22 -0
- data/man/bpm-preview.1.ronn +22 -0
- data/man/bpm-push.1.ronn +22 -0
- data/man/bpm-remove.1.ronn +22 -0
- data/man/bpm-unpack.1.ronn +22 -0
- data/man/bpm-yank.1.ronn +22 -0
- data/man/bpm.1.ronn +31 -0
- data/spec/cli/add_spec.rb +26 -7
- data/spec/cli/fetch_spec.rb +15 -6
- data/spec/cli/init_spec.rb +165 -25
- data/spec/cli/{build_spec.rb → pack_spec.rb} +9 -10
- data/spec/cli/push_spec.rb +4 -4
- data/spec/cli/rebuild_spec.rb +181 -0
- data/spec/cli/remove_spec.rb +3 -4
- data/spec/cli/unpack_spec.rb +6 -6
- data/spec/fixtures/gems/core-test-0.4.9.bpkg +0 -0
- data/spec/fixtures/{core-test-0.4.9.bpkg → gems/uglify-js-1.0.4.bpkg} +0 -0
- data/spec/fixtures/packages/core-test/extras/extra_file.html +3 -0
- data/spec/fixtures/packages/core-test/index.html +3 -0
- data/spec/fixtures/{core-test → packages/core-test}/package.json +9 -3
- data/spec/fixtures/packages/invalid_json/package.json +3 -0
- data/spec/fixtures/packages/uglify-js/README.html +825 -0
- data/spec/fixtures/packages/uglify-js/README.org +431 -0
- data/spec/fixtures/packages/uglify-js/bin/uglifyjs +305 -0
- data/spec/fixtures/packages/uglify-js/docstyle.css +75 -0
- data/spec/fixtures/packages/uglify-js/lib/parse-js.js +1 -0
- data/spec/fixtures/packages/uglify-js/lib/process.js +1 -0
- data/spec/fixtures/packages/uglify-js/lib/squeeze-more.js +1 -0
- data/spec/fixtures/packages/uglify-js/package.json +27 -0
- data/spec/fixtures/packages/uglify-js/plugins/minifier.js +6 -0
- data/spec/fixtures/packages/uglify-js/uglify-js.js +17 -0
- data/spec/fixtures/projects/hello2/README.md +21 -0
- data/{templates/init → spec/fixtures/projects/hello2}/assets/bpm_packages.js +6 -1
- data/{templates/init → spec/fixtures/projects/hello2}/assets/bpm_styles.css +1 -1
- data/spec/fixtures/projects/hello2/hello2.json +16 -0
- data/spec/fixtures/projects/hello2/index.html +13 -0
- data/spec/fixtures/projects/hello2/packages/a/lib/main.js +2 -0
- data/spec/fixtures/projects/hello2/packages/a/package.json +17 -0
- data/spec/fixtures/projects/hello2/packages/b/lib/main.js +2 -0
- data/spec/fixtures/projects/hello2/packages/b/package.json +17 -0
- data/spec/fixtures/projects/hello2/packages/c/lib/main.js +2 -0
- data/spec/fixtures/projects/hello2/packages/c/package.json +16 -0
- data/spec/fixtures/projects/hello_dev/LICENSE +19 -0
- data/spec/fixtures/projects/hello_dev/README.md +21 -0
- data/spec/fixtures/projects/hello_dev/app/main.js +6 -0
- data/spec/fixtures/projects/hello_dev/assets/bpm_libs.js +5 -0
- data/spec/fixtures/projects/hello_dev/assets/bpm_styles.css +6 -0
- data/spec/fixtures/projects/hello_dev/css/main.css +1 -0
- data/spec/fixtures/projects/hello_dev/hello_dev.json +25 -0
- data/spec/fixtures/projects/hello_dev/index.html +14 -0
- data/spec/fixtures/projects/hello_dev/packages/style_package/css/some_style.css +3 -0
- data/spec/fixtures/{minitest/minitest.json → projects/hello_dev/packages/style_package/package.json} +5 -9
- data/spec/fixtures/projects/hello_world/LICENSE +19 -0
- data/spec/fixtures/projects/hello_world/assets/bpm_packages.js +1 -0
- data/spec/fixtures/projects/hello_world/assets/bpm_styles.css +1 -0
- data/spec/fixtures/projects/hello_world/custom_dir/custom.js +1 -0
- data/spec/fixtures/projects/hello_world/hello_world.json +41 -0
- data/spec/fixtures/projects/hello_world/lib/another.js +1 -0
- data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/package.json +5 -2
- data/spec/fixtures/projects/hello_world/vendor/lib/something.js +1 -0
- data/spec/fixtures/projects/init_app/assets/bpm_libs.js +6 -0
- data/spec/fixtures/projects/init_app/assets/bpm_styles.css +5 -0
- data/spec/fixtures/projects/init_app/assets/new_project/bpm_libs.js +6 -0
- data/spec/fixtures/projects/init_app/assets/new_project/bpm_styles.css +5 -0
- data/spec/fixtures/projects/init_app/new_project.json +27 -0
- data/spec/fixtures/projects/init_default/assets/bpm_libs.js +6 -0
- data/spec/fixtures/projects/init_default/assets/bpm_styles.css +5 -0
- data/spec/fixtures/projects/init_default/new_project.json +15 -0
- data/spec/fixtures/projects/minitest/minitest.json +26 -0
- data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/package.json +1 -1
- data/spec/fixtures/projects/needs_rake/needs_rake.json +7 -0
- data/spec/fixtures/{transporter → projects/transporter}/packages/transport/package.json +1 -1
- data/spec/package_spec.rb +343 -315
- data/spec/pipeline_spec.rb +89 -71
- data/spec/plugins/minifier_spec.rb +25 -16
- data/spec/plugins/transport_spec.rb +1 -1
- data/spec/project_spec.rb +97 -34
- data/spec/spec_helper.rb +41 -0
- data/spec/support/fake_gem_server.rb +8 -4
- data/spec/support/path.rb +8 -0
- data/spec/support/project.rb +50 -17
- data/templates/init/project.json +12 -14
- data/templates/project/LICENSE +1 -1
- data/templates/project/app/main.js +6 -0
- data/templates/project/css/main.css +1 -0
- data/templates/project/index.html +4 -3
- data/vendor/sprockets/.travis.yml +3 -2
- data/vendor/sprockets/Gemfile +0 -6
- data/vendor/sprockets/lib/sprockets/asset.rb +7 -12
- data/vendor/sprockets/lib/sprockets/asset_attributes.rb +70 -53
- data/vendor/sprockets/lib/sprockets/base.rb +1 -14
- data/vendor/sprockets/lib/sprockets/bundled_asset.rb +72 -45
- data/vendor/sprockets/lib/sprockets/caching.rb +28 -23
- data/vendor/sprockets/lib/sprockets/context.rb +56 -26
- data/vendor/sprockets/lib/sprockets/directive_processor.rb +21 -4
- data/vendor/sprockets/lib/sprockets/eco_template.rb +3 -4
- data/vendor/sprockets/lib/sprockets/ejs_template.rb +3 -4
- data/vendor/sprockets/lib/sprockets/engines.rb +26 -1
- data/vendor/sprockets/lib/sprockets/environment.rb +2 -1
- data/vendor/sprockets/lib/sprockets/index.rb +1 -0
- data/vendor/sprockets/lib/sprockets/mime.rb +38 -0
- data/vendor/sprockets/lib/sprockets/processing.rb +4 -45
- data/vendor/sprockets/lib/sprockets/static_asset.rb +5 -6
- data/vendor/sprockets/lib/sprockets/static_compilation.rb +4 -12
- data/vendor/sprockets/lib/sprockets/trail.rb +2 -1
- data/vendor/sprockets/test/fixtures/default/blank.gif +0 -0
- data/vendor/sprockets/test/fixtures/default/with_data_uri.css.erb +3 -0
- data/vendor/sprockets/test/test_asset.rb +121 -15
- data/vendor/sprockets/test/test_asset_attributes.rb +85 -21
- data/vendor/sprockets/test/test_environment.rb +13 -36
- metadata +564 -444
- data/spec/cli/new_spec.rb +0 -118
- data/spec/fixtures/hello_world/assets/bpm_packages.js +0 -13
- data/spec/fixtures/hello_world/assets/bpm_styles.css +0 -14
- data/spec/fixtures/hello_world/hello_world.json +0 -20
- /data/spec/fixtures/{badrake-0.8.7.bpkg → gems/badrake-0.8.7.bpkg} +0 -0
- /data/spec/fixtures/{builder-3.0.0.bpkg → gems/builder-3.0.0.bpkg} +0 -0
- /data/spec/fixtures/{bundler-1.1.pre.bpkg → gems/bundler-1.1.pre.bpkg} +0 -0
- /data/spec/fixtures/{coffee-1.0.1.pre.bpkg → gems/coffee-1.0.1.pre.bpkg} +0 -0
- /data/spec/fixtures/{custom_generator-1.0.bpkg → gems/custom_generator-1.0.bpkg} +0 -0
- /data/spec/fixtures/{highline-1.6.1.bpkg → gems/highline-1.6.1.bpkg} +0 -0
- /data/spec/fixtures/{ivory-0.0.1.bpkg → gems/ivory-0.0.1.bpkg} +0 -0
- /data/spec/fixtures/{jquery-1.4.3.bpkg → gems/jquery-1.4.3.bpkg} +0 -0
- /data/spec/fixtures/{optparse-1.0.1.bpkg → gems/optparse-1.0.1.bpkg} +0 -0
- /data/spec/fixtures/{rake-0.8.6.bpkg → gems/rake-0.8.6.bpkg} +0 -0
- /data/spec/fixtures/{rake-0.8.7.bpkg → gems/rake-0.8.7.bpkg} +0 -0
- /data/spec/fixtures/{spade-0.5.0.bpkg → gems/spade-0.5.0.bpkg} +0 -0
- /data/spec/fixtures/{src → packages}/README.txt +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/.gitignore +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/CHANGELOG.md +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/ISSUES.md +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/LICENSE +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/README.md +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/UPGRADING.md +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/bin/bundle +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/definition.js +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/dependency.js +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/dsl.js +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/ui.js +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler.js +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-config.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-exec.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-install.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-package.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-update.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/gemfile.5.ronn +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/index.txt +0 -0
- /data/spec/fixtures/{src → packages}/bundler-1.1.pre/package.json +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/bin/cake +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/bin/coffee +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee/base.js +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee/mocha/chai.js +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee.js +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/package.json +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/qunit/coffee/test.js +0 -0
- /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/qunit/test.js +0 -0
- /data/spec/fixtures/{core-test → packages/core-test}/bin/cot +0 -0
- /data/spec/fixtures/{core-test → packages/core-test}/lib/main.js +0 -0
- /data/spec/fixtures/{core-test → packages/core-test}/resources/runner.css +0 -0
- /data/spec/fixtures/{core-test → packages/core-test}/tests/test.js +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/lib/main.js +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/package.json +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/init/project.json +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project/app.js +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project/lib/main.js +0 -0
- /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project_generator.rb +0 -0
- /data/spec/fixtures/{src → packages}/jquery/lib/main.js +0 -0
- /data/spec/fixtures/{src → packages}/jquery/package.json +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/CHANGES +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/MIT-LICENSE +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/README +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/Rakefile +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/TODO +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/bin/rake +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/command_line_usage.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/Rakefile1 +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/Rakefile2 +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/a.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/b.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/main.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/glossary.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/jamis.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/proto_rake.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rake.1.gz +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rakefile.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rational.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.4.14.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.4.15.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.4.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.6.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.1.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.2.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.2.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.4.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.5.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.6.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/install.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/alt_system.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/classic_namespace.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/clean.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/compositepublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/ftptools.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/publisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/rubyforgepublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/sshpublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/sys.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/gempackagetask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/loaders/makefile.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/packagetask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/rake_test_loader.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/rdoctask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/ruby182_test_unit_fix.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/runtest.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/tasklib.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/testtask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/win32.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/package.json +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.6/test/capture_stdout.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/CHANGES +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/MIT-LICENSE +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/README +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/Rakefile +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/TODO +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/bin/rake +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/command_line_usage.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/Rakefile1 +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/Rakefile2 +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/a.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/b.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/main.c +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/glossary.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/jamis.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/proto_rake.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rake.1.gz +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rakefile.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rational.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/install.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/alt_system.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/classic_namespace.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/clean.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/ftptools.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/publisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/sys.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/gempackagetask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/loaders/makefile.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/packagetask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/rake_test_loader.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/rdoctask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/runtest.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/tasklib.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/testtask.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/win32.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake.rb +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/package.json +0 -0
- /data/spec/fixtures/{src → packages}/rake-0.8.7/test/capture_stdout.rb +0 -0
- /data/spec/fixtures/{src → packages}/spade/lib/main.js +0 -0
- /data/spec/fixtures/{src → packages}/spade/package.json +0 -0
- /data/spec/fixtures/{custom_name → projects/custom_name}/MyProject.json +0 -0
- /data/spec/fixtures/{hello_world → projects/hello2}/LICENSE +0 -0
- /data/{templates/project → spec/fixtures/projects/hello2}/app.js +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/README.md +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/assets/papa-smurf.jpg +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/css/dummy.css +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/lib/main.js +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/assets/dummy.txt +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/css/sample_styles.css +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/custom_dir/basic-module.js +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/lib/main.js +0 -0
- /data/spec/fixtures/{hello_world → projects/hello_world}/tests/main-test.js +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/assets/bpm_packages.js +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/assets/bpm_styles.css +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/assets/minitest/app_package.js +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/lib/main.js +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/lib/main.js +0 -0
- /data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/minifier/main.js +0 -0
- /data/spec/fixtures/{simple_hello/assets/bpm_packages.js → projects/simple_hello/assets/bpm_libs.js} +0 -0
- /data/spec/fixtures/{simple_hello → projects/simple_hello}/lib/main.js +0 -0
- /data/spec/fixtures/{transporter → projects/transporter}/lib/main.js +0 -0
- /data/spec/fixtures/{transporter → projects/transporter}/packages/transport/lib/main.js +0 -0
- /data/spec/fixtures/{transporter → projects/transporter}/packages/transport/transports/wrapper.js +0 -0
- /data/spec/fixtures/{transporter → projects/transporter}/transporter.json +0 -0
@@ -7,6 +7,11 @@ module Sprockets
|
|
7
7
|
# any processing or concatenation. These are typical images and
|
8
8
|
# other binary files.
|
9
9
|
class StaticAsset < Asset
|
10
|
+
# Define extra attributes to be serialized.
|
11
|
+
def self.serialized_attributes
|
12
|
+
super + %w( content_type mtime length digest )
|
13
|
+
end
|
14
|
+
|
10
15
|
def initialize(environment, logical_path, pathname, digest = nil)
|
11
16
|
super(environment, logical_path, pathname)
|
12
17
|
@digest = digest
|
@@ -22,11 +27,6 @@ module Sprockets
|
|
22
27
|
# Checks if Asset is fresh by comparing the actual mtime and
|
23
28
|
# digest to the inmemory model.
|
24
29
|
def fresh?
|
25
|
-
# Check if environment has changed first
|
26
|
-
if environment.digest.hexdigest != environment_hexdigest
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
|
30
30
|
# Check current mtime and digest
|
31
31
|
dependency_fresh?('path' => pathname, 'mtime' => mtime, 'hexdigest' => digest)
|
32
32
|
end
|
@@ -81,7 +81,6 @@ module Sprockets
|
|
81
81
|
mtime
|
82
82
|
length
|
83
83
|
digest
|
84
|
-
environment_hexdigest
|
85
84
|
end
|
86
85
|
end
|
87
86
|
end
|
@@ -35,10 +35,10 @@ module Sprockets
|
|
35
35
|
files.each do |logical_path|
|
36
36
|
if path.is_a?(Regexp)
|
37
37
|
# Match path against `Regexp`
|
38
|
-
next unless path.match(logical_path
|
38
|
+
next unless path.match(logical_path)
|
39
39
|
else
|
40
40
|
# Otherwise use fnmatch glob syntax
|
41
|
-
next unless
|
41
|
+
next unless File.fnmatch(path.to_s, logical_path)
|
42
42
|
end
|
43
43
|
|
44
44
|
if asset = find_asset(logical_path)
|
@@ -59,21 +59,13 @@ module Sprockets
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
protected
|
63
|
-
def compute_digest
|
64
|
-
# Add static root to environment digest
|
65
|
-
super.update(static_root.to_s)
|
66
|
-
end
|
67
|
-
|
68
62
|
private
|
69
63
|
# Get all reachable files in environment path
|
70
64
|
def files
|
71
65
|
files = Set.new
|
72
66
|
paths.each do |base_path|
|
73
|
-
|
74
|
-
|
75
|
-
logical_path = Pathname.new(filename).relative_path_from(base_pathname)
|
76
|
-
files << attributes_for(logical_path).without_engine_extensions
|
67
|
+
Dir["#{base_path}/**/*"].each do |filename|
|
68
|
+
files << attributes_for(filename).logical_path
|
77
69
|
end
|
78
70
|
end
|
79
71
|
files
|
@@ -70,7 +70,8 @@ module Sprockets
|
|
70
70
|
def resolve(logical_path, options = {})
|
71
71
|
# If a block is given, preform an iterable search
|
72
72
|
if block_given?
|
73
|
-
|
73
|
+
args = attributes_for(logical_path).search_paths + [options]
|
74
|
+
trail.find(*args) do |path|
|
74
75
|
yield Pathname.new(path)
|
75
76
|
end
|
76
77
|
else
|
Binary file
|
@@ -110,18 +110,12 @@ class StaticAssetTest < Sprockets::TestCase
|
|
110
110
|
assert @asset.fresh?
|
111
111
|
end
|
112
112
|
|
113
|
-
test "asset is stale if its environment has changed" do
|
114
|
-
assert @asset.fresh?
|
115
|
-
@env.prepend_path fixture_path('default')
|
116
|
-
assert @asset.stale?
|
117
|
-
end
|
118
|
-
|
119
113
|
test "asset is fresh if its mtime is changed but its contents is the same" do
|
120
|
-
filename = fixture_path('asset/POW.png')
|
114
|
+
filename = fixture_path('asset/test-POW.png')
|
121
115
|
|
122
116
|
sandbox filename do
|
123
117
|
File.open(filename, 'w') { |f| f.write "a" }
|
124
|
-
asset = @env['POW.png']
|
118
|
+
asset = @env['test-POW.png']
|
125
119
|
|
126
120
|
assert asset.fresh?
|
127
121
|
|
@@ -406,13 +400,6 @@ class BundledAssetTest < Sprockets::TestCase
|
|
406
400
|
assert asset("application.js").fresh?
|
407
401
|
end
|
408
402
|
|
409
|
-
test "asset is stale if its environment has changed" do
|
410
|
-
asset = asset("application.js")
|
411
|
-
assert asset.fresh?
|
412
|
-
@env.prepend_path fixture_path("default")
|
413
|
-
assert asset.stale?
|
414
|
-
end
|
415
|
-
|
416
403
|
test "asset is stale when its contents has changed" do
|
417
404
|
filename = fixture_path('asset/test.js')
|
418
405
|
|
@@ -464,6 +451,125 @@ class BundledAssetTest < Sprockets::TestCase
|
|
464
451
|
end
|
465
452
|
end
|
466
453
|
|
454
|
+
test "asset is stale when one of its dependencies is modified" do
|
455
|
+
main = fixture_path('asset/test-main.js')
|
456
|
+
dep = fixture_path('asset/test-dep.js')
|
457
|
+
|
458
|
+
sandbox main, dep do
|
459
|
+
File.open(main, 'w') { |f| f.write "//= depend_on test-dep\n" }
|
460
|
+
File.open(dep, 'w') { |f| f.write "a;" }
|
461
|
+
asset = @env['test-main.js']
|
462
|
+
|
463
|
+
assert asset.fresh?
|
464
|
+
|
465
|
+
File.open(dep, 'w') { |f| f.write "b;" }
|
466
|
+
mtime = Time.now + 1
|
467
|
+
File.utime(mtime, mtime, dep)
|
468
|
+
|
469
|
+
assert asset.stale?
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
test "asset is stale when one of its asset dependencies is modified" do
|
474
|
+
main = fixture_path('asset/test-main.js')
|
475
|
+
dep = fixture_path('asset/test-dep.js')
|
476
|
+
|
477
|
+
sandbox main, dep do
|
478
|
+
File.open(main, 'w') { |f| f.write "//= depend_on_asset test-dep\n" }
|
479
|
+
File.open(dep, 'w') { |f| f.write "a;" }
|
480
|
+
asset = @env['test-main.js']
|
481
|
+
|
482
|
+
assert asset.fresh?
|
483
|
+
|
484
|
+
File.open(dep, 'w') { |f| f.write "b;" }
|
485
|
+
mtime = Time.now + 1
|
486
|
+
File.utime(mtime, mtime, dep)
|
487
|
+
|
488
|
+
assert asset.stale?
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
test "asset is stale when one of its source files dependencies is modified" do
|
493
|
+
a = fixture_path('asset/test-a.js')
|
494
|
+
b = fixture_path('asset/test-b.js')
|
495
|
+
c = fixture_path('asset/test-c.js')
|
496
|
+
|
497
|
+
sandbox a, b, c do
|
498
|
+
File.open(a, 'w') { |f| f.write "//= require test-b\n" }
|
499
|
+
File.open(b, 'w') { |f| f.write "//= require test-c\n" }
|
500
|
+
File.open(c, 'w') { |f| f.write "c;" }
|
501
|
+
asset_a = @env['test-a.js']
|
502
|
+
asset_b = @env['test-b.js']
|
503
|
+
asset_c = @env['test-c.js']
|
504
|
+
|
505
|
+
assert asset_a.fresh?
|
506
|
+
assert asset_b.fresh?
|
507
|
+
assert asset_c.fresh?
|
508
|
+
|
509
|
+
File.open(c, 'w') { |f| f.write "x;" }
|
510
|
+
mtime = Time.now + 1
|
511
|
+
File.utime(mtime, mtime, c)
|
512
|
+
|
513
|
+
assert asset_a.stale?
|
514
|
+
assert asset_b.stale?
|
515
|
+
assert asset_c.stale?
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
test "asset is stale when one of its dependency dependencies is modified" do
|
520
|
+
a = fixture_path('asset/test-a.js')
|
521
|
+
b = fixture_path('asset/test-b.js')
|
522
|
+
c = fixture_path('asset/test-c.js')
|
523
|
+
|
524
|
+
sandbox a, b, c do
|
525
|
+
File.open(a, 'w') { |f| f.write "//= require test-b\n" }
|
526
|
+
File.open(b, 'w') { |f| f.write "//= depend_on test-c\n" }
|
527
|
+
File.open(c, 'w') { |f| f.write "c;" }
|
528
|
+
asset_a = @env['test-a.js']
|
529
|
+
asset_b = @env['test-b.js']
|
530
|
+
asset_c = @env['test-c.js']
|
531
|
+
|
532
|
+
assert asset_a.fresh?
|
533
|
+
assert asset_b.fresh?
|
534
|
+
assert asset_c.fresh?
|
535
|
+
|
536
|
+
File.open(c, 'w') { |f| f.write "x;" }
|
537
|
+
mtime = Time.now + 1
|
538
|
+
File.utime(mtime, mtime, c)
|
539
|
+
|
540
|
+
assert asset_a.stale?
|
541
|
+
assert asset_b.stale?
|
542
|
+
assert asset_c.stale?
|
543
|
+
end
|
544
|
+
end
|
545
|
+
|
546
|
+
test "asset is stale when one of its asset dependency dependencies is modified" do
|
547
|
+
a = fixture_path('asset/test-a.js')
|
548
|
+
b = fixture_path('asset/test-b.js')
|
549
|
+
c = fixture_path('asset/test-c.js')
|
550
|
+
|
551
|
+
sandbox a, b, c do
|
552
|
+
File.open(a, 'w') { |f| f.write "//= depend_on_asset test-b\n" }
|
553
|
+
File.open(b, 'w') { |f| f.write "//= depend_on_asset test-c\n" }
|
554
|
+
File.open(c, 'w') { |f| f.write "c;" }
|
555
|
+
asset_a = @env['test-a.js']
|
556
|
+
asset_b = @env['test-b.js']
|
557
|
+
asset_c = @env['test-c.js']
|
558
|
+
|
559
|
+
assert asset_a.fresh?
|
560
|
+
assert asset_b.fresh?
|
561
|
+
assert asset_c.fresh?
|
562
|
+
|
563
|
+
File.open(c, 'w') { |f| f.write "x;" }
|
564
|
+
mtime = Time.now + 1
|
565
|
+
File.utime(mtime, mtime, c)
|
566
|
+
|
567
|
+
assert asset_a.stale?
|
568
|
+
assert asset_b.stale?
|
569
|
+
assert asset_c.stale?
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
467
573
|
test "asset if stale if once of its source files is removed" do
|
468
574
|
main = fixture_path('asset/test-main.js')
|
469
575
|
dep = fixture_path('asset/test-dep.js')
|
@@ -1,17 +1,63 @@
|
|
1
1
|
require 'sprockets_test'
|
2
2
|
|
3
3
|
class TestAssetAttributes < Sprockets::TestCase
|
4
|
-
test "
|
5
|
-
assert_equal
|
6
|
-
pathname(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
test "expand and relativize root" do
|
5
|
+
assert_equal __FILE__,
|
6
|
+
pathname(pathname(__FILE__).relativize_root).expand_root
|
7
|
+
end
|
8
|
+
|
9
|
+
test "search paths" do
|
10
|
+
assert_equal ["index"],
|
11
|
+
pathname("index").search_paths
|
12
|
+
assert_equal ["index.html"],
|
13
|
+
pathname("index.html").search_paths
|
14
|
+
assert_equal ["index.css", "index.less", "index.sass", "index.scss"],
|
15
|
+
pathname("index.css").search_paths
|
16
|
+
assert_equal ["index.js", "index.coffee", "index.jst"],
|
17
|
+
pathname("index.js").search_paths
|
18
|
+
assert_equal ["index.coffee"], pathname("index.coffee").search_paths
|
19
|
+
assert_equal ["index.js.coffee"], pathname("index.js.coffee").search_paths
|
20
|
+
|
21
|
+
assert_equal ["foo", "foo/index"],
|
22
|
+
pathname("foo").search_paths
|
23
|
+
assert_equal ["foo.html", "foo/index.html"],
|
24
|
+
pathname("foo.html").search_paths
|
25
|
+
assert_equal ["foo.js", "foo.coffee", "foo.jst", "foo/index.js", "foo/index.coffee", "foo/index.jst"],
|
26
|
+
pathname("foo.js").search_paths
|
27
|
+
assert_equal ["foo.coffee", "foo/index.coffee"],
|
28
|
+
pathname("foo.coffee").search_paths
|
29
|
+
assert_equal ["foo.js.coffee", "foo/index.js.coffee"],
|
30
|
+
pathname("foo.js.coffee").search_paths
|
31
|
+
|
32
|
+
assert_equal ["foo/bar", "foo/bar/index"], pathname("foo/bar").search_paths
|
33
|
+
assert_equal ["foo/bar.js", "foo/bar.coffee", "foo/bar.jst", "foo/bar/index.js", "foo/bar/index.coffee", "foo/bar/index.jst"],
|
34
|
+
pathname("foo/bar.js").search_paths
|
35
|
+
assert_equal ["foo/bar.coffee", "foo/bar/index.coffee"], pathname("foo/bar.coffee").search_paths
|
36
|
+
assert_equal ["foo/bar.js.coffee", "foo/bar/index.js.coffee"], pathname("foo/bar.js.coffee").search_paths
|
37
|
+
|
38
|
+
assert_equal ["jquery.foo.coffee", "jquery/index.foo.coffee"],
|
39
|
+
pathname("jquery.foo.coffee").search_paths
|
40
|
+
assert_equal ["jquery.foo.js.coffee", "jquery/index.foo.js.coffee"],
|
41
|
+
pathname("jquery.foo.js.coffee").search_paths
|
42
|
+
assert_equal ["jquery.foo.js", "jquery.foo.coffee", "jquery.foo.jst",
|
43
|
+
"jquery/index.foo.js", "jquery/index.foo.coffee", "jquery/index.foo.jst"],
|
44
|
+
pathname("jquery.foo.js").search_paths
|
45
|
+
end
|
46
|
+
|
47
|
+
test "logical path" do
|
48
|
+
assert_equal nil, pathname(fixture_path("missing/application.js")).logical_path
|
49
|
+
|
50
|
+
assert_equal "application.js", pathname(fixture_path("default/application.js")).logical_path
|
51
|
+
assert_equal "application.css", pathname(fixture_path("default/application.css")).logical_path
|
52
|
+
assert_equal "jquery.foo.min.js", pathname(fixture_path("default/jquery.foo.min.js")).logical_path
|
53
|
+
|
54
|
+
assert_equal "application.js", pathname(fixture_path("default/application.js.erb")).logical_path
|
55
|
+
assert_equal "application.js", pathname(fixture_path("default/application.js.coffee")).logical_path
|
56
|
+
assert_equal "application.css", pathname(fixture_path("default/application.css.scss")).logical_path
|
57
|
+
|
58
|
+
assert_equal "application.js", pathname(fixture_path("default/application.coffee")).logical_path
|
59
|
+
assert_equal "application.css", pathname(fixture_path("default/application.scss")).logical_path
|
60
|
+
assert_equal "hello.js", pathname(fixture_path("default/hello.jst.ejs")).logical_path
|
15
61
|
end
|
16
62
|
|
17
63
|
test "extensions" do
|
@@ -27,7 +73,7 @@ class TestAssetAttributes < Sprockets::TestCase
|
|
27
73
|
pathname("gallery.css.erb").extensions
|
28
74
|
end
|
29
75
|
|
30
|
-
test "
|
76
|
+
test "format extension" do
|
31
77
|
assert_equal nil, pathname("empty").format_extension
|
32
78
|
assert_equal ".js", pathname("gallery.js").format_extension
|
33
79
|
assert_equal ".js", pathname("application.js.coffee").format_extension
|
@@ -39,15 +85,17 @@ class TestAssetAttributes < Sprockets::TestCase
|
|
39
85
|
assert_equal ".js", pathname("jquery.min.js").format_extension
|
40
86
|
assert_equal ".js", pathname("jquery.tmpl.js").format_extension
|
41
87
|
assert_equal ".js", pathname("jquery.tmpl.min.js").format_extension
|
88
|
+
|
89
|
+
env = Sprockets::Environment.new
|
90
|
+
env.register_engine '.ms', Class.new
|
91
|
+
assert_equal nil, env.attributes_for("foo.jst.ms").format_extension
|
42
92
|
end
|
43
93
|
|
44
|
-
test "
|
94
|
+
test "engine extensions" do
|
45
95
|
assert_equal [], pathname("empty").engine_extensions
|
46
96
|
assert_equal [], pathname("gallery.js").engine_extensions
|
47
|
-
assert_equal [".coffee"],
|
48
|
-
|
49
|
-
assert_equal [".coffee", ".erb"],
|
50
|
-
pathname("project.js.coffee.erb").engine_extensions
|
97
|
+
assert_equal [".coffee"], pathname("application.js.coffee").engine_extensions
|
98
|
+
assert_equal [".coffee", ".erb"], pathname("project.js.coffee.erb").engine_extensions
|
51
99
|
assert_equal [".erb"], pathname("gallery.css.erb").engine_extensions
|
52
100
|
assert_equal [".erb"], pathname("gallery.erb").engine_extensions
|
53
101
|
assert_equal [], pathname("jquery.js").engine_extensions
|
@@ -55,11 +103,14 @@ class TestAssetAttributes < Sprockets::TestCase
|
|
55
103
|
assert_equal [], pathname("jquery.tmpl.min.js").engine_extensions
|
56
104
|
assert_equal [".erb"], pathname("jquery.js.erb").engine_extensions
|
57
105
|
assert_equal [".erb"], pathname("jquery.min.js.erb").engine_extensions
|
58
|
-
assert_equal [".coffee"],
|
59
|
-
|
106
|
+
assert_equal [".coffee"], pathname("jquery.min.coffee").engine_extensions
|
107
|
+
|
108
|
+
env = Sprockets::Environment.new
|
109
|
+
env.register_engine '.ms', Class.new
|
110
|
+
assert_equal [".jst", ".ms"], env.attributes_for("foo.jst.ms").engine_extensions
|
60
111
|
end
|
61
112
|
|
62
|
-
test "
|
113
|
+
test "content type" do
|
63
114
|
assert_equal "application/octet-stream",
|
64
115
|
pathname("empty").content_type
|
65
116
|
assert_equal "application/javascript",
|
@@ -79,8 +130,21 @@ class TestAssetAttributes < Sprockets::TestCase
|
|
79
130
|
end
|
80
131
|
end
|
81
132
|
|
133
|
+
test "get path fingerprint" do
|
134
|
+
assert_equal nil, pathname("foo.js").path_fingerprint
|
135
|
+
assert_equal "0aa2105d29558f3eb790d411d7d8fb66",
|
136
|
+
pathname("foo-0aa2105d29558f3eb790d411d7d8fb66.js").path_fingerprint
|
137
|
+
end
|
138
|
+
|
139
|
+
test "inject path fingerprint" do
|
140
|
+
assert_equal "foo-0aa2105d29558f3eb790d411d7d8fb66.js",
|
141
|
+
pathname("foo.js").path_with_fingerprint("0aa2105d29558f3eb790d411d7d8fb66")
|
142
|
+
end
|
143
|
+
|
82
144
|
private
|
83
145
|
def pathname(path)
|
84
|
-
Sprockets::Environment.new
|
146
|
+
env = Sprockets::Environment.new
|
147
|
+
env.append_path fixture_path("default")
|
148
|
+
env.attributes_for(path)
|
85
149
|
end
|
86
150
|
end
|
@@ -67,6 +67,12 @@ module EnvironmentTests
|
|
67
67
|
assert_equal "hello: world\n", context.call("JST['hello']", :name => "world")
|
68
68
|
end
|
69
69
|
|
70
|
+
test "asset_data_uri helper" do
|
71
|
+
asset = @env["with_data_uri.css"]
|
72
|
+
assert_equal "body {\n background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAP%2F%2F%2FwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D) no-repeat;\n}\n", asset.to_s
|
73
|
+
assert asset.send(:dependency_paths).find { |dependency| dependency["path"] == fixture_path("default/blank.gif") }
|
74
|
+
end
|
75
|
+
|
70
76
|
test "lookup mime type" do
|
71
77
|
assert_equal "application/javascript", @env.mime_types(".js")
|
72
78
|
assert_equal "application/javascript", @env.mime_types("js")
|
@@ -85,6 +91,8 @@ module EnvironmentTests
|
|
85
91
|
@env.resolve("gallery.js").to_s
|
86
92
|
assert_equal fixture_path('default/gallery.js'),
|
87
93
|
@env.resolve(Pathname.new("gallery.js")).to_s
|
94
|
+
assert_equal fixture_path('default/coffee/foo.coffee'),
|
95
|
+
@env.resolve("coffee/foo.js").to_s
|
88
96
|
end
|
89
97
|
|
90
98
|
test "missing file raises an exception" do
|
@@ -101,6 +109,11 @@ module EnvironmentTests
|
|
101
109
|
assert_equal "var Gallery = {};\n", @env[fixture_path("default/gallery.js")].to_s
|
102
110
|
end
|
103
111
|
|
112
|
+
test "find bundled asset with implicit format" do
|
113
|
+
assert_equal "(function() {\n var foo;\n foo = 'hello';\n}).call(this);\n",
|
114
|
+
@env["coffee/foo.js"].to_s
|
115
|
+
end
|
116
|
+
|
104
117
|
test "find static asset in environment" do
|
105
118
|
assert_equal "Hello world\n", @env["hello.txt"].to_s
|
106
119
|
end
|
@@ -295,23 +308,15 @@ class TestEnvironment < Sprockets::TestCase
|
|
295
308
|
end
|
296
309
|
|
297
310
|
test "register mime type" do
|
298
|
-
old_digest = @env.digest
|
299
311
|
assert !@env.mime_types("jst")
|
300
|
-
|
301
312
|
@env.register_mime_type("application/javascript", "jst")
|
302
|
-
|
303
313
|
assert_equal "application/javascript", @env.mime_types("jst")
|
304
|
-
assert_not_equal old_digest, @env.digest
|
305
314
|
end
|
306
315
|
|
307
316
|
test "register bundle processor" do
|
308
|
-
old_digest = @env.digest
|
309
317
|
assert !@env.bundle_processors('text/css').include?(WhitespaceCompressor)
|
310
|
-
|
311
318
|
@env.register_bundle_processor 'text/css', WhitespaceCompressor
|
312
|
-
|
313
319
|
assert @env.bundle_processors('text/css').include?(WhitespaceCompressor)
|
314
|
-
assert_not_equal old_digest, @env.digest
|
315
320
|
end
|
316
321
|
|
317
322
|
test "unregister custom block preprocessor" do
|
@@ -338,16 +343,6 @@ class TestEnvironment < Sprockets::TestCase
|
|
338
343
|
assert_equal old_size, @env.bundle_processors('text/css').size
|
339
344
|
end
|
340
345
|
|
341
|
-
test "changing css compressor expires old assets" do
|
342
|
-
old_digest = @env.digest
|
343
|
-
assert_equal ".gallery {\n color: red;\n}\n", @env["gallery.css"].to_s
|
344
|
-
|
345
|
-
@env.css_compressor = WhitespaceCompressor
|
346
|
-
|
347
|
-
assert_equal ".gallery{color:red;}", @env["gallery.css"].to_s
|
348
|
-
assert_not_equal old_digest, @env.digest
|
349
|
-
end
|
350
|
-
|
351
346
|
test "setting css compressor to nil clears current compressor" do
|
352
347
|
old_digest = @env.digest
|
353
348
|
@env.css_compressor = WhitespaceCompressor
|
@@ -356,16 +351,6 @@ class TestEnvironment < Sprockets::TestCase
|
|
356
351
|
assert_nil @env.css_compressor
|
357
352
|
end
|
358
353
|
|
359
|
-
test "changing js compressor expires old assets" do
|
360
|
-
old_digest = @env.digest
|
361
|
-
assert_equal "var Gallery = {};\n", @env["gallery.js"].to_s
|
362
|
-
|
363
|
-
@env.js_compressor = WhitespaceCompressor
|
364
|
-
|
365
|
-
assert_equal "varGallery={};", @env["gallery.js"].to_s
|
366
|
-
assert_not_equal old_digest, @env.digest
|
367
|
-
end
|
368
|
-
|
369
354
|
test "setting js compressor to nil clears current compressor" do
|
370
355
|
@env.js_compressor = WhitespaceCompressor
|
371
356
|
assert @env.js_compressor
|
@@ -458,7 +443,6 @@ class TestEnvironment < Sprockets::TestCase
|
|
458
443
|
end
|
459
444
|
|
460
445
|
test "registering engine adds to the environments extensions" do
|
461
|
-
old_digest = @env.digest
|
462
446
|
assert !@env.engines[".foo"]
|
463
447
|
assert !@env.extensions.include?(".foo")
|
464
448
|
|
@@ -466,7 +450,6 @@ class TestEnvironment < Sprockets::TestCase
|
|
466
450
|
|
467
451
|
assert @env.engines[".foo"]
|
468
452
|
assert @env.extensions.include?(".foo")
|
469
|
-
assert_not_equal old_digest, @env.digest
|
470
453
|
end
|
471
454
|
|
472
455
|
test "seperate engines for each instance" do
|
@@ -486,12 +469,6 @@ class TestEnvironment < Sprockets::TestCase
|
|
486
469
|
@env.unregister_preprocessor('application/javascript', Sprockets::DirectiveProcessor)
|
487
470
|
assert_equal "// =require \"notfound\"\n;\n", @env["missing_require.js"].to_s
|
488
471
|
end
|
489
|
-
|
490
|
-
test "changing directive preprocessor changes digest" do
|
491
|
-
old_digest = @env.digest
|
492
|
-
@env.unregister_preprocessor('application/javascript', Sprockets::DirectiveProcessor)
|
493
|
-
assert_not_equal old_digest, @env.digest
|
494
|
-
end
|
495
472
|
end
|
496
473
|
|
497
474
|
class TestIndex < Sprockets::TestCase
|