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.
Files changed (181) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +9 -0
  3. data/bpm.gemspec +2 -7
  4. data/lib/bpm/pipeline/generated_asset.rb +19 -21
  5. data/lib/bpm/pipeline/plugin_context.rb +7 -7
  6. data/lib/bpm/pipeline/plugin_processor.rb +11 -20
  7. data/lib/bpm/pipeline/transport_processor.rb +8 -13
  8. data/lib/bpm/pipeline.rb +47 -42
  9. data/lib/bpm/project_generator.rb +2 -2
  10. data/lib/bpm/version.rb +1 -1
  11. data/lib/bpm.rb +0 -3
  12. data/spec/cli/init_spec.rb +48 -48
  13. data/spec/cli/rebuild_spec.rb +30 -30
  14. data/spec/fixtures/projects/init_app/assets/bpm_libs.js +1 -1
  15. data/spec/fixtures/projects/init_app/assets/bpm_styles.css +1 -1
  16. data/spec/fixtures/projects/init_default/assets/bpm_libs.js +1 -1
  17. data/spec/fixtures/projects/init_default/assets/bpm_styles.css +1 -1
  18. data/spec/plugins/minifier_spec.rb +8 -8
  19. data/templates/project/index.html +0 -2
  20. data/templates/project/{app → lib}/main.js +0 -0
  21. metadata +24 -209
  22. data/.gitmodules +0 -3
  23. data/vendor/sprockets/.gitignore +0 -7
  24. data/vendor/sprockets/.travis.yml +0 -7
  25. data/vendor/sprockets/Gemfile +0 -2
  26. data/vendor/sprockets/LICENSE +0 -20
  27. data/vendor/sprockets/README.md +0 -22
  28. data/vendor/sprockets/Rakefile +0 -8
  29. data/vendor/sprockets/lib/sprockets/asset.rb +0 -198
  30. data/vendor/sprockets/lib/sprockets/asset_attributes.rb +0 -178
  31. data/vendor/sprockets/lib/sprockets/base.rb +0 -134
  32. data/vendor/sprockets/lib/sprockets/bundled_asset.rb +0 -249
  33. data/vendor/sprockets/lib/sprockets/cache/file_store.rb +0 -41
  34. data/vendor/sprockets/lib/sprockets/caching.rb +0 -126
  35. data/vendor/sprockets/lib/sprockets/charset_normalizer.rb +0 -41
  36. data/vendor/sprockets/lib/sprockets/context.rb +0 -221
  37. data/vendor/sprockets/lib/sprockets/digest.rb +0 -73
  38. data/vendor/sprockets/lib/sprockets/directive_processor.rb +0 -397
  39. data/vendor/sprockets/lib/sprockets/eco_template.rb +0 -38
  40. data/vendor/sprockets/lib/sprockets/ejs_template.rb +0 -37
  41. data/vendor/sprockets/lib/sprockets/engines.rb +0 -117
  42. data/vendor/sprockets/lib/sprockets/environment.rb +0 -94
  43. data/vendor/sprockets/lib/sprockets/errors.rb +0 -17
  44. data/vendor/sprockets/lib/sprockets/index.rb +0 -81
  45. data/vendor/sprockets/lib/sprockets/jst_processor.rb +0 -26
  46. data/vendor/sprockets/lib/sprockets/mime.rb +0 -38
  47. data/vendor/sprockets/lib/sprockets/processing.rb +0 -269
  48. data/vendor/sprockets/lib/sprockets/processor.rb +0 -32
  49. data/vendor/sprockets/lib/sprockets/safety_colons.rb +0 -28
  50. data/vendor/sprockets/lib/sprockets/server.rb +0 -270
  51. data/vendor/sprockets/lib/sprockets/static_asset.rb +0 -86
  52. data/vendor/sprockets/lib/sprockets/static_compilation.rb +0 -74
  53. data/vendor/sprockets/lib/sprockets/trail.rb +0 -123
  54. data/vendor/sprockets/lib/sprockets/utils.rb +0 -67
  55. data/vendor/sprockets/lib/sprockets/version.rb +0 -3
  56. data/vendor/sprockets/lib/sprockets.rb +0 -31
  57. data/vendor/sprockets/sprockets.gemspec +0 -30
  58. data/vendor/sprockets/test/fixtures/asset/POW.png +0 -0
  59. data/vendor/sprockets/test/fixtures/asset/application.js +0 -6
  60. data/vendor/sprockets/test/fixtures/asset/bar-utf8.css +0 -2
  61. data/vendor/sprockets/test/fixtures/asset/charset.css +0 -2
  62. data/vendor/sprockets/test/fixtures/asset/circle/a.js +0 -2
  63. data/vendor/sprockets/test/fixtures/asset/circle/b.js +0 -2
  64. data/vendor/sprockets/test/fixtures/asset/circle/c.js +0 -2
  65. data/vendor/sprockets/test/fixtures/asset/compat.js +0 -4
  66. data/vendor/sprockets/test/fixtures/asset/constants.js +0 -2
  67. data/vendor/sprockets/test/fixtures/asset/constants.yml +0 -1
  68. data/vendor/sprockets/test/fixtures/asset/default_mime_type.js +0 -1
  69. data/vendor/sprockets/test/fixtures/asset/filename.js.erb +0 -1
  70. data/vendor/sprockets/test/fixtures/asset/foo-utf8.css +0 -2
  71. data/vendor/sprockets/test/fixtures/asset/included_header.js +0 -4
  72. data/vendor/sprockets/test/fixtures/asset/jquery.tmpl.min.js +0 -1
  73. data/vendor/sprockets/test/fixtures/asset/mismatch.js +0 -1
  74. data/vendor/sprockets/test/fixtures/asset/multiple.js +0 -2
  75. data/vendor/sprockets/test/fixtures/asset/multipleengine.js +0 -1
  76. data/vendor/sprockets/test/fixtures/asset/noengine.js +0 -1
  77. data/vendor/sprockets/test/fixtures/asset/noformat.coffee +0 -1
  78. data/vendor/sprockets/test/fixtures/asset/one.css +0 -1
  79. data/vendor/sprockets/test/fixtures/asset/oneengine.js +0 -1
  80. data/vendor/sprockets/test/fixtures/asset/project.css +0 -1
  81. data/vendor/sprockets/test/fixtures/asset/project.js.erb +0 -4
  82. data/vendor/sprockets/test/fixtures/asset/relative/include.js +0 -4
  83. data/vendor/sprockets/test/fixtures/asset/relative/require.js +0 -1
  84. data/vendor/sprockets/test/fixtures/asset/relative/require_outside_path.js +0 -1
  85. data/vendor/sprockets/test/fixtures/asset/require_self.css +0 -9
  86. data/vendor/sprockets/test/fixtures/asset/require_self_twice.css +0 -8
  87. data/vendor/sprockets/test/fixtures/asset/semicolons/bar.js +0 -1
  88. data/vendor/sprockets/test/fixtures/asset/semicolons/index.js +0 -5
  89. data/vendor/sprockets/test/fixtures/asset/sprite.css.erb +0 -12
  90. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/d.js +0 -2
  91. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/e.js +0 -1
  92. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c.js +0 -1
  93. data/vendor/sprockets/test/fixtures/asset/tree/all/b.css +0 -2
  94. data/vendor/sprockets/test/fixtures/asset/tree/all/b.js.erb +0 -1
  95. data/vendor/sprockets/test/fixtures/asset/tree/all/d/c.js.coffee +0 -1
  96. data/vendor/sprockets/test/fixtures/asset/tree/all/d/e.js +0 -1
  97. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require.js +0 -7
  98. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_directory.js +0 -1
  99. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_tree.js +0 -2
  100. data/vendor/sprockets/test/fixtures/asset/tree/directory/application.js +0 -2
  101. data/vendor/sprockets/test/fixtures/asset/tree/directory/bar.js +0 -1
  102. data/vendor/sprockets/test/fixtures/asset/tree/directory/foo.js +0 -1
  103. data/vendor/sprockets/test/fixtures/asset/tree/tree/application.js +0 -2
  104. data/vendor/sprockets/test/fixtures/asset/tree/tree/bar.js +0 -1
  105. data/vendor/sprockets/test/fixtures/asset/tree/tree/foo.js +0 -1
  106. data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/a/a.js +0 -1
  107. data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/require_tree_with_logical_path.js +0 -1
  108. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/a.js +0 -1
  109. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/b.js +0 -1
  110. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/require_tree_without_argument.js +0 -1
  111. data/vendor/sprockets/test/fixtures/asset/two.css +0 -1
  112. data/vendor/sprockets/test/fixtures/asset/unicode.js +0 -2
  113. data/vendor/sprockets/test/fixtures/asset/unknownexts.min.js +0 -2
  114. data/vendor/sprockets/test/fixtures/asset/users.js.erb.str +0 -4
  115. data/vendor/sprockets/test/fixtures/context/POW.png +0 -0
  116. data/vendor/sprockets/test/fixtures/context/application.js.yml +0 -3
  117. data/vendor/sprockets/test/fixtures/context/bar.js +0 -1
  118. data/vendor/sprockets/test/fixtures/context/foo.js +0 -2
  119. data/vendor/sprockets/test/fixtures/context/helpers.css.erb +0 -3
  120. data/vendor/sprockets/test/fixtures/context/properties.js.erb +0 -7
  121. data/vendor/sprockets/test/fixtures/context/require_glob.js +0 -1
  122. data/vendor/sprockets/test/fixtures/context/resolve_content_type.js.erb +0 -4
  123. data/vendor/sprockets/test/fixtures/context/sprite.css.embed +0 -3
  124. data/vendor/sprockets/test/fixtures/default/application.js.coffee +0 -4
  125. data/vendor/sprockets/test/fixtures/default/blank.gif +0 -0
  126. data/vendor/sprockets/test/fixtures/default/coffee/foo.coffee +0 -1
  127. data/vendor/sprockets/test/fixtures/default/coffee/index.js +0 -3
  128. data/vendor/sprockets/test/fixtures/default/empty +0 -0
  129. data/vendor/sprockets/test/fixtures/default/gallery.css.erb +0 -3
  130. data/vendor/sprockets/test/fixtures/default/gallery.js +0 -1
  131. data/vendor/sprockets/test/fixtures/default/goodbye.jst.eco +0 -1
  132. data/vendor/sprockets/test/fixtures/default/hello.jst.ejs +0 -1
  133. data/vendor/sprockets/test/fixtures/default/hello.txt +0 -1
  134. data/vendor/sprockets/test/fixtures/default/interpolation.js +0 -1
  135. data/vendor/sprockets/test/fixtures/default/missing_require.js +0 -1
  136. data/vendor/sprockets/test/fixtures/default/mobile/a.js +0 -1
  137. data/vendor/sprockets/test/fixtures/default/mobile/b.js +0 -1
  138. data/vendor/sprockets/test/fixtures/default/mobile/c.css +0 -1
  139. data/vendor/sprockets/test/fixtures/default/mobile/d.css +0 -1
  140. data/vendor/sprockets/test/fixtures/default/mobile/index.css +0 -3
  141. data/vendor/sprockets/test/fixtures/default/mobile/index.js +0 -1
  142. data/vendor/sprockets/test/fixtures/default/noreturn.js +0 -1
  143. data/vendor/sprockets/test/fixtures/default/project.js.coffee.erb +0 -2
  144. data/vendor/sprockets/test/fixtures/default/with_data_uri.css.erb +0 -3
  145. data/vendor/sprockets/test/fixtures/directives/code_before_comment +0 -3
  146. data/vendor/sprockets/test/fixtures/directives/comment_without_directives +0 -6
  147. data/vendor/sprockets/test/fixtures/directives/directive_word_splitting +0 -6
  148. data/vendor/sprockets/test/fixtures/directives/directives_after_header +0 -16
  149. data/vendor/sprockets/test/fixtures/directives/double_slash +0 -9
  150. data/vendor/sprockets/test/fixtures/directives/hash +0 -8
  151. data/vendor/sprockets/test/fixtures/directives/no_header +0 -2
  152. data/vendor/sprockets/test/fixtures/directives/slash_star +0 -10
  153. data/vendor/sprockets/test/fixtures/directives/slash_star_single +0 -4
  154. data/vendor/sprockets/test/fixtures/directives/space_between_directive_word +0 -2
  155. data/vendor/sprockets/test/fixtures/directives/triple_hash +0 -10
  156. data/vendor/sprockets/test/fixtures/encoding/ascii.js +0 -1
  157. data/vendor/sprockets/test/fixtures/encoding/ascii_utf8.js +0 -2
  158. data/vendor/sprockets/test/fixtures/encoding/utf16.js +0 -0
  159. data/vendor/sprockets/test/fixtures/encoding/utf8.js +0 -1
  160. data/vendor/sprockets/test/fixtures/encoding/utf8_bom.js +0 -1
  161. data/vendor/sprockets/test/fixtures/engines/hello.alert +0 -1
  162. data/vendor/sprockets/test/fixtures/engines/moo.js.str +0 -1
  163. data/vendor/sprockets/test/fixtures/public/compiled-digest-0aa2105d29558f3eb790d411d7d8fb66.js +0 -3
  164. data/vendor/sprockets/test/fixtures/public/compiled-digest-1c41eb0cf934a0c76babe875f982f9d1.js +0 -1
  165. data/vendor/sprockets/test/fixtures/server/app/javascripts/application.js +0 -5
  166. data/vendor/sprockets/test/fixtures/server/app/javascripts/bar.js +0 -1
  167. data/vendor/sprockets/test/fixtures/server/app/javascripts/foo.js +0 -1
  168. data/vendor/sprockets/test/fixtures/server/app/javascripts/hello.txt +0 -2
  169. data/vendor/sprockets/test/fixtures/server/app/javascripts/tree.js +0 -1
  170. data/vendor/sprockets/test/fixtures/server/vendor/javascripts/missing_require.js +0 -1
  171. data/vendor/sprockets/test/fixtures/server/vendor/stylesheets/missing_require.css +0 -1
  172. data/vendor/sprockets/test/sprockets_test.rb +0 -56
  173. data/vendor/sprockets/test/test_asset.rb +0 -699
  174. data/vendor/sprockets/test/test_asset_attributes.rb +0 -150
  175. data/vendor/sprockets/test/test_caching.rb +0 -62
  176. data/vendor/sprockets/test/test_context.rb +0 -115
  177. data/vendor/sprockets/test/test_directive_processor.rb +0 -124
  178. data/vendor/sprockets/test/test_encoding.rb +0 -65
  179. data/vendor/sprockets/test/test_engines.rb +0 -73
  180. data/vendor/sprockets/test/test_environment.rb +0 -587
  181. data/vendor/sprockets/test/test_server.rb +0 -227
