bpm 1.0.0.beta.13 → 1.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.md +35 -1
  2. data/README.md +1 -1
  3. data/bin/bpm +18 -1
  4. data/bpm.gemspec +3 -3
  5. data/lib/bpm.rb +34 -1
  6. data/lib/bpm/cli/base.rb +32 -44
  7. data/lib/bpm/errors.rb +15 -3
  8. data/lib/bpm/execjs_ext.rb +99 -0
  9. data/lib/bpm/local.rb +1 -1
  10. data/lib/bpm/package.rb +53 -51
  11. data/lib/bpm/pipeline.rb +21 -14
  12. data/lib/bpm/pipeline/directive_processor.rb +9 -0
  13. data/lib/bpm/pipeline/generated_asset.rb +59 -13
  14. data/lib/bpm/pipeline/package_pipeline.rb +2 -2
  15. data/lib/bpm/pipeline/plugin_asset.rb +1 -1
  16. data/lib/bpm/pipeline/plugin_context.rb +12 -2
  17. data/lib/bpm/pipeline/plugin_processor.rb +27 -4
  18. data/lib/bpm/project.rb +171 -139
  19. data/lib/bpm/server.rb +14 -9
  20. data/lib/bpm/version.rb +1 -1
  21. data/man/{bpm-compile.1.ronn → bpm-rebuild.1.ronn} +0 -0
  22. data/man/bpm.1.ronn +112 -9
  23. data/spec/cli/add_spec.rb +15 -6
  24. data/spec/cli/init_spec.rb +7 -7
  25. data/spec/cli/pack_spec.rb +13 -8
  26. data/spec/cli/preview_spec.rb +10 -0
  27. data/spec/cli/rebuild_spec.rb +5 -5
  28. data/spec/cli/remove_spec.rb +1 -1
  29. data/spec/fixtures/gems/core-test-0.4.9.bpkg +0 -0
  30. data/spec/fixtures/packages/backbone/package.json +2 -2
  31. data/spec/fixtures/packages/core-test/package.json +1 -1
  32. data/spec/fixtures/projects/coffee/coffee.json +4 -4
  33. data/spec/fixtures/projects/coffee/{packages → vendor}/coffee-script/compiler.js +0 -0
  34. data/spec/fixtures/projects/coffee/{packages → vendor}/coffee-script/lib/main.js +0 -0
  35. data/spec/fixtures/projects/coffee/{packages → vendor}/coffee-script/package.json +0 -0
  36. data/spec/fixtures/projects/coffee/{packages/handlebars → vendor/handlebars-format}/format.js +0 -0
  37. data/spec/fixtures/projects/coffee/{packages/handlebars → vendor/handlebars-format}/lib/main.js +0 -0
  38. data/spec/fixtures/projects/coffee/{packages/handlebars → vendor/handlebars-format}/package.json +2 -2
  39. data/spec/fixtures/projects/coffee/vendor/handlebars/package.json +15 -0
  40. data/spec/fixtures/projects/coffee/vendor/spade-coffee/package.json +15 -0
  41. data/spec/fixtures/projects/coffee/vendor/spade-handlebars/package.json +15 -0
  42. data/spec/fixtures/projects/coffee/vendor/spade/lib/main.js +1 -0
  43. data/spec/fixtures/projects/coffee/{packages → vendor}/spade/package.json +0 -0
  44. data/spec/fixtures/projects/coffee/{packages → vendor}/spade/transport.js +0 -0
  45. data/spec/fixtures/projects/hello2/{packages → vendor}/a/lib/main.js +0 -0
  46. data/spec/fixtures/projects/hello2/{packages → vendor}/a/package.json +0 -0
  47. data/spec/fixtures/projects/hello2/{packages → vendor}/b/lib/main.js +0 -0
  48. data/spec/fixtures/projects/hello2/{packages → vendor}/b/package.json +0 -0
  49. data/spec/fixtures/projects/hello2/{packages → vendor}/c/lib/main.js +0 -0
  50. data/spec/fixtures/projects/hello2/{packages → vendor}/c/package.json +0 -0
  51. data/spec/fixtures/projects/hello_dev/{packages → vendor}/style_package/css/some_style.css +0 -0
  52. data/spec/fixtures/projects/hello_dev/{packages → vendor}/style_package/package.json +0 -0
  53. data/spec/fixtures/projects/hello_world/another/one.js +1 -0
  54. data/spec/fixtures/projects/hello_world/another/two.js +1 -0
  55. data/spec/fixtures/projects/hello_world/hello_world.json +6 -5
  56. data/spec/fixtures/projects/hello_world/lib2/something.js +1 -0
  57. data/spec/fixtures/projects/hello_world/{packages → vendor}/custom_package/assets/dummy.txt +0 -0
  58. data/spec/fixtures/projects/hello_world/{packages → vendor}/custom_package/css/sample_styles.css +0 -0
  59. data/spec/fixtures/projects/hello_world/{packages → vendor}/custom_package/custom_dir/basic-module.js +0 -0
  60. data/spec/fixtures/projects/hello_world/{packages → vendor}/custom_package/lib/main.js +0 -0
  61. data/spec/fixtures/projects/hello_world/{packages → vendor}/custom_package/package.json +1 -1
  62. data/spec/fixtures/projects/hello_world/vendor/prerelease_package/package.json +4 -0
  63. data/spec/fixtures/projects/init_app/new_project.json +3 -3
  64. data/spec/fixtures/projects/init_default/new_project.json +2 -2
  65. data/spec/fixtures/projects/minitest/minitest.json +1 -1
  66. data/spec/fixtures/projects/minitest/{packages → vendor}/uglyduck/lib/main.js +0 -0
  67. data/spec/fixtures/projects/minitest/{packages → vendor}/uglyduck/minifier/main.js +0 -0
  68. data/spec/fixtures/projects/minitest/{packages → vendor}/uglyduck/package.json +0 -0
  69. data/spec/fixtures/projects/minitrans/minitrans.json +1 -1
  70. data/spec/fixtures/projects/minitrans/{packages → vendor}/transport/lib/main.js +0 -0
  71. data/spec/fixtures/projects/minitrans/{packages → vendor}/transport/package.json +0 -0
  72. data/spec/fixtures/projects/minitrans/{packages → vendor}/transport/transports/wrapper.js +0 -0
  73. data/spec/fixtures/projects/minitrans/{packages → vendor}/uglyduck/lib/main.js +0 -0
  74. data/spec/fixtures/projects/minitrans/{packages → vendor}/uglyduck/minifier/main.js +0 -0
  75. data/spec/fixtures/projects/minitrans/{packages → vendor}/uglyduck/package.json +0 -0
  76. data/spec/fixtures/projects/transporter/{packages → vendor}/transport/lib/main.js +0 -0
  77. data/spec/fixtures/projects/transporter/{packages → vendor}/transport/package.json +0 -0
  78. data/spec/fixtures/projects/transporter/{packages → vendor}/transport/transports/wrapper.js +0 -0
  79. data/spec/package_pipeline_spec.rb +8 -5
  80. data/spec/package_spec.rb +31 -26
  81. data/spec/pipeline_spec.rb +72 -64
  82. data/spec/plugins/format_spec.rb +7 -7
  83. data/spec/project_spec.rb +6 -5
  84. data/spec/spec_helper.rb +5 -4
  85. data/spec/support/cli.rb +9 -7
  86. data/spec/support/env.rb +7 -4
  87. data/spec/support/path.rb +1 -0
  88. data/support/es5-shim.js +935 -0
  89. data/templates/init/project.json +2 -3
  90. metadata +112 -97
  91. data/lib/bpm/pipeline/transport_processor.rb +0 -34
  92. data/spec/fixtures/projects/coffee/packages/spade/lib/main.js +0 -1
  93. data/spec/fixtures/projects/hello_world/vendor/lib/something.js +0 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "handlebars",
