bpm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.gitmodules +0 -0
- data/Gemfile +16 -0
- data/README.md +55 -0
- data/TODO.md +3 -0
- data/bin/bpm +8 -0
- data/bpm.gemspec +41 -0
- data/lib/bpm.rb +18 -0
- data/lib/bpm/cli.rb +6 -0
- data/lib/bpm/cli/base.rb +358 -0
- data/lib/bpm/cli/owner.rb +46 -0
- data/lib/bpm/credentials.rb +36 -0
- data/lib/bpm/default.json +9 -0
- data/lib/bpm/generator.rb +69 -0
- data/lib/bpm/init_generator.rb +43 -0
- data/lib/bpm/libgems_ext.rb +11 -0
- data/lib/bpm/libgems_ext/config_file.rb +33 -0
- data/lib/bpm/libgems_ext/dependency_installer.rb +150 -0
- data/lib/bpm/libgems_ext/installer.rb +39 -0
- data/lib/bpm/libgems_ext/libgems.rb +39 -0
- data/lib/bpm/libgems_ext/spec_fetcher.rb +11 -0
- data/lib/bpm/local.rb +76 -0
- data/lib/bpm/package.rb +277 -0
- data/lib/bpm/pipeline.rb +100 -0
- data/lib/bpm/pipeline/directive_processor.rb +47 -0
- data/lib/bpm/pipeline/generated_asset.rb +68 -0
- data/lib/bpm/pipeline/transport_processor.rb +32 -0
- data/lib/bpm/project.rb +427 -0
- data/lib/bpm/project_generator.rb +34 -0
- data/lib/bpm/remote.rb +104 -0
- data/lib/bpm/repository.rb +18 -0
- data/lib/bpm/server.rb +44 -0
- data/lib/bpm/version.rb +3 -0
- data/spec/cli/add_spec.rb +159 -0
- data/spec/cli/build_spec.rb +87 -0
- data/spec/cli/fetch_spec.rb +135 -0
- data/spec/cli/fetched_spec.rb +52 -0
- data/spec/cli/init_spec.rb +50 -0
- data/spec/cli/list_spec.rb +74 -0
- data/spec/cli/login_spec.rb +110 -0
- data/spec/cli/new_spec.rb +92 -0
- data/spec/cli/owner_spec.rb +114 -0
- data/spec/cli/push_spec.rb +73 -0
- data/spec/cli/remove_spec.rb +84 -0
- data/spec/cli/unpack_spec.rb +72 -0
- data/spec/cli/unyank_spec.rb +73 -0
- data/spec/cli/yank_spec.rb +73 -0
- data/spec/credentials_spec.rb +23 -0
- data/spec/fixtures/badrake-0.8.7.spd +0 -0
- data/spec/fixtures/builder-3.0.0.spd +0 -0
- data/spec/fixtures/bundler-1.1.pre.spd +0 -0
- data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
- data/spec/fixtures/core-test-0.4.9.spd +0 -0
- data/spec/fixtures/core-test/bin/cot +3 -0
- data/spec/fixtures/core-test/lib/main.js +1 -0
- data/spec/fixtures/core-test/package.json +46 -0
- data/spec/fixtures/core-test/resources/runner.css +1 -0
- data/spec/fixtures/core-test/tests/test.js +1 -0
- data/spec/fixtures/custom_generator-1.0.spd +0 -0
- data/spec/fixtures/custom_generator/lib/main.js +1 -0
- data/spec/fixtures/custom_generator/package.json +12 -0
- data/spec/fixtures/custom_generator/templates/init/project.json +19 -0
- data/spec/fixtures/custom_generator/templates/project/app.js +1 -0
- data/spec/fixtures/custom_generator/templates/project/lib/main.js +0 -0
- data/spec/fixtures/custom_generator/templates/project_generator.rb +20 -0
- data/spec/fixtures/hello_world/LICENSE +19 -0
- data/spec/fixtures/hello_world/README.md +21 -0
- data/spec/fixtures/hello_world/assets/bpm_packages.js +13 -0
- data/spec/fixtures/hello_world/assets/bpm_styles.css +14 -0
- data/spec/fixtures/hello_world/assets/papa-smurf.jpg +0 -0
- data/spec/fixtures/hello_world/hello_world.json +20 -0
- data/spec/fixtures/hello_world/lib/main.js +9 -0
- data/spec/fixtures/hello_world/packages/custom_package/assets/dummy.txt +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/css/sample_styles.css +3 -0
- data/spec/fixtures/hello_world/packages/custom_package/custom_dir/basic-module.js +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/lib/main.js +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/package.json +22 -0
- data/spec/fixtures/hello_world/tests/main-test.js +8 -0
- data/spec/fixtures/highline-1.6.1.spd +0 -0
- data/spec/fixtures/ivory-0.0.1.spd +0 -0
- data/spec/fixtures/jquery-1.4.3.spd +0 -0
- data/spec/fixtures/optparse-1.0.1.spd +0 -0
- data/spec/fixtures/rake-0.8.6.spd +0 -0
- data/spec/fixtures/rake-0.8.7.spd +0 -0
- data/spec/fixtures/simple_hello/assets/bpm_packages.js +1 -0
- data/spec/fixtures/simple_hello/lib/main.js +1 -0
- data/spec/fixtures/spade-0.5.0.spd +0 -0
- data/spec/fixtures/src/README.txt +1 -0
- data/spec/fixtures/src/bundler-1.1.pre/.gitignore +22 -0
- data/spec/fixtures/src/bundler-1.1.pre/CHANGELOG.md +646 -0
- data/spec/fixtures/src/bundler-1.1.pre/ISSUES.md +47 -0
- data/spec/fixtures/src/bundler-1.1.pre/LICENSE +21 -0
- data/spec/fixtures/src/bundler-1.1.pre/README.md +29 -0
- data/spec/fixtures/src/bundler-1.1.pre/UPGRADING.md +103 -0
- data/spec/fixtures/src/bundler-1.1.pre/bin/bundle +20 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler.js +23 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/definition.js +14 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dependency.js +15 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dsl.js +9 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/ui.js +6 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-config.ronn +90 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-exec.ronn +111 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-install.ronn +314 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-package.ronn +59 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-update.ronn +176 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle.ronn +80 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/gemfile.5.ronn +279 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/index.txt +6 -0
- data/spec/fixtures/src/bundler-1.1.pre/package.json +19 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/bin/cake +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/bin/coffee +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/base.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/mocha/chai.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/package.json +19 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/qunit/coffee/test.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/qunit/test.js +0 -0
- data/spec/fixtures/src/jquery/lib/main.js +7179 -0
- data/spec/fixtures/src/jquery/package.json +15 -0
- data/spec/fixtures/src/rake-0.8.6/CHANGES +436 -0
- data/spec/fixtures/src/rake-0.8.6/MIT-LICENSE +21 -0
- data/spec/fixtures/src/rake-0.8.6/README +196 -0
- data/spec/fixtures/src/rake-0.8.6/Rakefile +430 -0
- data/spec/fixtures/src/rake-0.8.6/TODO +20 -0
- data/spec/fixtures/src/rake-0.8.6/bin/rake +31 -0
- data/spec/fixtures/src/rake-0.8.6/doc/command_line_usage.rdoc +102 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile1 +38 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile2 +35 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/a.c +6 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/b.c +6 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/main.c +11 -0
- data/spec/fixtures/src/rake-0.8.6/doc/glossary.rdoc +51 -0
- data/spec/fixtures/src/rake-0.8.6/doc/jamis.rb +591 -0
- data/spec/fixtures/src/rake-0.8.6/doc/proto_rake.rdoc +127 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rake.1.gz +0 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rakefile.rdoc +534 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rational.rdoc +151 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.6/install.rb +88 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake.rb +2502 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/alt_system.rb +108 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/classic_namespace.rb +8 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/clean.rb +33 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/compositepublisher.rb +24 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/ftptools.rb +153 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/publisher.rb +75 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sshpublisher.rb +47 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sys.rb +209 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/gempackagetask.rb +97 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/loaders/makefile.rb +42 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/packagetask.rb +184 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/rake_test_loader.rb +5 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/rdoctask.rb +209 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/runtest.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/tasklib.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/testtask.rb +161 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/win32.rb +55 -0
- data/spec/fixtures/src/rake-0.8.6/package.json +18 -0
- data/spec/fixtures/src/rake-0.8.6/test/capture_stdout.rb +26 -0
- data/spec/fixtures/src/rake-0.8.7/CHANGES +440 -0
- data/spec/fixtures/src/rake-0.8.7/MIT-LICENSE +21 -0
- data/spec/fixtures/src/rake-0.8.7/README +196 -0
- data/spec/fixtures/src/rake-0.8.7/Rakefile +430 -0
- data/spec/fixtures/src/rake-0.8.7/TODO +20 -0
- data/spec/fixtures/src/rake-0.8.7/bin/rake +31 -0
- data/spec/fixtures/src/rake-0.8.7/doc/command_line_usage.rdoc +102 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile1 +38 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile2 +35 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/a.c +6 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/b.c +6 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/main.c +11 -0
- data/spec/fixtures/src/rake-0.8.7/doc/glossary.rdoc +51 -0
- data/spec/fixtures/src/rake-0.8.7/doc/jamis.rb +591 -0
- data/spec/fixtures/src/rake-0.8.7/doc/proto_rake.rdoc +127 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rake.1.gz +0 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rakefile.rdoc +534 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rational.rdoc +151 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.7/install.rb +88 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake.rb +2506 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/alt_system.rb +108 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/classic_namespace.rb +8 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/clean.rb +33 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +24 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/ftptools.rb +153 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/publisher.rb +75 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +47 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sys.rb +209 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/gempackagetask.rb +97 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/loaders/makefile.rb +42 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/packagetask.rb +184 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/rake_test_loader.rb +5 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/rdoctask.rb +209 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/runtest.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/tasklib.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/testtask.rb +161 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/win32.rb +55 -0
- data/spec/fixtures/src/rake-0.8.7/package.json +18 -0
- data/spec/fixtures/src/rake-0.8.7/test/capture_stdout.rb +26 -0
- data/spec/fixtures/src/spade/lib/main.js +1 -0
- data/spec/fixtures/src/spade/package.json +15 -0
- data/spec/fixtures/transporter/lib/main.js +3 -0
- data/spec/fixtures/transporter/packages/transport/lib/wrapper.js +5 -0
- data/spec/fixtures/transporter/packages/transport/package.json +21 -0
- data/spec/fixtures/transporter/transporter.json +18 -0
- data/spec/gauntlet_spec.rb +33 -0
- data/spec/package_spec.rb +319 -0
- data/spec/pipeline_spec.rb +213 -0
- data/spec/project_spec.rb +130 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/cli.rb +93 -0
- data/spec/support/env.rb +18 -0
- data/spec/support/fake.rb +53 -0
- data/spec/support/fake_gem_server.rb +72 -0
- data/spec/support/fake_gemcutter.rb +50 -0
- data/spec/support/matchers.rb +32 -0
- data/spec/support/path.rb +63 -0
- data/spec/support/project.rb +43 -0
- data/templates/init/assets/bpm_packages.js +7 -0
- data/templates/init/assets/bpm_styles.css +7 -0
- data/templates/init/project.json +16 -0
- data/templates/project/LICENSE +19 -0
- data/templates/project/README.md +21 -0
- data/templates/project/app.js +1 -0
- data/templates/project/index.html +13 -0
- metadata +627 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BPM::Pipeline, "asset_path" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
goto_home
|
7
|
+
FileUtils.cp_r(fixtures('hello_world'), '.')
|
8
|
+
end
|
9
|
+
|
10
|
+
subject do
|
11
|
+
project = BPM::Project.new home('hello_world')
|
12
|
+
BPM::Pipeline.new project
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should find any asset in the assets directory" do
|
16
|
+
asset = subject.find_asset 'papa-smurf.jpg'
|
17
|
+
asset.pathname.should == home('hello_world', 'assets', 'papa-smurf.jpg')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should find any asset in packages" do
|
21
|
+
goto_home
|
22
|
+
set_host
|
23
|
+
start_fake(FakeGemServer.new)
|
24
|
+
cd home('hello_world')
|
25
|
+
|
26
|
+
bpm 'add', 'custom_package'
|
27
|
+
wait
|
28
|
+
|
29
|
+
asset = subject.find_asset 'custom_package/assets/dummy.txt'
|
30
|
+
asset.pathname.should == home('hello_world', '.bpm', 'packages', 'custom_package', 'assets', 'dummy.txt')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should find any asset in installed packages" do
|
34
|
+
goto_home
|
35
|
+
set_host
|
36
|
+
start_fake(FakeGemServer.new)
|
37
|
+
cd home('hello_world')
|
38
|
+
|
39
|
+
bpm 'compile'
|
40
|
+
wait
|
41
|
+
|
42
|
+
asset = subject.find_asset 'core-test/resources/runner.css'
|
43
|
+
asset.pathname.should == home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "bpm_packages.js" do
|
47
|
+
|
48
|
+
before do
|
49
|
+
goto_home
|
50
|
+
set_host
|
51
|
+
start_fake(FakeGemServer.new)
|
52
|
+
cd home('hello_world')
|
53
|
+
|
54
|
+
bpm 'add', 'custom_package'
|
55
|
+
wait
|
56
|
+
|
57
|
+
@project = BPM::Project.new home('hello_world')
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
subject do
|
62
|
+
BPM::Pipeline.new(@project).find_asset 'bpm_packages.js'
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return an asset of type BPM::GeneratedAsset" do
|
66
|
+
subject.class.should == BPM::GeneratedAsset
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should find the bpm_packages.js" do
|
70
|
+
subject.pathname.should == home('hello_world', 'assets', 'bpm_packages.js')
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should find bpm_packages as well" do
|
74
|
+
BPM::Pipeline.new(@project).find_asset('bpm_packages').should == subject
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should have a manifest line" do
|
78
|
+
subject.to_s.should include('MANIFEST: core-test (0.4.9) custom_package (2.0.0) ivory (0.0.1) optparse (1.0.1) rake (0.8.6) spade (0.5.0)')
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should include any required modules in the bpm_package.js" do
|
82
|
+
subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'lib', 'main.js')))
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should reference package.json directories when resolving modules" do
|
86
|
+
subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'custom_dir', 'basic-module.js')))
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "bpm_styles.css" do
|
92
|
+
|
93
|
+
before do
|
94
|
+
goto_home
|
95
|
+
set_host
|
96
|
+
start_fake(FakeGemServer.new)
|
97
|
+
cd home('hello_world')
|
98
|
+
|
99
|
+
bpm 'add', 'custom_package'
|
100
|
+
wait
|
101
|
+
end
|
102
|
+
|
103
|
+
subject do
|
104
|
+
project = BPM::Project.new home('hello_world')
|
105
|
+
BPM::Pipeline.new(project).find_asset 'bpm_styles.css'
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should find bpm_styles.css" do
|
109
|
+
subject.pathname.should == home('hello_world', 'assets', 'bpm_styles.css')
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should include any required modules in the bpm_styles.css" do
|
113
|
+
subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'css', 'sample_styles.css')))
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should reference installed package styles as well" do
|
117
|
+
subject.to_s.should include(File.read(home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')))
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
describe BPM::Pipeline, "buildable_assets" do
|
125
|
+
|
126
|
+
before do
|
127
|
+
set_host
|
128
|
+
goto_home
|
129
|
+
FileUtils.cp_r(fixtures('hello_world'), '.')
|
130
|
+
reset_libgems bpm_dir.to_s
|
131
|
+
|
132
|
+
start_fake(FakeGemServer.new)
|
133
|
+
cd home('hello_world')
|
134
|
+
|
135
|
+
bpm 'add', 'custom_package', '--verbose'
|
136
|
+
wait
|
137
|
+
|
138
|
+
@project = BPM::Project.new home('hello_world')
|
139
|
+
end
|
140
|
+
|
141
|
+
subject do
|
142
|
+
BPM::Pipeline.new(@project).buildable_assets
|
143
|
+
end
|
144
|
+
|
145
|
+
def project(*asset_names)
|
146
|
+
Pathname.new File.join @project.root_path, *asset_names
|
147
|
+
end
|
148
|
+
|
149
|
+
def find_asset(logical_path)
|
150
|
+
subject.find { |x| x.logical_path == logical_path }
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should include bpm_packages.js" do
|
154
|
+
asset = find_asset 'bpm_packages.js'
|
155
|
+
asset.should_not be_nil
|
156
|
+
asset.pathname.should == project('assets', 'bpm_packages.js')
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should include bpm_styles.css" do
|
160
|
+
asset = find_asset 'bpm_styles.css'
|
161
|
+
asset.should_not be_nil
|
162
|
+
asset.pathname.should == project('assets', 'bpm_styles.css')
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should include custom_package assets" do
|
166
|
+
asset = find_asset 'custom_package/assets/dummy.txt'
|
167
|
+
asset.should_not be_nil
|
168
|
+
asset.pathname.should == project('.bpm', 'packages', 'custom_package', 'assets', 'dummy.txt')
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should include installed package assets" do
|
172
|
+
asset = find_asset 'core-test/resources/runner.css'
|
173
|
+
asset.should_not be_nil
|
174
|
+
asset.pathname.should == project('.bpm', 'packages', 'core-test', 'resources', 'runner.css')
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should exclude libs" do
|
178
|
+
asset = find_asset 'custom_package/assets/lib/main.js'
|
179
|
+
asset.should be_nil
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
describe BPM::Pipeline, 'transport processor' do
|
185
|
+
|
186
|
+
before do
|
187
|
+
goto_home
|
188
|
+
set_host
|
189
|
+
reset_libgems bpm_dir.to_s
|
190
|
+
start_fake(FakeGemServer.new)
|
191
|
+
|
192
|
+
FileUtils.cp_r fixtures('transporter'), '.'
|
193
|
+
cd home('transporter')
|
194
|
+
|
195
|
+
# bpm 'compile'
|
196
|
+
# wait
|
197
|
+
end
|
198
|
+
|
199
|
+
subject do
|
200
|
+
project = BPM::Project.new home('transporter')
|
201
|
+
BPM::Pipeline.new project
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should wrap main.js" do
|
205
|
+
asset = subject.find_asset 'transporter/lib/main.js'
|
206
|
+
asset.to_s.should include('define_transport(function() {');
|
207
|
+
asset.pathname.to_s.should == File.join(Dir.pwd, 'lib', 'main.js')
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BPM::Project, "project_file_path" do
|
4
|
+
|
5
|
+
it "should return both project file paths" do
|
6
|
+
path = fixtures('hello_world')
|
7
|
+
expected = File.join(path, 'hello_world.json')
|
8
|
+
BPM::Project.project_file_path(path).should == expected
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return [] on a package" do
|
12
|
+
path = fixtures('core-test')
|
13
|
+
BPM::Project.project_file_path(path).should == nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return [] on a project with no file" do
|
17
|
+
path = fixtures('simple_hello')
|
18
|
+
BPM::Project.project_file_path(path).should == nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe BPM::Project, "is_project_root?" do
|
24
|
+
|
25
|
+
it "should return true for a project path" do
|
26
|
+
BPM::Project.is_project_root?(fixtures('hello_world')).should == true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return false for a package" do
|
30
|
+
BPM::Project.is_project_root?(fixtures('core-test')).should == false
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should return true for a project with no project file" do
|
34
|
+
BPM::Project.is_project_root?(fixtures('simple_hello')).should == true
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe BPM::Project, "nearest_project" do
|
40
|
+
|
41
|
+
describe "standard project" do
|
42
|
+
subject do
|
43
|
+
fixtures('hello_world').to_s # string not Pathname
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return project instance for project path" do
|
47
|
+
BPM::Project.nearest_project(subject).root_path.should == subject
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return project instance for path inside of project" do
|
51
|
+
path = File.join subject, 'lib'
|
52
|
+
BPM::Project.nearest_project(path).root_path.should == subject
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "simple project" do
|
57
|
+
subject do
|
58
|
+
fixtures('simple_hello').to_s # string not Pathname
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return project instance for project path" do
|
62
|
+
BPM::Project.nearest_project(subject).root_path.should == subject
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return project instance for path inside of project" do
|
66
|
+
path = File.join subject, 'lib'
|
67
|
+
BPM::Project.nearest_project(path).root_path.should == subject
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should return nil for a package" do
|
72
|
+
BPM::Project.nearest_project(fixtures('core-test')).should == nil
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
describe BPM::Project, "project metadata" do
|
78
|
+
|
79
|
+
describe "standard project" do
|
80
|
+
subject do
|
81
|
+
BPM::Project.new fixtures('hello_world')
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should be valid" do
|
85
|
+
subject.valid?.should == true
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should get project name" do
|
89
|
+
subject.name.should == "hello_world"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should get a project version" do
|
93
|
+
subject.version.should == "2.0.0"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should get dependencies" do
|
97
|
+
subject.dependencies.should == {
|
98
|
+
"spade" => "0.5.0",
|
99
|
+
"core-test" => "0.4.9"
|
100
|
+
}
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "simple project" do
|
106
|
+
subject do
|
107
|
+
BPM::Project.new fixtures('simple_hello')
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should be valid" do
|
111
|
+
subject.valid?.should == true
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should get project name" do
|
115
|
+
subject.name.should == "simple_hello"
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
it "should get a default version" do
|
120
|
+
subject.version.should == "0.0.1"
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should get dependencies read from bpm_packages.js file" do
|
124
|
+
subject.dependencies.should == {
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
Bundler.require :default, :development
|
2
|
+
|
3
|
+
require 'support/env'
|
4
|
+
require 'support/cli'
|
5
|
+
require 'support/fake'
|
6
|
+
require 'support/fake_gem_server'
|
7
|
+
require 'support/fake_gemcutter'
|
8
|
+
require 'support/matchers'
|
9
|
+
require 'support/path'
|
10
|
+
require 'support/project'
|
11
|
+
|
12
|
+
module SpecHelpers
|
13
|
+
def set_host(host='http://localhost:9292')
|
14
|
+
@original_host ||= LibGems.host
|
15
|
+
@original_sources ||= LibGems.sources
|
16
|
+
LibGems.host = host
|
17
|
+
LibGems.sources = [LibGems.host]
|
18
|
+
end
|
19
|
+
|
20
|
+
def reset_host
|
21
|
+
LibGems.host = @original_host if @original_host
|
22
|
+
LibGems.sources = @original_sources if @original_sources
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
RSpec.configure do |config|
|
27
|
+
working_dir = Dir.pwd
|
28
|
+
|
29
|
+
config.include SpecHelpers
|
30
|
+
|
31
|
+
config.around do |blk|
|
32
|
+
reset!
|
33
|
+
|
34
|
+
blk.call
|
35
|
+
|
36
|
+
kill!
|
37
|
+
stop_fake
|
38
|
+
reset_host
|
39
|
+
Dir.chdir working_dir if Dir.pwd != working_dir
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
data/spec/support/cli.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'bpm/cli/base'
|
2
|
+
|
3
|
+
module SpecHelpers
|
4
|
+
attr_reader :stdin, :stdout, :stderr
|
5
|
+
|
6
|
+
def bpm(*argv)
|
7
|
+
opts = Hash === argv.last ? argv.pop : {}
|
8
|
+
|
9
|
+
kill!
|
10
|
+
create_pipes
|
11
|
+
|
12
|
+
@pid = Process.fork do
|
13
|
+
Dir.chdir opts[:chdir] if opts[:chdir]
|
14
|
+
|
15
|
+
@stdout.close
|
16
|
+
STDOUT.reopen @stdout_child
|
17
|
+
|
18
|
+
@stdin.close
|
19
|
+
STDIN.reopen @stdin_child
|
20
|
+
|
21
|
+
if opts[:track_stderr]
|
22
|
+
@stderr.close
|
23
|
+
STDERR.reopen @stderr_child
|
24
|
+
end
|
25
|
+
|
26
|
+
env.each do |key, val|
|
27
|
+
ENV[key] = val
|
28
|
+
end
|
29
|
+
|
30
|
+
BPM::CLI::Base.start(argv)
|
31
|
+
end
|
32
|
+
|
33
|
+
@stdout_child.close
|
34
|
+
@stdin_child.close
|
35
|
+
@stderr_child.close
|
36
|
+
@pid
|
37
|
+
end
|
38
|
+
|
39
|
+
def out_until_block(io = stdout)
|
40
|
+
# read 1 first so we wait until the process is done processing the last write
|
41
|
+
chars = io.read(1)
|
42
|
+
|
43
|
+
loop do
|
44
|
+
chars << io.read_nonblock(1000)
|
45
|
+
sleep 0.05
|
46
|
+
end
|
47
|
+
rescue Errno::EAGAIN, EOFError
|
48
|
+
chars
|
49
|
+
end
|
50
|
+
|
51
|
+
def input(line, opts = {})
|
52
|
+
if on = opts[:on]
|
53
|
+
should_block_on on
|
54
|
+
end
|
55
|
+
stdin << "#{line}\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
def wait
|
59
|
+
return unless @pid
|
60
|
+
|
61
|
+
pid, status = Process.wait2(@pid, 0)
|
62
|
+
|
63
|
+
@exit_status = status
|
64
|
+
@pid = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
def exit_status
|
68
|
+
wait
|
69
|
+
@exit_status
|
70
|
+
end
|
71
|
+
|
72
|
+
def kill!
|
73
|
+
Process.kill(9, @pid) if @pid
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_pipes
|
77
|
+
@stdout, @stdout_child = IO.pipe
|
78
|
+
@stdin_child, @stdin = IO.pipe
|
79
|
+
@stderr, @stderr_child = IO.pipe
|
80
|
+
end
|
81
|
+
|
82
|
+
def write_api_key(api_key)
|
83
|
+
write_creds("user@example.com", api_key)
|
84
|
+
end
|
85
|
+
|
86
|
+
def write_creds(email, api_key)
|
87
|
+
FileUtils.mkdir_p(bpm_dir)
|
88
|
+
File.open(bpm_dir("credentials"), "w") do |file|
|
89
|
+
file.write YAML.dump(:bpm_api_key => api_key, :bpm_email => email)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|