bpm 1.0.0.beta.8 → 1.0.0.beta.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/bpm.gemspec +2 -7
- data/lib/bpm/pipeline/generated_asset.rb +19 -21
- data/lib/bpm/pipeline/plugin_context.rb +7 -7
- data/lib/bpm/pipeline/plugin_processor.rb +11 -20
- data/lib/bpm/pipeline/transport_processor.rb +8 -13
- data/lib/bpm/pipeline.rb +47 -42
- data/lib/bpm/project_generator.rb +2 -2
- data/lib/bpm/version.rb +1 -1
- data/lib/bpm.rb +0 -3
- data/spec/cli/init_spec.rb +48 -48
- data/spec/cli/rebuild_spec.rb +30 -30
- data/spec/fixtures/projects/init_app/assets/bpm_libs.js +1 -1
- data/spec/fixtures/projects/init_app/assets/bpm_styles.css +1 -1
- data/spec/fixtures/projects/init_default/assets/bpm_libs.js +1 -1
- data/spec/fixtures/projects/init_default/assets/bpm_styles.css +1 -1
- data/spec/plugins/minifier_spec.rb +8 -8
- data/templates/project/index.html +0 -2
- data/templates/project/{app → lib}/main.js +0 -0
- metadata +24 -209
- data/.gitmodules +0 -3
- data/vendor/sprockets/.gitignore +0 -7
- data/vendor/sprockets/.travis.yml +0 -7
- data/vendor/sprockets/Gemfile +0 -2
- data/vendor/sprockets/LICENSE +0 -20
- data/vendor/sprockets/README.md +0 -22
- data/vendor/sprockets/Rakefile +0 -8
- data/vendor/sprockets/lib/sprockets/asset.rb +0 -198
- data/vendor/sprockets/lib/sprockets/asset_attributes.rb +0 -178
- data/vendor/sprockets/lib/sprockets/base.rb +0 -134
- data/vendor/sprockets/lib/sprockets/bundled_asset.rb +0 -249
- data/vendor/sprockets/lib/sprockets/cache/file_store.rb +0 -41
- data/vendor/sprockets/lib/sprockets/caching.rb +0 -126
- data/vendor/sprockets/lib/sprockets/charset_normalizer.rb +0 -41
- data/vendor/sprockets/lib/sprockets/context.rb +0 -221
- data/vendor/sprockets/lib/sprockets/digest.rb +0 -73
- data/vendor/sprockets/lib/sprockets/directive_processor.rb +0 -397
- data/vendor/sprockets/lib/sprockets/eco_template.rb +0 -38
- data/vendor/sprockets/lib/sprockets/ejs_template.rb +0 -37
- data/vendor/sprockets/lib/sprockets/engines.rb +0 -117
- data/vendor/sprockets/lib/sprockets/environment.rb +0 -94
- data/vendor/sprockets/lib/sprockets/errors.rb +0 -17
- data/vendor/sprockets/lib/sprockets/index.rb +0 -81
- data/vendor/sprockets/lib/sprockets/jst_processor.rb +0 -26
- data/vendor/sprockets/lib/sprockets/mime.rb +0 -38
- data/vendor/sprockets/lib/sprockets/processing.rb +0 -269
- data/vendor/sprockets/lib/sprockets/processor.rb +0 -32
- data/vendor/sprockets/lib/sprockets/safety_colons.rb +0 -28
- data/vendor/sprockets/lib/sprockets/server.rb +0 -270
- data/vendor/sprockets/lib/sprockets/static_asset.rb +0 -86
- data/vendor/sprockets/lib/sprockets/static_compilation.rb +0 -74
- data/vendor/sprockets/lib/sprockets/trail.rb +0 -123
- data/vendor/sprockets/lib/sprockets/utils.rb +0 -67
- data/vendor/sprockets/lib/sprockets/version.rb +0 -3
- data/vendor/sprockets/lib/sprockets.rb +0 -31
- data/vendor/sprockets/sprockets.gemspec +0 -30
- data/vendor/sprockets/test/fixtures/asset/POW.png +0 -0
- data/vendor/sprockets/test/fixtures/asset/application.js +0 -6
- data/vendor/sprockets/test/fixtures/asset/bar-utf8.css +0 -2
- data/vendor/sprockets/test/fixtures/asset/charset.css +0 -2
- data/vendor/sprockets/test/fixtures/asset/circle/a.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/circle/b.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/circle/c.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/compat.js +0 -4
- data/vendor/sprockets/test/fixtures/asset/constants.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/constants.yml +0 -1
- data/vendor/sprockets/test/fixtures/asset/default_mime_type.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/filename.js.erb +0 -1
- data/vendor/sprockets/test/fixtures/asset/foo-utf8.css +0 -2
- data/vendor/sprockets/test/fixtures/asset/included_header.js +0 -4
- data/vendor/sprockets/test/fixtures/asset/jquery.tmpl.min.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/mismatch.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/multiple.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/multipleengine.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/noengine.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/noformat.coffee +0 -1
- data/vendor/sprockets/test/fixtures/asset/one.css +0 -1
- data/vendor/sprockets/test/fixtures/asset/oneengine.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/project.css +0 -1
- data/vendor/sprockets/test/fixtures/asset/project.js.erb +0 -4
- data/vendor/sprockets/test/fixtures/asset/relative/include.js +0 -4
- data/vendor/sprockets/test/fixtures/asset/relative/require.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/relative/require_outside_path.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/require_self.css +0 -9
- data/vendor/sprockets/test/fixtures/asset/require_self_twice.css +0 -8
- data/vendor/sprockets/test/fixtures/asset/semicolons/bar.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/semicolons/index.js +0 -5
- data/vendor/sprockets/test/fixtures/asset/sprite.css.erb +0 -12
- data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/d.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/e.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all/b/c.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all/b.css +0 -2
- data/vendor/sprockets/test/fixtures/asset/tree/all/b.js.erb +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all/d/c.js.coffee +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all/d/e.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all_with_require.js +0 -7
- data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_directory.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_tree.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/tree/directory/application.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/tree/directory/bar.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/directory/foo.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/tree/application.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/tree/tree/bar.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/tree/foo.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/a/a.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/require_tree_with_logical_path.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/without_argument/a.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/without_argument/b.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/tree/without_argument/require_tree_without_argument.js +0 -1
- data/vendor/sprockets/test/fixtures/asset/two.css +0 -1
- data/vendor/sprockets/test/fixtures/asset/unicode.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/unknownexts.min.js +0 -2
- data/vendor/sprockets/test/fixtures/asset/users.js.erb.str +0 -4
- data/vendor/sprockets/test/fixtures/context/POW.png +0 -0
- data/vendor/sprockets/test/fixtures/context/application.js.yml +0 -3
- data/vendor/sprockets/test/fixtures/context/bar.js +0 -1
- data/vendor/sprockets/test/fixtures/context/foo.js +0 -2
- data/vendor/sprockets/test/fixtures/context/helpers.css.erb +0 -3
- data/vendor/sprockets/test/fixtures/context/properties.js.erb +0 -7
- data/vendor/sprockets/test/fixtures/context/require_glob.js +0 -1
- data/vendor/sprockets/test/fixtures/context/resolve_content_type.js.erb +0 -4
- data/vendor/sprockets/test/fixtures/context/sprite.css.embed +0 -3
- data/vendor/sprockets/test/fixtures/default/application.js.coffee +0 -4
- data/vendor/sprockets/test/fixtures/default/blank.gif +0 -0
- data/vendor/sprockets/test/fixtures/default/coffee/foo.coffee +0 -1
- data/vendor/sprockets/test/fixtures/default/coffee/index.js +0 -3
- data/vendor/sprockets/test/fixtures/default/empty +0 -0
- data/vendor/sprockets/test/fixtures/default/gallery.css.erb +0 -3
- data/vendor/sprockets/test/fixtures/default/gallery.js +0 -1
- data/vendor/sprockets/test/fixtures/default/goodbye.jst.eco +0 -1
- data/vendor/sprockets/test/fixtures/default/hello.jst.ejs +0 -1
- data/vendor/sprockets/test/fixtures/default/hello.txt +0 -1
- data/vendor/sprockets/test/fixtures/default/interpolation.js +0 -1
- data/vendor/sprockets/test/fixtures/default/missing_require.js +0 -1
- data/vendor/sprockets/test/fixtures/default/mobile/a.js +0 -1
- data/vendor/sprockets/test/fixtures/default/mobile/b.js +0 -1
- data/vendor/sprockets/test/fixtures/default/mobile/c.css +0 -1
- data/vendor/sprockets/test/fixtures/default/mobile/d.css +0 -1
- data/vendor/sprockets/test/fixtures/default/mobile/index.css +0 -3
- data/vendor/sprockets/test/fixtures/default/mobile/index.js +0 -1
- data/vendor/sprockets/test/fixtures/default/noreturn.js +0 -1
- data/vendor/sprockets/test/fixtures/default/project.js.coffee.erb +0 -2
- data/vendor/sprockets/test/fixtures/default/with_data_uri.css.erb +0 -3
- data/vendor/sprockets/test/fixtures/directives/code_before_comment +0 -3
- data/vendor/sprockets/test/fixtures/directives/comment_without_directives +0 -6
- data/vendor/sprockets/test/fixtures/directives/directive_word_splitting +0 -6
- data/vendor/sprockets/test/fixtures/directives/directives_after_header +0 -16
- data/vendor/sprockets/test/fixtures/directives/double_slash +0 -9
- data/vendor/sprockets/test/fixtures/directives/hash +0 -8
- data/vendor/sprockets/test/fixtures/directives/no_header +0 -2
- data/vendor/sprockets/test/fixtures/directives/slash_star +0 -10
- data/vendor/sprockets/test/fixtures/directives/slash_star_single +0 -4
- data/vendor/sprockets/test/fixtures/directives/space_between_directive_word +0 -2
- data/vendor/sprockets/test/fixtures/directives/triple_hash +0 -10
- data/vendor/sprockets/test/fixtures/encoding/ascii.js +0 -1
- data/vendor/sprockets/test/fixtures/encoding/ascii_utf8.js +0 -2
- data/vendor/sprockets/test/fixtures/encoding/utf16.js +0 -0
- data/vendor/sprockets/test/fixtures/encoding/utf8.js +0 -1
- data/vendor/sprockets/test/fixtures/encoding/utf8_bom.js +0 -1
- data/vendor/sprockets/test/fixtures/engines/hello.alert +0 -1
- data/vendor/sprockets/test/fixtures/engines/moo.js.str +0 -1
- data/vendor/sprockets/test/fixtures/public/compiled-digest-0aa2105d29558f3eb790d411d7d8fb66.js +0 -3
- data/vendor/sprockets/test/fixtures/public/compiled-digest-1c41eb0cf934a0c76babe875f982f9d1.js +0 -1
- data/vendor/sprockets/test/fixtures/server/app/javascripts/application.js +0 -5
- data/vendor/sprockets/test/fixtures/server/app/javascripts/bar.js +0 -1
- data/vendor/sprockets/test/fixtures/server/app/javascripts/foo.js +0 -1
- data/vendor/sprockets/test/fixtures/server/app/javascripts/hello.txt +0 -2
- data/vendor/sprockets/test/fixtures/server/app/javascripts/tree.js +0 -1
- data/vendor/sprockets/test/fixtures/server/vendor/javascripts/missing_require.js +0 -1
- data/vendor/sprockets/test/fixtures/server/vendor/stylesheets/missing_require.css +0 -1
- data/vendor/sprockets/test/sprockets_test.rb +0 -56
- data/vendor/sprockets/test/test_asset.rb +0 -699
- data/vendor/sprockets/test/test_asset_attributes.rb +0 -150
- data/vendor/sprockets/test/test_caching.rb +0 -62
- data/vendor/sprockets/test/test_context.rb +0 -115
- data/vendor/sprockets/test/test_directive_processor.rb +0 -124
- data/vendor/sprockets/test/test_encoding.rb +0 -65
- data/vendor/sprockets/test/test_engines.rb +0 -73
- data/vendor/sprockets/test/test_environment.rb +0 -587
- data/vendor/sprockets/test/test_server.rb +0 -227
data/spec/cli/init_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe "bpm init on existing directory" do
|
|
7
7
|
goto_home
|
8
8
|
set_host
|
9
9
|
start_fake(FakeGemServer.new)
|
10
|
-
|
10
|
+
|
11
11
|
@project_path = home("new_project").to_s
|
12
12
|
FileUtils.mkdir @project_path
|
13
13
|
cd @project_path
|
@@ -17,86 +17,86 @@ describe "bpm init on existing directory" do
|
|
17
17
|
def compare_to(project_name)
|
18
18
|
compare_contents @project_path, project_fixture(project_name)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should create files" do
|
22
22
|
bpm 'init' and wait
|
23
23
|
compare_to 'init_default'
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should create app files with --app option" do
|
27
27
|
bpm 'init', '--app' and wait
|
28
28
|
compare_to 'init_app'
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
it "should not overwrite existing project file" do
|
32
|
-
|
32
|
+
|
33
33
|
dummy_project = {
|
34
34
|
"name" => "custom_project",
|
35
35
|
"bpm" => "1.0.0"
|
36
36
|
}
|
37
|
-
|
37
|
+
|
38
38
|
File.open("new_project.json", 'w'){|f| f.print dummy_project.to_json }
|
39
|
-
|
39
|
+
|
40
40
|
bpm 'init', '--skip' and wait # skip, since we can't test the prompt
|
41
41
|
File.read("new_project.json").should == dummy_project.to_json
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should not overwrite existing project file (with different name)" do
|
45
|
-
|
45
|
+
|
46
46
|
dummy_project = {
|
47
47
|
"name" => "custom_project",
|
48
48
|
"bpm" => "1.0.0"
|
49
49
|
}
|
50
|
-
|
50
|
+
|
51
51
|
File.open("package.json", 'w'){|f| f.print dummy_project.to_json }
|
52
|
-
|
52
|
+
|
53
53
|
bpm 'init' and wait
|
54
54
|
exit_status.should be_success
|
55
|
-
|
55
|
+
|
56
56
|
File.read("package.json").should == dummy_project.to_json
|
57
57
|
File.exists?('new_project.json').should_not be_true
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "should update the project with app but save other settings" do
|
61
61
|
bpm 'init' and wait
|
62
|
-
|
62
|
+
|
63
63
|
# write a custom property
|
64
64
|
project_json = File.join @project_path, 'new_project.json'
|
65
65
|
json = JSON.load File.read(project_json)
|
66
66
|
json["custom_property"] = "I haz it"
|
67
67
|
File.open(project_json, 'w') { |fd| fd << json.to_json }
|
68
|
-
|
68
|
+
|
69
69
|
bpm 'init', '--app' and wait
|
70
|
-
|
70
|
+
|
71
71
|
json = JSON.load File.read(project_json)
|
72
72
|
json["custom_property"].should == "I haz it"
|
73
73
|
json["bpm:build"]["bpm_libs.js"].should_not be_nil
|
74
|
-
|
74
|
+
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it "should rebuild assets" do
|
78
|
-
|
78
|
+
|
79
79
|
bpm 'init' and wait
|
80
|
-
|
81
|
-
files = %w(bpm_libs.js bpm_styles.css).map do |fn|
|
80
|
+
|
81
|
+
files = %w(bpm_libs.js bpm_styles.css).map do |fn|
|
82
82
|
File.join(@project_path, 'assets', fn)
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
files.each do |path|
|
86
86
|
FileUtils.mkdir_p File.dirname(path)
|
87
87
|
File.open(path, 'w') { |fd| fd.print "Not valuable info!" }
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
bpm 'init' and wait
|
91
|
-
|
91
|
+
|
92
92
|
files.each do |path|
|
93
93
|
File.read(path).should_not include("Not valuable info!")
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it "should allow a name to be specified" do
|
98
98
|
bpm 'init', '--name=DifferentName' and wait
|
99
|
-
|
99
|
+
|
100
100
|
File.join(@project_path, "DifferentName.json").should exist
|
101
101
|
File.join(@project_path, "new_project.json").should_not exist
|
102
102
|
end
|
@@ -106,17 +106,17 @@ end
|
|
106
106
|
describe "bpm init on a non-existant directory" do
|
107
107
|
|
108
108
|
describe "normal" do
|
109
|
-
|
109
|
+
|
110
110
|
before do
|
111
111
|
goto_home
|
112
112
|
set_host
|
113
113
|
start_fake(FakeGemServer.new)
|
114
114
|
cd home
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
it "should create files" do
|
118
118
|
bpm 'init', 'BpmTest'
|
119
|
-
|
119
|
+
|
120
120
|
|
121
121
|
files = %w(LICENSE README.md index.html app/main.js BpmTest.json)
|
122
122
|
generated_files = %w(assets/bpm_libs.js assets/bpm_styles.css)
|
@@ -133,71 +133,71 @@ describe "bpm init on a non-existant directory" do
|
|
133
133
|
home('bpm_test', *file.split('/')).should exist
|
134
134
|
end
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
it "should allow a path to be specified" do
|
138
138
|
bpm 'init', 'DifferentLocation', '--name=BpmTest' and wait
|
139
|
-
|
139
|
+
|
140
140
|
home("DifferentLocation").should exist
|
141
141
|
home("DifferentLocation", "BpmTest.json").should exist
|
142
142
|
home("DifferentLocation", "DifferentLocation.json").should_not exist
|
143
143
|
home("bpm_test").should_not exist
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
describe "package templates" do
|
149
|
-
|
149
|
+
|
150
150
|
describe "with custom generator" do
|
151
|
-
|
151
|
+
|
152
152
|
before do
|
153
153
|
goto_home
|
154
154
|
set_host
|
155
155
|
start_fake(FakeGemServer.new)
|
156
156
|
end
|
157
|
-
|
157
|
+
|
158
158
|
it "should create custom files" do
|
159
159
|
bpm 'init', 'BpmTest', '--package=custom_generator'
|
160
|
-
|
160
|
+
|
161
161
|
files = %w(lib lib/main.js app.js BpmTest.json)
|
162
|
-
|
162
|
+
|
163
163
|
# output without coloration
|
164
164
|
output = stdout.read.gsub(/\e\[\d+m/,'')
|
165
|
-
|
165
|
+
|
166
166
|
files.each do |file|
|
167
167
|
output.should =~ /create\s+#{file}$/
|
168
168
|
home("bpm_test", file).should exist
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
171
|
+
|
172
172
|
it "should create custom app.js with explicit generator" do
|
173
173
|
bpm 'init', 'BpmTest', '--package=custom_generator' and wait
|
174
|
-
|
174
|
+
|
175
175
|
File.read(home("bpm_test", "app.js")).should == "require('BpmTest/main.js')\n"
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it "should create custom project.json without explicit generator" do
|
179
179
|
bpm 'init', 'BpmTest', '--package=core-test' and wait
|
180
|
-
|
180
|
+
|
181
181
|
File.read(home("bpm_test", "BpmTest.json")).should =~ /"core-test": "0.4.9"/
|
182
182
|
end
|
183
|
-
|
183
|
+
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
describe "without custom generator" do
|
187
|
-
|
187
|
+
|
188
188
|
before do
|
189
189
|
goto_home
|
190
190
|
set_host
|
191
191
|
start_fake(FakeGemServer.new)
|
192
192
|
cd home
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
it "should add package as a dependency even if it doesn't have custom generator" do
|
196
196
|
bpm 'init', 'BpmTest', '--package=jquery' and wait
|
197
|
-
|
197
|
+
|
198
198
|
File.read(home("bpm_test", "BpmTest.json")).should =~ /"dependencies": {\n\s+"jquery": "1.4.3"\n\s+}/
|
199
199
|
end
|
200
|
-
|
200
|
+
|
201
201
|
end
|
202
202
|
|
203
203
|
end
|
data/spec/cli/rebuild_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
describe 'bpm compile' do
|
5
|
-
|
5
|
+
|
6
6
|
describe 'complex dependencies' do
|
7
7
|
|
8
8
|
before do
|
@@ -16,13 +16,13 @@ describe 'bpm compile' do
|
|
16
16
|
it "should order the packages property with dependencies" do
|
17
17
|
bpm 'rebuild', '--mode=debug' # avoid minification.
|
18
18
|
wait
|
19
|
-
|
19
|
+
|
20
20
|
file = File.read home('hello2', 'assets', 'bpm_libs.js')
|
21
21
|
expected = <<EOF
|
22
22
|
/* ===========================================================================
|
23
23
|
BPM Combined Asset File
|
24
24
|
MANIFEST: a (1.0.0) b (1.0.0) c (1.0.0)
|
25
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
25
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
26
26
|
=========================================================================*/
|
27
27
|
|
28
28
|
// HELLO C
|
@@ -38,7 +38,7 @@ EOF
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe 'development dependencies' do
|
41
|
-
|
41
|
+
|
42
42
|
before do
|
43
43
|
goto_home
|
44
44
|
set_host
|
@@ -49,7 +49,7 @@ EOF
|
|
49
49
|
bpm 'fetch'
|
50
50
|
wait
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def test_include(does_include, build_file, *source_file)
|
54
54
|
contents_path = home('hello_dev', 'assets', build_file)
|
55
55
|
expected_path = home('hello_dev', *source_file)
|
@@ -59,70 +59,70 @@ EOF
|
|
59
59
|
else
|
60
60
|
File.read(contents_path).should_not include(File.read(expected_path))
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def test_development_dependencies(should_include)
|
66
|
-
|
66
|
+
|
67
67
|
js_reg = [
|
68
68
|
# fetch regular dependency
|
69
69
|
%w(.bpm packages spade lib main.js)
|
70
70
|
]
|
71
|
-
|
71
|
+
|
72
72
|
js_dev = [
|
73
73
|
# fetched development dependency
|
74
74
|
%w(.bpm packages uglify-js lib parse-js.js),
|
75
|
-
|
75
|
+
|
76
76
|
# required dependency of development dependency
|
77
77
|
%w(.bpm packages optparse lib optparse.js)
|
78
78
|
]
|
79
|
-
|
79
|
+
|
80
80
|
css_dev = [
|
81
81
|
# css of a locally installed development dependency
|
82
82
|
%w(packages style_package css some_style.css)
|
83
83
|
]
|
84
|
-
|
84
|
+
|
85
85
|
if should_include
|
86
86
|
expected_manifest = 'optparse (1.0.1) spade (0.5.0) style_package (1.0.0) uglify-js (1.0.4)'
|
87
87
|
else
|
88
88
|
expected_manifest = 'spade (0.5.0)'
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
# validate manifest
|
92
92
|
expected_manifest = "MANIFEST: #{expected_manifest}"
|
93
93
|
File.read(home('hello_dev', 'assets', 'bpm_libs.js')).should include(expected_manifest)
|
94
|
-
|
94
|
+
|
95
95
|
js_reg.each do |path|
|
96
96
|
test_include true, 'bpm_libs.js', *path
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
js_dev.each do |path|
|
100
100
|
test_include(should_include, 'bpm_libs.js', *path)
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
css_dev.each do |path|
|
104
104
|
test_include(should_include, 'bpm_styles.css', *path)
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
it "building in debug mode" do
|
109
109
|
bpm 'rebuild', '--mode=debug'
|
110
110
|
wait
|
111
|
-
|
111
|
+
|
112
112
|
test_development_dependencies true
|
113
113
|
end
|
114
114
|
|
115
115
|
it "building in production mode" do
|
116
116
|
bpm 'rebuild', '--mode=production'
|
117
117
|
wait
|
118
|
-
|
118
|
+
|
119
119
|
test_development_dependencies false
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
describe "update" do
|
125
|
-
|
125
|
+
|
126
126
|
before do
|
127
127
|
goto_home
|
128
128
|
set_host
|
@@ -130,7 +130,7 @@ EOF
|
|
130
130
|
FileUtils.cp_r project_fixture('needs_rake'), '.'
|
131
131
|
cd home('needs_rake')
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
it "should not update dependencies with no-update if they can be met" do
|
135
135
|
bpm 'fetch', 'rake', '--version=0.8.6' and wait
|
136
136
|
bpm 'rebuild', '--no-update', '--verbose'
|
@@ -153,11 +153,11 @@ EOF
|
|
153
153
|
out.should include('Fetching packages from remote...')
|
154
154
|
out.should include("'rake' (0.8.7)")
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
describe "error conditions" do
|
160
|
-
|
160
|
+
|
161
161
|
before do
|
162
162
|
goto_home
|
163
163
|
set_host
|
@@ -165,17 +165,17 @@ EOF
|
|
165
165
|
FileUtils.cp_r(project_fixture('hello_dev'), '.')
|
166
166
|
cd home('hello_dev')
|
167
167
|
end
|
168
|
-
|
168
|
+
|
169
169
|
it "should automatically recover if packages are damaged" do
|
170
|
-
bpm 'rebuild' and wait
|
170
|
+
bpm 'rebuild' and wait
|
171
171
|
out = stdout.read
|
172
172
|
out.should include('~ Building bpm_libs.js')
|
173
|
-
|
173
|
+
|
174
174
|
FileUtils.rm_r home('.bpm') # delete linked directories.
|
175
175
|
bpm 'rebuild', '--verbose', :track_stderr => true
|
176
176
|
err = stderr.read
|
177
177
|
err.should_not include('Could not find eligible')
|
178
178
|
end
|
179
179
|
end
|
180
|
-
|
180
|
+
|
181
181
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ===========================================================================
|
2
2
|
BPM Combined Asset File
|
3
3
|
MANIFEST: new_project ()
|
4
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
4
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
5
5
|
=========================================================================*/
|
6
6
|
// MINIFIED
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ===========================================================================
|
2
2
|
BPM Combined Asset File
|
3
3
|
MANIFEST: new_project ()
|
4
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
4
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
5
5
|
=========================================================================*/
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ===========================================================================
|
2
2
|
BPM Combined Asset File
|
3
3
|
MANIFEST: (none)
|
4
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
4
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
5
5
|
=========================================================================*/
|
6
6
|
// MINIFIED
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ===========================================================================
|
2
2
|
BPM Combined Asset File
|
3
3
|
MANIFEST: (none)
|
4
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
4
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
5
5
|
=========================================================================*/
|
@@ -7,26 +7,26 @@ describe BPM::Pipeline, 'minifier' do
|
|
7
7
|
set_host
|
8
8
|
reset_libgems bpm_dir.to_s
|
9
9
|
start_fake(FakeGemServer.new)
|
10
|
-
|
10
|
+
|
11
11
|
FileUtils.cp_r project_fixture('minitest'), '.'
|
12
12
|
cd home('minitest')
|
13
13
|
|
14
14
|
bpm 'rebuild'
|
15
15
|
wait
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
subject do
|
19
19
|
project = BPM::Project.new home('minitest')
|
20
20
|
BPM::Pipeline.new project, :production
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should wrap bpm_libs.js" do
|
24
24
|
asset = subject.find_asset 'bpm_libs.js'
|
25
25
|
expected = <<EOF
|
26
26
|
/* ===========================================================================
|
27
27
|
BPM Combined Asset File
|
28
28
|
MANIFEST: (none)
|
29
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
29
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
30
30
|
=========================================================================*/
|
31
31
|
//MINIFIED START
|
32
32
|
UGLY DUCK IS UGLYboston
|
@@ -45,7 +45,7 @@ EOF
|
|
45
45
|
/* ===========================================================================
|
46
46
|
BPM Combined Asset File
|
47
47
|
MANIFEST: minitest (2.0.0)
|
48
|
-
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
48
|
+
This file is generated automatically by the bpm (http://www.bpmjs.org)
|
49
49
|
=========================================================================*/
|
50
50
|
//MINIFIED START
|
51
51
|
UGLY DUCK IS UGLYsanfran
|
@@ -60,14 +60,14 @@ EOF
|
|
60
60
|
project = BPM::Project.new home('minitest')
|
61
61
|
BPM::Pipeline.new project, :production
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
it "should not wrap bpm_libs.js in debug mode" do
|
65
65
|
project = BPM::Project.new home('minitest')
|
66
66
|
pipeline = BPM::Pipeline.new project, :debug
|
67
67
|
asset = pipeline.find_asset 'minitest/app_package.js'
|
68
68
|
asset.to_s.should_not include('//MINIFIED START')
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
3
|
<link rel="stylesheet" href="assets/bpm_styles.css" type="text/css" media="screen" charset="utf-8" />
|
4
|
-
<link rel="stylesheet" href="assets/<%= name %>/bpm_styles.css" type="text/css" media="screen" charset="utf-8" />
|
5
4
|
|
6
5
|
<title><%= name %></title>
|
7
6
|
</head>
|
@@ -10,5 +9,4 @@
|
|
10
9
|
</body>
|
11
10
|
|
12
11
|
<script type="text/javascript" src="assets/bpm_libs.js"></script>
|
13
|
-
<script type="text/javascript" src="assets/<%= name %>/bpm_libs.js"></script>
|
14
12
|
</html>
|
File without changes
|