2
+ "name": "handlebars-format",
3
3
  "version": "1.0.0",
4
4
  "description": "DESC",
5
5
  "summary": "SUMMARY",
@@ -9,7 +9,7 @@
9
9
  "bpm:provides": {
10
10
  "format:handlebars": {
11
11
  "mime:default": "application/javascript",
12
- "main": "handlebars/format"
12
+ "main": "handlebars-format/format"
13
13
  }
14
14
  }
15
15
 
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "handlebars",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "spade": ">= 0",
6
+ "handlebars-format": ">= 0"
7
+ },
8
+
9
+ "bpm:provides": {
10
+ "format:handlebars": {
11
+ "mime:default": "application/javascript",
12
+ "main": "handlebars-format/format"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "spade-coffee",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "spade": ">= 0",
6
+ "coffee-script": ">= 0"
7
+ },
8
+
9
+ "bpm:provides": {
10
+ "format:coffee": {
11
+ "mime:default": "application/javascript",
12
+ "main": "coffee-script/compiler"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "spade-handlebars",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "spade": ">= 0",
6
+ "handlebars": ">= 0"
7
+ },
8
+
9
+ "bpm:provides": {
10
+ "format:handlebars": {
11
+ "mime:default": "application/javascript",
12
+ "main": "handlebars-format/format"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ //spade/lib/main
@@ -0,0 +1 @@
1
+ // ANOTHER ONE
@@ -0,0 +1 @@
1
+ // ANOTHER TWO
@@ -8,9 +8,10 @@
8
8
  "homepage": "URL",
9
9
 
10
10
  "directories": {
11
- "lib": ["./lib", "./vendor/lib"],
11
+ "lib": ["./lib", "./lib2"],
12
12
  "test": "./tests",
13
- "custom": "./custom_dir"
13
+ "custom": "./custom_dir",
14
+ "different": "./another"
14
15
  },
15
16
 
16
17
  "dependencies": {
@@ -26,15 +27,15 @@
26
27
  "bpm:build": {
27
28
 
28
29
  "hello_world/bpm_libs.js": {
29
- "directories": ["lib", "custom"]
30
+ "files": ["lib", "custom", "different/one.js"]
30
31
  },
31
32
 
32
33
  "hello_world/bpm_styles.css": {
33
- "directories": ["css"]
34
+ "files": ["css"]
34
35
  },
35
36
 
36
37
  "hello_world/bpm_tests.js": {
37
- "directories": ["test"]
38
+ "files": ["test"]
38
39
  }
39
40
  }
40
41
 
@@ -0,0 +1 @@
1
+ // SOMETHING
@@ -18,7 +18,7 @@
18
18
 
19
19
  "bpm:build": {
20
20
  "bpm_libs.js": {
21
- "directories": ["lib", "not-normal"],
21
+ "files": ["lib", "not-normal"],
22
22
  "minifier": "uglify-js"
23
23
  }
24
24
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "prerelease_package",
3
+ "version": "1.0.0.pre"
4
+ }
@@ -4,15 +4,15 @@
4
4
 
5
5
  "bpm:build": {
6
6
  "bpm_libs.js": {
7
- "directories": [
7
+ "files": [
8
8
  "lib"
9
9
  ],
10
10
  "minifier": "uglify-js"
11
11
  },
12
12
  "bpm_styles.css": {
13
- "directories": [
13
+ "files": [
14
14
  "css"
15
15
  ]
16
16
  }
17
17
  }
18
- }
18
+ }
@@ -4,12 +4,12 @@
4
4
 
5
5
  "bpm:build": {
6
6
  "bpm_libs.js": {
7
- "directories": [],
7
+ "files": [],
8
8
  "minifier": "uglify-js"
9
9
  },
10
10
 
11
11
  "bpm_styles.css": {
12
- "directories": []
12
+ "files": []
13
13
  }
14
14
  }
15
15
  }
@@ -19,7 +19,7 @@
19
19
  },
20
20
 
21
21
  "minitest/bpm_libs.js": {
22
- "directories": ["lib"],
22
+ "files": ["lib"],
23
23
  "minifier": { "uglyduck": ">= 0" },
24
24
  "uglyduck:where": "sanfran"
25
25
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  "bpm:build": {
19
19
  "bpm_libs.js": {
20
- "directories": ["lib"],
20
+ "files": ["lib"],
21
21
  "minifier": "uglyduck"
22
22
  }
23
23
  }
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe BPM::PackagePipeline do
4
-
4
+
5
5
  before do
6
6
  goto_home
7
7
  set_host
@@ -9,7 +9,7 @@ describe BPM::PackagePipeline do
9
9
  FileUtils.cp_r(project_fixture('coffee'), '.')
10
10
  cd home('coffee')
11
11
  end
12
-
12
+
13
13
  subject do
14
14
  project = BPM::Project.new home('coffee')
15
15
  BPM::Pipeline.new project
@@ -17,14 +17,17 @@ describe BPM::PackagePipeline do
17
17
 
18
18
  it "should get package pipelines for each package" do
19
19
  names = subject.package_pipelines.map { |pipeline| pipeline.package.name }
20
- names.sort.should == %w(coffee coffee-script handlebars spade)
20
+ # NOTE: We handlebars is so deeply nested to test a very specific issue with
21
+ # formats that are re-provided at least twice by packages that have a transport.
22
+ # There is currently a fix for this in BPM::PluginProcessor
23
+ names.sort.should == %w(coffee coffee-script handlebars handlebars-format spade spade-handlebars)
21
24
  end
22
-
25
+
23
26
  it "should get an asset for the coffee file" do
24
27
  asset = subject.find_asset 'coffee/lib/main.js'
25
28
  asset.should_not be_nil
26
29
  asset.pathname.should == home('coffee', 'lib', 'main.coffee')
27
30
  end
28
-
31
+
29
32
  end
30
33
 
data/spec/package_spec.rb CHANGED
@@ -1,5 +1,15 @@
1
1
  require "spec_helper"
2
2
 
3
+ describe "BPM::Package class" do
4
+ it "should create from_spec"
5
+
6
+ it "should tell if package root" do
7
+ BPM::Package.is_package_root?(fixtures('packages', 'backbone')).should be_true
8
+ BPM::Package.is_package_root?(fixtures('projects', 'hello_world')).should be_false
9
+ BPM::Package.is_package_root?(fixtures('packages', 'non_existent')).should be_false
10
+ end
11
+ end
12
+
3
13
  describe BPM::Package do
4
14
  it "should have 'lib' as default lib_path'" do
5
15
  subject.send(:lib_path).should == 'lib'
@@ -21,7 +31,7 @@ describe BPM::Package, "#to_spec" do
21
31
  end
22
32
 
23
33
  subject do
24
- package = BPM::Package.new(nil, email)
34
+ package = BPM::Package.new(nil, :email => email)
25
35
  package.json_path = package_fixture("core-test", "package.json")
26
36
  if spec = package.to_spec
27
37
  spec
@@ -194,7 +204,7 @@ describe BPM::Package, "validation errors" do
194
204
  end
195
205
 
196
206
  subject do
197
- BPM::Package.new(nil, email)
207
+ BPM::Package.new(nil, :email => email)
198
208
  end
199
209
 
200
210
  def write_package
@@ -207,27 +217,10 @@ describe BPM::Package, "validation errors" do
207
217
  subject.json_path = path
208
218
  end
209
219
 
210
- %w[name description summary homepage author version].each do |field|
220
+ %w[name summary version].each do |field|
211
221
  it "is invalid without a #{field} field" do
212
222
  write_package do |package|
213
- if %w(description summary).include?(field)
214
- package.delete 'description'
215
- package.delete 'summary'
216
- else
217
- package.delete(field)
218
- end
219
- end
220
-
221
- subject.should have_error("Package requires a '#{field}' field")
222
- end
223
-
224
- it "is invalid with a blank #{field} field" do
225
- write_package do |package|
226
- if %w(description summary).include?(field)
227
- package['description'] = package['summary'] = ''
228
- else
229
- package[field] = ''
230
- end
223
+ package.delete(field)
231
224
  end
232
225
 
233
226
  subject.should have_error("Package requires a '#{field}' field")
@@ -306,17 +299,19 @@ describe BPM::Package, "validation errors" do
306
299
  subject.should have_error "'./fake', specified for lib directory, is not a directory"
307
300
  end
308
301
 
309
- it "is invalid if the lib directory array is empty" do
302
+ it "is valid if the lib directory array is empty" do
303
+ # This provides a mean to make a libless package
304
+ # Since this is rare, you have to explicitly specify an empty array
310
305
  write_package do |package|
311
306
  package["directories"]["lib"] = []
312
307
  end
313
308
 
314
- subject.should have_error("A lib directory is required")
309
+ subject.should be_valid
315
310
  end
316
311
 
317
312
  end
318
313
 
319
- describe BPM::Package, 'InvalidPackageError' do
314
+ describe BPM::Package, 'InvalidPackagePathError' do
320
315
 
321
316
  it "should raise exception when loading invalid JSON" do
322
317
  package = BPM::Package.new(package_fixture('invalid_json'))
@@ -339,9 +334,19 @@ describe BPM::Package, 'InvalidPackageError' do
339
334
  package = BPM::Package.new home('jquery2')
340
335
  lambda {
341
336
  package.load_json
342
- }.should raise_error(BPM::InvalidPackageNameError)
337
+ }.should raise_error(BPM::InvalidPackagePathError)
343
338
  end
344
-
339
+
340
+ it "should not raise exception for standalone packages" do
341
+ goto_home
342
+ FileUtils.cp_r package_fixture('jquery'), 'jquery2'
343
+ package = BPM::Package.new home('jquery2'), :standalone => true
344
+ lambda {
345
+ package.load_json
346
+ }.should_not raise_error
347
+ end
348
+
349
+
345
350
  end
346
351
 
347
352
  describe BPM::Package, "templates" do
@@ -9,34 +9,34 @@ describe BPM::Pipeline, "asset_path" do
9
9
  FileUtils.cp_r(project_fixture('hello_world'), '.')
10
10
  cd home('hello_world')
11
11
  end
12
-
12
+
13
13
  subject do
14
14
  project = BPM::Project.new home('hello_world')
15
15
  BPM::Pipeline.new project
16
16
  end
17
-
17
+
18
18
  it "should find any asset in the assets directory" do
19
19
  bpm 'rebuild', '--update' and wait
20
20
  asset = subject.find_asset 'papa-smurf.jpg'
21
21
  asset.pathname.should == home('hello_world', 'assets', 'papa-smurf.jpg')
22
22
  end
23
-
23
+
24
24
  it "should find any asset in packages" do
25
25
  bpm 'fetch' and wait
26
26
  bpm 'add', 'custom_package' and wait
27
-
27
+
28
28
  asset = subject.find_asset 'custom_package/assets/dummy.txt'
29
- asset.pathname.should == home('hello_world', '.bpm', 'packages', 'custom_package', 'assets', 'dummy.txt')
29
+ asset.pathname.should == home('hello_world', 'vendor', 'custom_package', 'assets', 'dummy.txt')
30
30
  end
31
-
31
+
32
32
  it "should find any asset in installed packages" do
33
33
  bpm 'fetch' and wait
34
34
  bpm 'rebuild' and wait
35
-
35
+
36
36
  asset = subject.find_asset 'core-test/resources/runner.css'
37
- asset.pathname.should == home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')
37
+ asset.pathname.should == home('.bpm', 'gems', 'core-test-0.4.9', 'resources', 'runner.css')
38
38
  end
39
-
39
+
40
40
  describe "generated assets" do
41
41
 
42
42
  before do
@@ -47,153 +47,162 @@ describe BPM::Pipeline, "asset_path" do
47
47
  end
48
48
 
49
49
  describe "bpm_libs.js" do
50
-
50
+
51
51
  subject do
52
52
  BPM::Pipeline.new(@project).find_asset 'bpm_libs.js'
53
53
  end
54
-
54
+
55
55
  it "should return an asset of type BPM::GeneratedAsset" do
56
56
  subject.class.should == BPM::GeneratedAsset
57
57
  end
58
-
58
+
59
59
  it "should find the bpm_libs.js" do
60
60
  subject.pathname.should == home('hello_world', 'assets', 'bpm_libs.js')
61
61
  end
62
-
62
+
63
63
  it "should find bpm_libs as well" do
64
64
  BPM::Pipeline.new(@project).find_asset('bpm_libs').should == subject
65
65
  end
66
-
66
+
67
67
  it "should have a manifest line" do
68
68
  # Right now we're including dev deps
69
69
  subject.to_s.should include('MANIFEST: core-test (0.4.9) custom_generator (1.0) custom_package (2.0.0) ivory (0.0.1) jquery (1.4.3) optparse (1.0.1) rake (0.8.6) spade (0.5.0)')
70
70
  end
71
-
71
+
72
72
  it "should include any required modules in the bpm_package.js" do
73
- subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'lib', 'main.js')))
73
+ subject.to_s.should include(File.read(home('hello_world', 'vendor', 'custom_package', 'lib', 'main.js')))
74
74
  end
