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
data/spec/package_spec.rb
CHANGED
@@ -1,319 +1,347 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe BPM::Package do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
describe BPM::Package, "#to_spec" do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
describe BPM::Package, "validating" do
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
3
|
+
# describe BPM::Package do
|
4
|
+
# it "should have 'lib' as default lib_path'" do
|
5
|
+
# subject.send(:lib_path).should == 'lib'
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
# it "should have 'tests' as default tests_path'" do
|
9
|
+
# subject.send(:tests_path).should == 'tests'
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# describe BPM::Package, "#to_spec" do
|
14
|
+
# let(:email) { "user@example.com" }
|
15
|
+
#
|
16
|
+
# before do
|
17
|
+
# cd(home)
|
18
|
+
# FileUtils.mkdir_p(home("lib"))
|
19
|
+
# FileUtils.mkdir_p(home("resources"))
|
20
|
+
# FileUtils.mkdir_p(home("tests"))
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# subject do
|
24
|
+
# package = BPM::Package.new(nil, email)
|
25
|
+
# package.json_path = package_fixture("core-test", "package.json")
|
26
|
+
# if spec = package.to_spec
|
27
|
+
# spec
|
28
|
+
# else
|
29
|
+
# puts "Errors: #{package.errors}"
|
30
|
+
# nil
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# def expand_sort(files)
|
35
|
+
# files.map { |f| File.expand_path(f) }.sort
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# it "transforms the name" do
|
39
|
+
# subject.name.should == "core-test"
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# it "transforms the version" do
|
43
|
+
# subject.version.should == LibGems::Version.new("0.4.9")
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# it "transforms the author" do
|
47
|
+
# subject.authors.should == ["Charles Jolley"]
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# it "transforms the email" do
|
51
|
+
# subject.email.should == email
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# it "transforms the homepage" do
|
55
|
+
# subject.homepage.should == "https://github.com/strobecorp/core-test"
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# it "transforms the description" do
|
59
|
+
# subject.description.should == "Flexible testing library for JavaScript."
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# it "transforms the description" do
|
63
|
+
# subject.summary.should == "A fully featured asynchronous testing library for JavaScript, compatible with other frameworks."
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# it "transforms the dependencies" do
|
67
|
+
# subject.dependencies.map{|d| [d.name, d.requirement]}.should == [["ivory", "= 0.0.1"], ["optparse", "= 1.0.1"]]
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# it "packs metadata into requirements" do
|
71
|
+
# metadata = JSON.parse(subject.requirements.first)
|
72
|
+
# metadata["licenses"].should == [
|
73
|
+
# {"type" => "MIT",
|
74
|
+
# "url" => "https://github.com/strobecorp/core-test/raw/master/LICENSE"}
|
75
|
+
# ]
|
76
|
+
# metadata["engines"].should == ["browser", "all"]
|
77
|
+
# metadata["main"].should == "./lib/main"
|
78
|
+
# metadata["bin"].should == {"cot" => "./bin/cot"}
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# it "expands paths from the directories and bpm:build" do
|
82
|
+
# others = ["tmp/blah.js", "tmp/whee.txt"]
|
83
|
+
# files = ["bin/cot", "lib/main.js", "lib/core.js", "lib/test.js", "package.json", "resources/additions.css", "resources/runner.css", "index.html", "extras/extra_file.html"]
|
84
|
+
# test_files = ["tests/apis/core-test.js", "tests/system/test/assert-test.js"]
|
85
|
+
#
|
86
|
+
# FileUtils.mkdir_p(["bin/", "resources/", "lib/", "tests/apis", "tests/system/test", "tmp/", "extras/"])
|
87
|
+
# FileUtils.touch(files + test_files + others)
|
88
|
+
#
|
89
|
+
# expand_sort(subject.files).should == expand_sort(files + test_files)
|
90
|
+
# expand_sort(subject.test_files).should == expand_sort(test_files)
|
91
|
+
# end
|
92
|
+
#
|
93
|
+
# it "hacks the file name to return .bpkg" do
|
94
|
+
# subject.file_name.should == "core-test-0.4.9.bpkg"
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# it "sets the rubyforge_project to appease older versions of rubygems" do
|
98
|
+
# subject.rubyforge_project.should == "bpm"
|
99
|
+
# end
|
100
|
+
# end
|
101
|
+
#
|
102
|
+
# describe BPM::Package, "#to_s" do
|
103
|
+
# let(:email) { "user@example.com" }
|
104
|
+
#
|
105
|
+
# subject do
|
106
|
+
# package = BPM::Package.new
|
107
|
+
# package.json_path = package_fixture("core-test","package.json")
|
108
|
+
# package.valid?
|
109
|
+
# package
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
# it "gives the name and version" do
|
113
|
+
# subject.full_name.should == "core-test-0.4.9"
|
114
|
+
# end
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
# describe BPM::Package, "converting" do
|
118
|
+
# before do
|
119
|
+
# cd(home)
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# subject do
|
123
|
+
# package = BPM::Package.new
|
124
|
+
# package.fill_from_gemspec(fixtures('gems', "core-test-0.4.9.bpkg"))
|
125
|
+
# package.as_json
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
# it "can recreate the same package.json from the package" do
|
129
|
+
# # These don't come out in the same order
|
130
|
+
# actual = Hash[subject.sort]
|
131
|
+
# expected = Hash[JSON.parse(File.read(package_fixture("core-test", "package.json"))).sort].reject{|k,v| v.empty? }
|
132
|
+
# actual.should == expected
|
133
|
+
# end
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
# describe BPM::Package, "validating" do
|
137
|
+
# before do
|
138
|
+
# cd(home)
|
139
|
+
# end
|
140
|
+
#
|
141
|
+
# subject { BPM::Package.new }
|
142
|
+
#
|
143
|
+
# shared_examples_for "a good parser" do
|
144
|
+
# it "had a problem parsing package.json" do
|
145
|
+
# subject.should have_error("There was a problem parsing package.json")
|
146
|
+
# end
|
147
|
+
# end
|
148
|
+
#
|
149
|
+
# context "with a blank file" do
|
150
|
+
# before do
|
151
|
+
# FileUtils.touch("package.json")
|
152
|
+
# subject.json_path = "package.json"
|
153
|
+
# end
|
154
|
+
# it_should_behave_like "a good parser"
|
155
|
+
# end
|
156
|
+
#
|
157
|
+
# context "with bad json" do
|
158
|
+
# before do
|
159
|
+
# File.open("package.json", "w") do |f|
|
160
|
+
# f.write "---bad json---"
|
161
|
+
# end
|
162
|
+
# subject.json_path = "package.json"
|
163
|
+
# end
|
164
|
+
# it_should_behave_like "a good parser"
|
165
|
+
# end
|
166
|
+
#
|
167
|
+
# context "json can't be read" do
|
168
|
+
# before do
|
169
|
+
# FileUtils.cp package_fixture("core-test", "package.json"), "."
|
170
|
+
# FileUtils.chmod 0000, "package.json"
|
171
|
+
# subject.json_path = "package.json"
|
172
|
+
# end
|
173
|
+
# it_should_behave_like "a good parser"
|
174
|
+
# end
|
175
|
+
#
|
176
|
+
# context "json can't be found" do
|
177
|
+
# before do
|
178
|
+
# subject.json_path = "package.json"
|
179
|
+
# end
|
180
|
+
# it_should_behave_like "a good parser"
|
181
|
+
# end
|
182
|
+
#
|
183
|
+
# end
|
184
|
+
#
|
185
|
+
# describe BPM::Package, "validation errors" do
|
186
|
+
# let(:email) { "user@example.com" }
|
187
|
+
#
|
188
|
+
# before do
|
189
|
+
# cd(home)
|
190
|
+
# FileUtils.mkdir_p(home("lib"))
|
191
|
+
# FileUtils.mkdir_p(home("tests"))
|
192
|
+
# end
|
193
|
+
#
|
194
|
+
# subject do
|
195
|
+
# BPM::Package.new(nil, email)
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# def write_package
|
199
|
+
# path = home("package.json")
|
200
|
+
# package = JSON.parse(File.read(package_fixture("core-test","package.json")))
|
201
|
+
# yield package
|
202
|
+
# File.open(path, "w") do |file|
|
203
|
+
# file.write package.to_json
|
204
|
+
# end
|
205
|
+
# subject.json_path = path
|
206
|
+
# end
|
207
|
+
#
|
208
|
+
# %w[name description summary homepage author version directories].each do |field|
|
209
|
+
# it "is invalid without a #{field} field" do
|
210
|
+
# write_package do |package|
|
211
|
+
# package.delete(field)
|
212
|
+
# end
|
213
|
+
#
|
214
|
+
# subject.should have_error("Package requires a '#{field}' field")
|
215
|
+
# end
|
216
|
+
#
|
217
|
+
# it "is invalid with a blank #{field} field" do
|
218
|
+
# write_package do |package|
|
219
|
+
# package[field] = ""
|
220
|
+
# end
|
221
|
+
#
|
222
|
+
# subject.should have_error("Package requires a '#{field}' field")
|
223
|
+
# end
|
224
|
+
# end
|
225
|
+
#
|
226
|
+
# it "is invalid without a proper version number" do
|
227
|
+
# write_package do |package|
|
228
|
+
# package["version"] = "bad"
|
229
|
+
# end
|
230
|
+
#
|
231
|
+
# subject.should have_error("Malformed version number string bad")
|
232
|
+
# end
|
233
|
+
#
|
234
|
+
# it "is valid without specifying a test directory" do
|
235
|
+
# write_package do |package|
|
236
|
+
# package["directories"].delete("tests")
|
237
|
+
# end
|
238
|
+
#
|
239
|
+
# subject.should be_valid
|
240
|
+
# subject.to_spec.test_files.should == []
|
241
|
+
# end
|
242
|
+
#
|
243
|
+
# it "is valid and has files without specifying bin" do
|
244
|
+
# write_package do |package|
|
245
|
+
# package.delete("bin")
|
246
|
+
# end
|
247
|
+
#
|
248
|
+
# subject.should be_valid
|
249
|
+
# subject.to_spec.files.should == ["package.json"]
|
250
|
+
# end
|
251
|
+
#
|
252
|
+
# %w(lib tests).each do |dir|
|
253
|
+
# it "is invalid if #{dir} points to a file" do
|
254
|
+
# FileUtils.touch(home("somefile"))
|
255
|
+
# write_package do |package|
|
256
|
+
# package["directories"][dir] = "./somefile"
|
257
|
+
# end
|
258
|
+
#
|
259
|
+
# subject.should have_error("'./somefile', specified for #{dir} directory, is not a directory")
|
260
|
+
# end
|
261
|
+
#
|
262
|
+
# it "is invalid with a #{dir} directory that doesn't exist" do
|
263
|
+
# write_package do |package|
|
264
|
+
# package["directories"][dir] = "nope"
|
265
|
+
# end
|
266
|
+
#
|
267
|
+
# subject.should have_error("'nope', specified for #{dir} directory, is not a directory")
|
268
|
+
# end
|
269
|
+
#
|
270
|
+
# it "is valid with a #{dir} directory that exists" do
|
271
|
+
# FileUtils.mkdir_p(home("somewhere", "else"))
|
272
|
+
# write_package do |package|
|
273
|
+
# package["directories"][dir] = "./somewhere/else"
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# subject.should be_valid
|
277
|
+
# end
|
278
|
+
# end
|
279
|
+
#
|
280
|
+
# it "is valid with a lib directory array" do
|
281
|
+
# FileUtils.mkdir_p(home("vendor/lib"))
|
282
|
+
# write_package do |package|
|
283
|
+
# package["directories"]["lib"] = ["./lib", "./vendor/lib"]
|
284
|
+
# end
|
285
|
+
#
|
286
|
+
# subject.should be_valid
|
287
|
+
# end
|
288
|
+
#
|
289
|
+
# it "is invalid if any lib directories don't exist" do
|
290
|
+
# write_package do |package|
|
291
|
+
# package["directories"]["lib"] = ["./lib", "./fake"]
|
292
|
+
# end
|
293
|
+
#
|
294
|
+
# subject.should have_error "'./fake', specified for lib directory, is not a directory"
|
295
|
+
# end
|
296
|
+
#
|
297
|
+
# it "is invalid if the lib directory array is empty" do
|
298
|
+
# write_package do |package|
|
299
|
+
# package["directories"]["lib"] = []
|
300
|
+
# end
|
301
|
+
#
|
302
|
+
# subject.should have_error("A lib directory is required")
|
303
|
+
# end
|
304
|
+
#
|
305
|
+
# end
|
306
|
+
|
307
|
+
describe BPM::Package, 'InvalidPackageError' do
|
308
|
+
|
309
|
+
it "should raise exception when loading invalid JSON" do
|
310
|
+
package = BPM::Package.new(package_fixture('invalid_json'))
|
311
|
+
lambda {
|
312
|
+
package.load_json
|
313
|
+
}.should raise_error(BPM::InvalidPackageError)
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should raise exception when loading a package with no package.json" do
|
317
|
+
FileUtils.mkdir_p home('empty_package')
|
318
|
+
package = BPM::Package.new home('empty_package')
|
319
|
+
lambda {
|
320
|
+
package.load_json
|
321
|
+
}.should raise_error(BPM::InvalidPackageError)
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should raise exception when loading a package whose name does not package the one in the package.json" do
|
325
|
+
goto_home
|
326
|
+
FileUtils.cp_r package_fixture('jquery'), 'jquery2'
|
327
|
+
package = BPM::Package.new home('jquery2')
|
328
|
+
lambda {
|
329
|
+
package.load_json
|
330
|
+
}.should raise_error(BPM::InvalidPackageNameError)
|
331
|
+
end
|
332
|
+
|
183
333
|
end
|
184
334
|
|
185
|
-
describe BPM::Package, "
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
def write_package
|
199
|
-
path = home("package.json")
|
200
|
-
package = JSON.parse(File.read(fixtures("core-test","package.json")))
|
201
|
-
yield package
|
202
|
-
File.open(path, "w") do |file|
|
203
|
-
file.write package.to_json
|
204
|
-
end
|
205
|
-
subject.json_path = path
|
206
|
-
end
|
207
|
-
|
208
|
-
%w[name description summary homepage author version directories].each do |field|
|
209
|
-
it "is invalid without a #{field} field" do
|
210
|
-
write_package do |package|
|
211
|
-
package.delete(field)
|
212
|
-
end
|
213
|
-
|
214
|
-
subject.should have_error("Package requires a '#{field}' field")
|
215
|
-
end
|
216
|
-
|
217
|
-
it "is invalid with a blank #{field} field" do
|
218
|
-
write_package do |package|
|
219
|
-
package[field] = ""
|
220
|
-
end
|
221
|
-
|
222
|
-
subject.should have_error("Package requires a '#{field}' field")
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
it "is invalid without a proper version number" do
|
227
|
-
write_package do |package|
|
228
|
-
package["version"] = "bad"
|
229
|
-
end
|
230
|
-
|
231
|
-
subject.should have_error("Malformed version number string bad")
|
232
|
-
end
|
233
|
-
|
234
|
-
it "is valid without specifying a test directory" do
|
235
|
-
write_package do |package|
|
236
|
-
package["directories"].delete("tests")
|
237
|
-
end
|
238
|
-
|
239
|
-
subject.should be_valid
|
240
|
-
subject.to_spec.test_files.should == []
|
241
|
-
end
|
242
|
-
|
243
|
-
it "is valid and has files without specifying bin" do
|
244
|
-
write_package do |package|
|
245
|
-
package.delete("bin")
|
246
|
-
end
|
247
|
-
|
248
|
-
subject.should be_valid
|
249
|
-
subject.to_spec.files.should == ["package.json"]
|
250
|
-
end
|
251
|
-
|
252
|
-
%w(lib tests).each do |dir|
|
253
|
-
it "is invalid if #{dir} points to a file" do
|
254
|
-
FileUtils.touch(home("somefile"))
|
255
|
-
write_package do |package|
|
256
|
-
package["directories"][dir] = "./somefile"
|
257
|
-
end
|
258
|
-
|
259
|
-
subject.should have_error("'./somefile', specified for #{dir} directory, is not a directory")
|
260
|
-
end
|
261
|
-
|
262
|
-
it "is invalid with a #{dir} directory that doesn't exist" do
|
263
|
-
write_package do |package|
|
264
|
-
package["directories"][dir] = "nope"
|
265
|
-
end
|
266
|
-
|
267
|
-
subject.should have_error("'nope', specified for #{dir} directory, is not a directory")
|
268
|
-
end
|
269
|
-
|
270
|
-
it "is valid with a #{dir} directory that exists" do
|
271
|
-
FileUtils.mkdir_p(home("somewhere", "else"))
|
272
|
-
write_package do |package|
|
273
|
-
package["directories"][dir] = "./somewhere/else"
|
274
|
-
end
|
275
|
-
|
276
|
-
subject.should be_valid
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
it "is valid with a lib directory array" do
|
281
|
-
FileUtils.mkdir_p(home("vendor/lib"))
|
282
|
-
write_package do |package|
|
283
|
-
package["directories"]["lib"] = ["./lib", "./vendor/lib"]
|
284
|
-
end
|
285
|
-
|
286
|
-
subject.should be_valid
|
287
|
-
end
|
288
|
-
|
289
|
-
it "is invalid if any lib directories don't exist" do
|
290
|
-
write_package do |package|
|
291
|
-
package["directories"]["lib"] = ["./lib", "./fake"]
|
292
|
-
end
|
293
|
-
|
294
|
-
subject.should have_error "'./fake', specified for lib directory, is not a directory"
|
295
|
-
end
|
296
|
-
|
297
|
-
it "is invalid if the lib directory array is empty" do
|
298
|
-
write_package do |package|
|
299
|
-
package["directories"]["lib"] = []
|
300
|
-
end
|
301
|
-
|
302
|
-
subject.should have_error("A lib directory is required")
|
303
|
-
end
|
304
|
-
|
305
|
-
end
|
306
|
-
|
307
|
-
describe BPM::Package, "templates" do
|
308
|
-
|
309
|
-
subject do
|
310
|
-
package = BPM::Package.new(fixtures("custom_generator"))
|
311
|
-
package.load_json
|
312
|
-
package
|
313
|
-
end
|
314
|
-
|
315
|
-
it "should have project template" do
|
316
|
-
subject.template_path('project').should == fixtures("custom_generator", "templates", "project").to_s
|
317
|
-
end
|
318
|
-
|
319
|
-
end
|
335
|
+
# describe BPM::Package, "templates" do
|
336
|
+
#
|
337
|
+
# subject do
|
338
|
+
# package = BPM::Package.new(package_fixture("custom_generator"))
|
339
|
+
# package.load_json
|
340
|
+
# package
|
341
|
+
# end
|
342
|
+
#
|
343
|
+
# it "should have project template" do
|
344
|
+
# subject.template_path('project').should == package_fixture("custom_generator", "templates", "project").to_s
|
345
|
+
# end
|
346
|
+
#
|
347
|
+
# end
|