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,135 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe 'bpm fetch' do
|
4
|
+
|
5
|
+
before do
|
6
|
+
goto_home
|
7
|
+
FileUtils.cp_r(fixtures('hello_world'), '.')
|
8
|
+
set_host
|
9
|
+
start_fake(FakeGemServer.new)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "fetches all dependencies in a project when called without command" do
|
13
|
+
cd home('hello_world')
|
14
|
+
bpm "fetch"
|
15
|
+
|
16
|
+
stdout.read.should include("Fetched dependent packages for hello_world")
|
17
|
+
|
18
|
+
# note: ivory is a soft dependency from core-test
|
19
|
+
%w(spade-0.5.0 core-test-0.4.9 ivory-0.0.1 optparse-1.0.1).each do |package_name|
|
20
|
+
package_name.should be_fetched
|
21
|
+
package_name.should be_unpacked
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
it "fetches a valid package" do
|
27
|
+
bpm "fetch", "rake"
|
28
|
+
|
29
|
+
stdout.read.should include("Successfully fetched rake (0.8.7)")
|
30
|
+
|
31
|
+
"rake-0.8.7".should be_fetched
|
32
|
+
"rake-0.8.7".should be_unpacked
|
33
|
+
end
|
34
|
+
|
35
|
+
it "fetches a multiple gems" do
|
36
|
+
bpm "fetch", "rake", "builder"
|
37
|
+
|
38
|
+
output = stdout.read
|
39
|
+
|
40
|
+
%w(builder-3.0.0 rake-0.8.7).each do |pkg|
|
41
|
+
output.should include("Successfully fetched #{pkg.sub(/-[^-]*$/,'')} (#{pkg.sub(/^.*-/, '')})")
|
42
|
+
pkg.should be_fetched
|
43
|
+
pkg.should be_unpacked
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "fetches valid gems while ignoring invalid ones" do
|
48
|
+
bpm "fetch", "rake", "fake", :track_stderr => true
|
49
|
+
|
50
|
+
stdout.read.should include("Successfully fetched rake (0.8.7)")
|
51
|
+
stderr.read.should include("Can't find package fake")
|
52
|
+
|
53
|
+
"rake-0.8.7".should be_fetched
|
54
|
+
"rake-0.8.7".should be_unpacked
|
55
|
+
"fake-0".should_not be_fetched
|
56
|
+
"fake-0".should_not be_unpacked
|
57
|
+
end
|
58
|
+
|
59
|
+
it "fails when fetching an invalid gem" do
|
60
|
+
bpm "fetch", "fake", :track_stderr => true
|
61
|
+
|
62
|
+
stderr.read.should include("Can't find package fake")
|
63
|
+
"rake-0.8.7".should_not be_fetched
|
64
|
+
"rake-0.8.7".should_not be_unpacked
|
65
|
+
"fake-0".should_not be_fetched
|
66
|
+
"fake-0".should_not be_unpacked
|
67
|
+
end
|
68
|
+
|
69
|
+
it "fails if bpm can't write to the bpm directory" do
|
70
|
+
FileUtils.mkdir_p bpm_dir
|
71
|
+
FileUtils.chmod 0555, bpm_dir
|
72
|
+
|
73
|
+
bpm "fetch", "rake", :track_stderr => true
|
74
|
+
exit_status.should_not be_success
|
75
|
+
|
76
|
+
"rake-0.8.7".should_not be_fetched
|
77
|
+
"rake-0.8.7".should_not be_unpacked
|
78
|
+
end
|
79
|
+
|
80
|
+
it "fetches gems with a different version" do
|
81
|
+
bpm "fetch", "rake", "-v", "0.8.6"
|
82
|
+
|
83
|
+
stdout.read.should include("Successfully fetched rake (0.8.6)")
|
84
|
+
|
85
|
+
"rake-0.8.7".should_not be_fetched
|
86
|
+
"rake-0.8.7".should_not be_unpacked
|
87
|
+
"rake-0.8.6".should be_fetched
|
88
|
+
"rake-0.8.6".should be_unpacked
|
89
|
+
end
|
90
|
+
|
91
|
+
it "fetches a valid prerelease package" do
|
92
|
+
bpm "fetch", "bundler", "--pre"
|
93
|
+
|
94
|
+
stdout.read.should include("Successfully fetched bundler (1.1.pre)")
|
95
|
+
|
96
|
+
"bundler-1.1.pre".should be_fetched
|
97
|
+
"bundler-1.1.pre".should be_unpacked
|
98
|
+
end
|
99
|
+
|
100
|
+
it "does not fetch the normal package when asking for a prerelease" do
|
101
|
+
bpm "fetch", "rake", "--pre", :track_stderr => true
|
102
|
+
|
103
|
+
stderr.read.should include("Can't find package rake")
|
104
|
+
|
105
|
+
"rake-0.8.7".should_not be_fetched
|
106
|
+
"rake-0.8.7".should_not be_unpacked
|
107
|
+
"rake-0.8.6".should_not be_fetched
|
108
|
+
"rake-0.8.6".should_not be_unpacked
|
109
|
+
end
|
110
|
+
|
111
|
+
it "requires at least one package to fetch (when not in a project)" do
|
112
|
+
bpm "fetch", :track_stderr => true
|
113
|
+
stderr.read.should include("called incorrectly")
|
114
|
+
end
|
115
|
+
|
116
|
+
it "does not make a .gem directory" do
|
117
|
+
bpm "fetch", "rake"
|
118
|
+
wait
|
119
|
+
home(".gem").exist?.should be_false
|
120
|
+
end
|
121
|
+
|
122
|
+
it "fetches package dependencies" do
|
123
|
+
bpm "fetch", "core-test"
|
124
|
+
|
125
|
+
output = stdout.read
|
126
|
+
|
127
|
+
%w(ivory-0.0.1 optparse-1.0.1 core-test-0.4.9).each do |name|
|
128
|
+
output.should include("Successfully fetched #{name.sub(/-[^-]*$/,'')} (#{name.sub(/^.*-/, '')})")
|
129
|
+
|
130
|
+
name.should be_fetched
|
131
|
+
name.should be_unpacked
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bpm fetched" do
|
4
|
+
before do
|
5
|
+
goto_home
|
6
|
+
set_host
|
7
|
+
start_fake(FakeGemServer.new)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "lists fetched packages" do
|
11
|
+
bpm "fetch", "rake"
|
12
|
+
wait
|
13
|
+
bpm "fetched"
|
14
|
+
|
15
|
+
output = stdout.read
|
16
|
+
output.should include("rake (0.8.7)")
|
17
|
+
output.should_not include("0.8.6")
|
18
|
+
output.should_not include("builder")
|
19
|
+
output.should_not include("bundler")
|
20
|
+
output.should_not include("highline")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "lists all installed packages from different versions" do
|
24
|
+
bpm "fetch", "rake"
|
25
|
+
wait
|
26
|
+
bpm "fetch", "rake", "-v", "0.8.6"
|
27
|
+
wait
|
28
|
+
bpm "fetched"
|
29
|
+
|
30
|
+
output = stdout.read
|
31
|
+
output.should include("rake (0.8.7, 0.8.6)")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "filters packages when given an argument" do
|
35
|
+
bpm "fetch", "rake"
|
36
|
+
wait
|
37
|
+
bpm "fetch", "builder"
|
38
|
+
wait
|
39
|
+
bpm "fetched", "builder"
|
40
|
+
|
41
|
+
output = stdout.read
|
42
|
+
output.should_not include("rake")
|
43
|
+
output.should include("builder (3.0.0)")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "says it couldn't find any if none found" do
|
47
|
+
bpm "fetched", "rails", :track_stderr => true
|
48
|
+
|
49
|
+
stderr.read.strip.should == 'No packages found matching "rails".'
|
50
|
+
exit_status.should_not be_success
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bpm init" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@project_path = home("new_project")
|
7
|
+
FileUtils.mkdir @project_path
|
8
|
+
cd @project_path
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should create files" do
|
12
|
+
bpm 'init'
|
13
|
+
|
14
|
+
files = %w(new_project.json assets assets/bpm_packages.js assets/bpm_styles.css)
|
15
|
+
|
16
|
+
output = stdout.read.gsub(/\e\[\d+m/,'') #without colors
|
17
|
+
|
18
|
+
files.each do |file|
|
19
|
+
output.should =~ /create\s+#{file}$/
|
20
|
+
File.join(@project_path, file).should exist
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should fetch dependencies"
|
25
|
+
|
26
|
+
it "should build"
|
27
|
+
|
28
|
+
it "should not overwrite existing files" do
|
29
|
+
File.open("new_project.json", 'w'){|f| f.print "Valuable info!" }
|
30
|
+
|
31
|
+
bpm 'init', '--skip' # skip, since we can't test the prompt
|
32
|
+
|
33
|
+
output = stdout.read.gsub(/\e\[\d+m/,'') # without colors
|
34
|
+
|
35
|
+
output.should =~ /skip\s+new_project.json/
|
36
|
+
File.read("new_project.json").should == "Valuable info!"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should allow a name to be specified" do
|
40
|
+
bpm 'init', '--name=DifferentName' and wait
|
41
|
+
|
42
|
+
File.join(@project_path, "DifferentName.json").should exist
|
43
|
+
File.join(@project_path, "new_project.json").should_not exist
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should initialize multiple at once"
|
47
|
+
|
48
|
+
it "should not allow a name when initializing multiple"
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bpm list" do
|
4
|
+
before do
|
5
|
+
goto_home
|
6
|
+
set_host
|
7
|
+
start_fake(FakeGemServer.new)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "lists latest packages by default" do
|
11
|
+
bpm "list"
|
12
|
+
|
13
|
+
output = stdout.read
|
14
|
+
output.should include("builder (3.0.0)")
|
15
|
+
output.should include("rake (0.8.7)")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "lists all packages when given the all argument" do
|
19
|
+
bpm "list", "-a"
|
20
|
+
|
21
|
+
output = stdout.read
|
22
|
+
output.should include("builder (3.0.0)")
|
23
|
+
output.should include("rake (0.8.7, 0.8.6)")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "filters packages when given an argument" do
|
27
|
+
bpm "list", "builder"
|
28
|
+
|
29
|
+
output = stdout.read
|
30
|
+
output.should include("builder (3.0.0)")
|
31
|
+
output.should_not include("rake")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "filters packages when given an argument and shows all versions" do
|
35
|
+
bpm "list", "rake", "-a"
|
36
|
+
|
37
|
+
output = stdout.read
|
38
|
+
output.should include("rake (0.8.7, 0.8.6)")
|
39
|
+
output.should_not include("builder")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "filters multiple packages" do
|
43
|
+
bpm "list", "rake", "highline"
|
44
|
+
|
45
|
+
output = stdout.read
|
46
|
+
output.should include("highline (1.6.1)")
|
47
|
+
output.should include("rake (0.8.7)")
|
48
|
+
output.should_not include("builder")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "shows prerelease packages" do
|
52
|
+
bpm "list", "--prerelease"
|
53
|
+
|
54
|
+
output = stdout.read
|
55
|
+
output.should include("bundler (1.1.pre)")
|
56
|
+
output.should_not include("highline")
|
57
|
+
output.should_not include("rake")
|
58
|
+
output.should_not include("builder")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "says it couldn't find any if none found" do
|
62
|
+
bpm "list", "rails", :track_stderr => true
|
63
|
+
|
64
|
+
stderr.read.strip.should == 'No packages found matching "rails".'
|
65
|
+
exit_status.should_not be_success
|
66
|
+
end
|
67
|
+
|
68
|
+
it "says it couldn't find any if none found matching multiple packages" do
|
69
|
+
bpm "list", "rails", "bake", :track_stderr => true
|
70
|
+
|
71
|
+
stderr.read.strip.should == 'No packages found matching "rails", "bake".'
|
72
|
+
exit_status.should_not be_success
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bpm login" do
|
4
|
+
let(:email) { "email@example.com" }
|
5
|
+
let(:password) { "secrets" }
|
6
|
+
let(:api_key) { "deadbeef" }
|
7
|
+
let(:creds) { bpm_dir("credentials") }
|
8
|
+
|
9
|
+
before do
|
10
|
+
goto_home
|
11
|
+
|
12
|
+
fake = lambda { |env|
|
13
|
+
[200, {"Content-Type" => "text/plain"}, [api_key]]
|
14
|
+
}
|
15
|
+
|
16
|
+
protected_fake = Rack::Auth::Basic.new(fake) do |user, pass|
|
17
|
+
user == email && password == pass
|
18
|
+
end
|
19
|
+
|
20
|
+
set_host
|
21
|
+
start_fake(protected_fake)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "says email that user is logging in as" do
|
25
|
+
bpm "login"
|
26
|
+
input email
|
27
|
+
input password
|
28
|
+
output = stdout.read
|
29
|
+
output.should include("Enter your BPM credentials.")
|
30
|
+
output.should include("Logging in as #{email}...")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "makes a request out for the api key and stores it in BPM_DIR/credentials" do
|
34
|
+
bpm "login"
|
35
|
+
input email
|
36
|
+
input password
|
37
|
+
|
38
|
+
stdout.read.should include("Logged in!")
|
39
|
+
File.exist?(creds).should be_true
|
40
|
+
YAML.load_file(creds)[:bpm_api_key].should == api_key
|
41
|
+
YAML.load_file(creds)[:bpm_email].should == email
|
42
|
+
end
|
43
|
+
|
44
|
+
it "notifies user if bad creds given" do
|
45
|
+
bpm "login", :track_stderr => true
|
46
|
+
input email
|
47
|
+
input "badpassword"
|
48
|
+
sleep 1
|
49
|
+
kill!
|
50
|
+
|
51
|
+
stdout.read.should include("Incorrect email or password.")
|
52
|
+
File.exist?(creds).should be_false
|
53
|
+
end
|
54
|
+
|
55
|
+
it "allows the user to retry if bad creds given" do
|
56
|
+
bpm "login"
|
57
|
+
input "bademail@example.com"
|
58
|
+
input "badpassword"
|
59
|
+
|
60
|
+
input email
|
61
|
+
input password
|
62
|
+
|
63
|
+
output = stdout.read.split("\n").select { |line| line.size > 0 }
|
64
|
+
output[0].should include("Enter your BPM credentials.")
|
65
|
+
output[3].should include("Logging in as bademail@example.com...")
|
66
|
+
output[4].should include("Incorrect email or password.")
|
67
|
+
output[5].should include("Enter your BPM credentials.")
|
68
|
+
output[8].should include("Logging in as #{email}...")
|
69
|
+
output[9].should include("Logged in!")
|
70
|
+
|
71
|
+
File.exist?(creds).should be_true
|
72
|
+
YAML.load_file(creds)[:bpm_api_key].should == api_key
|
73
|
+
YAML.load_file(creds)[:bpm_email].should == email
|
74
|
+
end
|
75
|
+
|
76
|
+
it "will login with credentials provided as cli arguments" do
|
77
|
+
bpm "login", "-u", email, "-p", password
|
78
|
+
output = stdout.read
|
79
|
+
output.should_not include("Enter your BPM credentials.")
|
80
|
+
output.should include("Logging in as #{email}...")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "will not retry on failure if username and password are provided as cli arguments" do
|
84
|
+
bpm "login", "-u", email, "-p", "badpassword"
|
85
|
+
output = stdout.read
|
86
|
+
output.should_not include("Enter your BPM credentials.")
|
87
|
+
output.should include("Logging in as #{email}...")
|
88
|
+
output.should include("Incorrect email or password.")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "will only prompt for username if password is provided" do
|
92
|
+
bpm "login", "-p", password
|
93
|
+
input email
|
94
|
+
output = stdout.read
|
95
|
+
output.should include("Enter your BPM credentials.")
|
96
|
+
output.should include("Email:")
|
97
|
+
output.should_not include("Password:")
|
98
|
+
output.should include("Logging in as #{email}...")
|
99
|
+
end
|
100
|
+
|
101
|
+
it "will only prompt for password if username is provided" do
|
102
|
+
bpm "login", "-u", email
|
103
|
+
input password
|
104
|
+
output = stdout.read
|
105
|
+
output.should include("Enter your BPM credentials.")
|
106
|
+
output.should_not include("Email:")
|
107
|
+
output.should include("Password:")
|
108
|
+
output.should include("Logging in as #{email}...")
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bpm new" do
|
4
|
+
|
5
|
+
describe "normal" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
cd home
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should create files" do
|
12
|
+
bpm 'new', 'BpmTest'
|
13
|
+
|
14
|
+
files = %w(LICENSE README.md index.html app.js BpmTest.json assets assets/bpm_packages.js assets/bpm_styles.css)
|
15
|
+
|
16
|
+
# output without coloration
|
17
|
+
output = stdout.read.gsub(/\e\[\d+m/,'')
|
18
|
+
|
19
|
+
files.each do |file|
|
20
|
+
output.should =~ /create\s+#{file}$/
|
21
|
+
home("bpm_test", file).should exist
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should fetch dependencies"
|
26
|
+
|
27
|
+
it "should build"
|
28
|
+
|
29
|
+
it "should not generate into existing directory" do
|
30
|
+
FileUtils.mkdir 'bpm_test'
|
31
|
+
|
32
|
+
bpm 'new', 'BpmTest'
|
33
|
+
|
34
|
+
stdout.read.should_not include("create")
|
35
|
+
`ls #{home("bpm_test")}`.should be_empty
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should allow a path to be specified" do
|
39
|
+
bpm 'new', 'BpmTest', '--path=DifferentLocation' and wait
|
40
|
+
|
41
|
+
home("DifferentLocation").should exist
|
42
|
+
home("DifferentLocation", "BpmTest.json").should exist
|
43
|
+
home("DifferentLocation", "DifferentLocation.json").should_not exist
|
44
|
+
home("bpm_test").should_not exist
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "package templates" do
|
50
|
+
|
51
|
+
before do
|
52
|
+
goto_home
|
53
|
+
|
54
|
+
# Install package
|
55
|
+
cd fixtures
|
56
|
+
with_env do
|
57
|
+
BPM::Remote.new.install("custom_generator-1.0.spd", ">= 0", false)
|
58
|
+
end
|
59
|
+
cd home
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should create custom files" do
|
63
|
+
bpm 'new', 'BpmTest', '--package=custom_generator'
|
64
|
+
|
65
|
+
files = %w(lib lib/main.js app.js BpmTest.json assets assets/bpm_packages.js assets/bpm_styles.css)
|
66
|
+
|
67
|
+
# output without coloration
|
68
|
+
output = stdout.read.gsub(/\e\[\d+m/,'')
|
69
|
+
|
70
|
+
files.each do |file|
|
71
|
+
output.should =~ /create\s+#{file}$/
|
72
|
+
home("bpm_test", file).should exist
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should create custom app.js with explicit generator" do
|
77
|
+
bpm 'new', 'BpmTest', '--package=custom_generator' and wait
|
78
|
+
|
79
|
+
File.read(home("bpm_test", "app.js")).should == "require('BpmTest/main.js')\n"
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should create custom project.json without explicit generator" do
|
83
|
+
bpm 'new', 'BpmTest', '--package=custom_generator' and wait
|
84
|
+
|
85
|
+
File.read(home("bpm_test", "BpmTest.json")).should =~ /"spade": ">= 0"/
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should install the package if it doesn't exist locally"
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|