75
-
75
+
76
76
  it "should reference package.json directories when resolving modules" do
77
- subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'custom_dir', 'basic-module.js')))
77
+ subject.to_s.should include(File.read(home('hello_world', 'vendor', 'custom_package', 'custom_dir', 'basic-module.js')))
78
78
  end
79
-
79
+
80
80
  end
81
-
81
+
82
82
  describe "bpm_styles.css" do
83
-
83
+
84
84
  subject do
85
85
  BPM::Pipeline.new(@project).find_asset 'bpm_styles.css'
86
86
  end
87
-
87
+
88
88
  it "should find bpm_styles.css" do
89
89
  subject.pathname.should == home('hello_world', 'assets', 'bpm_styles.css')
90
90
  end
91
-
91
+
92
92
  it "should include any required modules in the bpm_styles.css" do
93
- subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'css', 'sample_styles.css')))
93
+ subject.to_s.should include(File.read(home('hello_world', 'vendor', 'custom_package', 'css', 'sample_styles.css')))
94
94
  end
95
-
95
+
96
96
  it "should reference installed package styles as well" do
97
- subject.to_s.should include(File.read(home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')))
97
+ subject.to_s.should include(File.read(home('.bpm', 'gems', 'core-test-0.4.9', 'resources', 'runner.css')))
98
98
  end
99
-
99
+
100
100
  end
101
-
101
+
102
102
  describe "hello_world/bpm_libs.js" do
103
-
103
+
104
104
  subject do
105
105
  BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_libs.js'
106
106
  end
107
-
107
+
108
108
  it "should return an asset of type BPM::GeneratedAsset" do
109
109
  subject.class.should == BPM::GeneratedAsset
110
110
  end
111
-
111
+
112
112
  it "should find the bpm_libs.js" do
113
113
  subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_libs.js')
114
114
  end
115
-
115
+
116
116
  it "should find bpm_libs as well" do
117
117
  BPM::Pipeline.new(@project).find_asset('hello_world/bpm_libs').should == subject
118
118
  end
119
-
119
+
120
120
  it "should have a manifest line" do
121
121
  subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
122
122
  end
123
-
123
+
124
124
  it "should include any required modules in the bpm_libs" do
125
125
  subject.to_s.should include(File.read(home('hello_world', 'lib', 'main.js')))
126
126
  end
127
+
128
+ it "should load from secondary lib" do
129
+ subject.to_s.should include(File.read(home('hello_world', 'lib2', 'something.js')))
130
+ end
131
+
132
+ it "should use singly loaded files" do
133
+ subject.to_s.should include(File.read(home('hello_world', 'another', 'one.js')))
134
+ end
135
+
127
136
  end
128
137
 
129
138
  describe "hello_world/bpm_styles.css" do
130
-
139
+
131
140
  before do
132
141
  FileUtils.mkdir_p home('hello_world', 'assets', 'hello_world')
133
142
  FileUtils.touch home('hello_world', 'assets', 'hello_world', 'bpm_styles.css')
134
143
  end
135
-
144
+
136
145
  subject do
137
146
  BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_styles.css'
138
147
  end
139
-
148
+
140
149
  it "should return an asset of type BPM::GeneratedAsset" do
141
150
  subject.class.should == BPM::GeneratedAsset
142
151
  end
143
-
152
+
144
153
  it "should find the app_styles.css" do
145
154
  subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_styles.css')
146
155
  end
147
-
156
+
148
157
  it "should find bpm_styles as well" do
149
158
  BPM::Pipeline.new(@project).find_asset('hello_world/bpm_styles').should == subject
150
159
  end
151
-
160
+
152
161
  it "should have a manifest line" do
153
162
  subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
154
163
  end
155
-
164
+
156
165
  it "should include any required modules in the bpm_styles" do
157
166
  subject.to_s.should include(File.read(home('hello_world', 'css', 'dummy.css')))
158
167
  end
159
-
168
+
160
169
  end
161
-
170
+
162
171
  describe "hello_world/app_tests.js" do
163
-
172
+
164
173
  before do
165
174
  FileUtils.mkdir_p home('hello_world', 'assets', 'hello_world')
166
175
  FileUtils.touch home('hello_world', 'assets', 'hello_world', 'app_tests.js')
167
176
  end
168
-
177
+
169
178
  subject do
170
179
  BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_tests.js'
171
180
  end
172
-
181
+
173
182
  it "should return an asset of type BPM::GeneratedAsset" do
174
183
  subject.class.should == BPM::GeneratedAsset
175
184
  end
176
-
185
+
177
186
  it "should find the app_tests.js" do
178
187
  subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_tests.js')
179
188
  end
180
-
189
+
181
190
  it "should find app_tests as well" do
182
191
  BPM::Pipeline.new(@project).find_asset('hello_world/bpm_tests').should == subject
183
192
  end
184
-
193
+
185
194
  it "should have a manifest line" do
186
195
  subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
187
196
  end
188
-
197
+
189
198
  it "should include any required modules in the bpm_tests" do
190
199
  subject.to_s.should include(File.read(home('hello_world', 'tests', 'main-test.js')))
191
200
  end
192
-
201
+
193
202
  end
194
-
203
+
195
204
  end
196
-
205
+
197
206
  end
198
207
 
199
208
 
@@ -213,11 +222,11 @@ describe BPM::Pipeline, "buildable_assets" do
213
222
 
214
223
  @project = BPM::Project.new home('hello_world')
215
224
  end
216
-
225
+
217
226
  subject do
218
227
  BPM::Pipeline.new(@project).buildable_assets
219
228
  end
220
-
229
+
221
230
  def project(*asset_names)
222
231
  Pathname.new File.join @project.root_path, *asset_names
223
232
  end
@@ -225,35 +234,34 @@ describe BPM::Pipeline, "buildable_assets" do
225
234
  def find_asset(logical_path)
226
235
  subject.find { |x| x.logical_path == logical_path }
227
236
  end
228
-
237
+
229
238
  it "should include bpm_libs.js" do
230
239
  asset = find_asset 'bpm_libs.js'
231
240
  asset.should_not be_nil
232
241
  asset.pathname.should == project('assets', 'bpm_libs.js')
233
242
  end
234
-
243
+
235
244
  it "should include bpm_styles.css" do
236
245
  asset = find_asset 'bpm_styles.css'
237
246
  asset.should_not be_nil
238
247
  asset.pathname.should == project('assets', 'bpm_styles.css')
239
248
  end
240
-
249
+
241
250
  it "should include custom_package assets" do
242
251
  asset = find_asset 'custom_package/assets/dummy.txt'
243
252
  asset.should_not be_nil
244
- asset.pathname.should == project('.bpm', 'packages', 'custom_package', 'assets', 'dummy.txt')
253
+ asset.pathname.should == project('vendor', 'custom_package', 'assets', 'dummy.txt')
245
254
  end
246
-
255
+
247
256
  it "should include installed package assets" do
248
257
  asset = find_asset 'core-test/extras/extra_file.html'
249
258
  asset.should_not be_nil
250
- asset.pathname.should == project('.bpm', 'packages', 'core-test', 'extras', 'extra_file.html')
259
+ asset.pathname.should == home('.bpm', 'gems', 'core-test-0.4.9', 'extras', 'extra_file.html')
251
260
  end
252
-
261
+
253
262
  it "should exclude libs" do
254
263
  asset = find_asset 'custom_package/assets/lib/main.js'
255
264
  asset.should be_nil
256
265
  end
257
-
266
+
258
267
  end
259
-