@@ -1,227 +0,0 @@
1
- require "sprockets_test"
2
-
3
- require 'rack/builder'
4
- require 'rack/test'
5
-
6
- class TestServer < Sprockets::TestCase
7
- include Rack::Test::Methods
8
-
9
- def setup
10
- @env = Sprockets::Environment.new
11
- @env.append_path(fixture_path("server/app/javascripts"))
12
- @env.append_path(fixture_path("server/vendor/javascripts"))
13
- @env.append_path(fixture_path("server/vendor/stylesheets"))
14
- end
15
-
16
- def default_app
17
- env = @env
18
-
19
- Rack::Builder.new do
20
- map "/assets" do
21
- run env
22
- end
23
-
24
- map "/cached/javascripts" do
25
- run env.index
26
- end
27
- end
28
- end
29
-
30
- def app
31
- @app ||= default_app
32
- end
33
-
34
- test "serve single source file" do
35
- get "/assets/foo.js"
36
- assert_equal "var foo;\n", last_response.body
37
- end
38
-
39
- test "serve single source file body" do
40
- get "/assets/foo.js?body=1"
41
- assert_equal 200, last_response.status
42
- assert_equal "var foo;\n", last_response.body
43
- assert_equal "9", last_response.headers['Content-Length']
44
- end
45
-
46
- test "serve single source file from indexed environment" do
47
- get "/cached/javascripts/foo.js"
48
- assert_equal "var foo;\n", last_response.body
49
- end
50
-
51
- test "serve source with dependencies" do
52
- get "/assets/application.js"
53
- assert_equal "var foo;\n\n(function() {\n application.boot();\n})();\n",
54
- last_response.body
55
- end
56
-
57
- test "serve source file body that has dependencies" do
58
- get "/assets/application.js?body=true"
59
- assert_equal 200, last_response.status
60
- assert_equal "\n(function() {\n application.boot();\n})();\n",
61
- last_response.body
62
- assert_equal "43", last_response.headers['Content-Length']
63
- end
64
-
65
- test "serve source with content type headers" do
66
- get "/assets/application.js"
67
- assert_equal "application/javascript", last_response.headers['Content-Type']
68
- end
69
-
70
- test "serve source with etag headers" do
71
- digest = @env['application.js'].digest
72
-
73
- get "/assets/application.js"
74
- assert_equal "\"#{digest}\"",
75
- last_response.headers['ETag']
76
- end
77
-
78
- test "updated file updates the last modified header" do
79
- time = Time.now
80
- path = fixture_path "server/app/javascripts/foo.js"
81
-
82
- sandbox path do
83
- File.utime(time, time, path)
84
-
85
- get "/assets/application.js"
86
- time_before_modifying = last_response.headers['Last-Modified']
87
-
88
- get "/assets/application.js"
89
- time_after_modifying = last_response.headers['Last-Modified']
90
-
91
- assert_equal time_before_modifying, time_after_modifying
92
-
93
- mtime = Time.now + 60
94
- File.open(path, 'w') { |f| f.write "(change)" }
95
- File.utime(mtime, mtime, path)
96
-
97
- get "/assets/application.js"
98
- time_after_modifying = last_response.headers['Last-Modified']
99
-
100
- assert_not_equal time_before_modifying, time_after_modifying
101
- end
102
- end
103
-
104
- test "file updates do not update last modified header for indexed environments" do
105
- time = Time.now
106
- path = fixture_path "server/app/javascripts/foo.js"
107
- File.utime(time, time, path)
108
-
109
- get "/cached/javascripts/application.js"
110
- time_before_touching = last_response.headers['Last-Modified']
111
-
112
- get "/cached/javascripts/application.js"
113
- time_after_touching = last_response.headers['Last-Modified']
114
-
115
- assert_equal time_before_touching, time_after_touching
116
-
117
- mtime = Time.now + 60
118
- File.utime(mtime, mtime, path)
119
-
120
- get "/cached/javascripts/application.js"
121
- time_after_touching = last_response.headers['Last-Modified']
122
-
123
- assert_equal time_before_touching, time_after_touching
124
- end
125
-
126
- test "not modified response when headers match" do
127
- get "/assets/application.js"
128
- assert_equal 200, last_response.status
129
-
130
- path = fixture_path "server/app/javascripts/bar.js"
131
- mtime = Time.now + 1
132
- File.utime(mtime, mtime, path)
133
-
134
- get "/assets/bar.js", {},
135
- 'HTTP_IF_MODIFIED_SINCE' =>
136
- File.mtime(fixture_path("server/app/javascripts/bar.js")).httpdate
137
-
138
- assert_equal 304, last_response.status
139
- assert_equal nil, last_response.headers['Content-Type']
140
- assert_equal nil, last_response.headers['Content-Length']
141
- end
142
-
143
- test "not modified partial response when etags match" do
144
- get "/assets/application.js?body=1"
145
- assert_equal 200, last_response.status
146
- etag = last_response.headers['ETag']
147
-
148
- get "/assets/application.js?body=1", {},
149
- 'HTTP_IF_NONE_MATCH' => etag
150
-
151
- assert_equal 304, last_response.status
152
- assert_equal nil, last_response.headers['Content-Type']
153
- assert_equal nil, last_response.headers['Content-Length']
154
- end
155
-
156
- test "if sources didnt change the server shouldnt rebundle" do
157
- get "/assets/application.js"
158
- asset_before = @env["application.js"]
159
- assert asset_before
160
-
161
- get "/assets/application.js"
162
- asset_after = @env["application.js"]
163
- assert asset_after
164
-
165
- assert asset_before.equal?(asset_after)
166
- end
167
-
168
- test "fingerprint digest sets expiration to the future" do
169
- get "/assets/application.js"
170
- digest = last_response.headers['ETag'][/"(.+)"/, 1]
171
-
172
- get "/assets/application-#{digest}.js"
173
- assert_match %r{max-age}, last_response.headers['Cache-Control']
174
- end
175
-
176
- test "missing source" do
177
- get "/assets/none.js"
178
- assert_equal 404, last_response.status
179
- assert_equal "pass", last_response.headers['X-Cascade']
180
- end
181
-
182
- test "re-throw JS exceptions in the browser" do
183
- get "/assets/missing_require.js"
184
- assert_equal 200, last_response.status
185
- assert_equal "throw Error(\"Sprockets::FileNotFound: couldn't find file 'notfound'\\n (in #{fixture_path("server/vendor/javascripts/missing_require.js")}:1)\")", last_response.body
186
- end
187
-
188
- test "display CSS exceptions in the browser" do
189
- get "/assets/missing_require.css"
190
- assert_equal 200, last_response.status
191
- assert_match %r{content: ".*?Sprockets::FileNotFound}, last_response.body
192
- end
193
-
194
- test "illegal require outside load path" do
195
- get "/assets/../config/passwd"
196
- assert_equal 403, last_response.status
197
- end
198
-
199
- test "add new source to tree" do
200
- filename = fixture_path("server/app/javascripts/baz.js")
201
-
202
- sandbox filename do
203
- get "/assets/tree.js"
204
- assert_equal "var foo;\n\n(function() {\n application.boot();\n})();\nvar bar;\n",
205
- last_response.body
206
-
207
- File.open(filename, "w") do |f|
208
- f.puts "var baz;"
209
- end
210
-
211
- path = fixture_path "server/app/javascripts"
212
- mtime = Time.now + 60
213
- File.utime(mtime, mtime, path)
214
-
215
- get "/assets/tree.js"
216
- assert_equal "var foo;\n\n(function() {\n application.boot();\n})();\nvar bar;\nvar baz;\n",
217
- last_response.body
218
- end
219
- end
220
-
221
- test "serving static assets" do
222
- get "/assets/hello.txt"
223
- assert_equal 200, last_response.status
224
- assert_equal "text/plain", last_response.content_type
225
- assert_equal File.read(fixture_path("server/app/javascripts/hello.txt")), last_response.body
226
- end
227
- end