bpm 0.1.4 → 1.0.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. data/CHANGELOG.md +20 -0
  2. data/README.md +1 -1
  3. data/TODO.md +90 -2
  4. data/bpm.gemspec +3 -3
  5. data/lib/bpm/cli/base.rb +103 -52
  6. data/lib/bpm/errors.rb +51 -0
  7. data/lib/bpm/init_generator.rb +1 -8
  8. data/lib/bpm/libgems_ext/libgems.rb +9 -0
  9. data/lib/bpm/local.rb +6 -11
  10. data/lib/bpm/package.rb +272 -178
  11. data/lib/bpm/pipeline/generated_asset.rb +88 -28
  12. data/lib/bpm/pipeline/plugin_asset.rb +8 -2
  13. data/lib/bpm/pipeline/source_url_processor.rb +16 -0
  14. data/lib/bpm/pipeline/transport_processor.rb +5 -3
  15. data/lib/bpm/pipeline.rb +33 -23
  16. data/lib/bpm/project.rb +492 -167
  17. data/lib/bpm/project_generator.rb +14 -1
  18. data/lib/bpm/remote.rb +6 -4
  19. data/lib/bpm/server.rb +4 -15
  20. data/lib/bpm/version.rb +2 -1
  21. data/lib/bpm.rb +2 -0
  22. data/man/bpm-add.1.ronn +22 -0
  23. data/man/bpm-build.1.ronn +22 -0
  24. data/man/bpm-compile.1.ronn +23 -0
  25. data/man/bpm-config.7.ronn +21 -0
  26. data/man/bpm-fetch.1.ronn +22 -0
  27. data/man/bpm-fetched.1.ronn +22 -0
  28. data/man/bpm-init.1.ronn +22 -0
  29. data/man/bpm-list.1.ronn +22 -0
  30. data/man/bpm-login.1.ronn +22 -0
  31. data/man/bpm-new.1.ronn +22 -0
  32. data/man/bpm-owner.1.ronn +22 -0
  33. data/man/bpm-preview.1.ronn +22 -0
  34. data/man/bpm-push.1.ronn +22 -0
  35. data/man/bpm-remove.1.ronn +22 -0
  36. data/man/bpm-unpack.1.ronn +22 -0
  37. data/man/bpm-yank.1.ronn +22 -0
  38. data/man/bpm.1.ronn +31 -0
  39. data/spec/cli/add_spec.rb +26 -7
  40. data/spec/cli/fetch_spec.rb +15 -6
  41. data/spec/cli/init_spec.rb +165 -25
  42. data/spec/cli/{build_spec.rb → pack_spec.rb} +9 -10
  43. data/spec/cli/push_spec.rb +4 -4
  44. data/spec/cli/rebuild_spec.rb +181 -0
  45. data/spec/cli/remove_spec.rb +3 -4
  46. data/spec/cli/unpack_spec.rb +6 -6
  47. data/spec/fixtures/gems/core-test-0.4.9.bpkg +0 -0
  48. data/spec/fixtures/{core-test-0.4.9.bpkg → gems/uglify-js-1.0.4.bpkg} +0 -0
  49. data/spec/fixtures/packages/core-test/extras/extra_file.html +3 -0
  50. data/spec/fixtures/packages/core-test/index.html +3 -0
  51. data/spec/fixtures/{core-test → packages/core-test}/package.json +9 -3
  52. data/spec/fixtures/packages/invalid_json/package.json +3 -0
  53. data/spec/fixtures/packages/uglify-js/README.html +825 -0
  54. data/spec/fixtures/packages/uglify-js/README.org +431 -0
  55. data/spec/fixtures/packages/uglify-js/bin/uglifyjs +305 -0
  56. data/spec/fixtures/packages/uglify-js/docstyle.css +75 -0
  57. data/spec/fixtures/packages/uglify-js/lib/parse-js.js +1 -0
  58. data/spec/fixtures/packages/uglify-js/lib/process.js +1 -0
  59. data/spec/fixtures/packages/uglify-js/lib/squeeze-more.js +1 -0
  60. data/spec/fixtures/packages/uglify-js/package.json +27 -0
  61. data/spec/fixtures/packages/uglify-js/plugins/minifier.js +6 -0
  62. data/spec/fixtures/packages/uglify-js/uglify-js.js +17 -0
  63. data/spec/fixtures/projects/hello2/README.md +21 -0
  64. data/{templates/init → spec/fixtures/projects/hello2}/assets/bpm_packages.js +6 -1
  65. data/{templates/init → spec/fixtures/projects/hello2}/assets/bpm_styles.css +1 -1
  66. data/spec/fixtures/projects/hello2/hello2.json +16 -0
  67. data/spec/fixtures/projects/hello2/index.html +13 -0
  68. data/spec/fixtures/projects/hello2/packages/a/lib/main.js +2 -0
  69. data/spec/fixtures/projects/hello2/packages/a/package.json +17 -0
  70. data/spec/fixtures/projects/hello2/packages/b/lib/main.js +2 -0
  71. data/spec/fixtures/projects/hello2/packages/b/package.json +17 -0
  72. data/spec/fixtures/projects/hello2/packages/c/lib/main.js +2 -0
  73. data/spec/fixtures/projects/hello2/packages/c/package.json +16 -0
  74. data/spec/fixtures/projects/hello_dev/LICENSE +19 -0
  75. data/spec/fixtures/projects/hello_dev/README.md +21 -0
  76. data/spec/fixtures/projects/hello_dev/app/main.js +6 -0
  77. data/spec/fixtures/projects/hello_dev/assets/bpm_libs.js +5 -0
  78. data/spec/fixtures/projects/hello_dev/assets/bpm_styles.css +6 -0
  79. data/spec/fixtures/projects/hello_dev/css/main.css +1 -0
  80. data/spec/fixtures/projects/hello_dev/hello_dev.json +25 -0
  81. data/spec/fixtures/projects/hello_dev/index.html +14 -0
  82. data/spec/fixtures/projects/hello_dev/packages/style_package/css/some_style.css +3 -0
  83. data/spec/fixtures/{minitest/minitest.json → projects/hello_dev/packages/style_package/package.json} +5 -9
  84. data/spec/fixtures/projects/hello_world/LICENSE +19 -0
  85. data/spec/fixtures/projects/hello_world/assets/bpm_packages.js +1 -0
  86. data/spec/fixtures/projects/hello_world/assets/bpm_styles.css +1 -0
  87. data/spec/fixtures/projects/hello_world/custom_dir/custom.js +1 -0
  88. data/spec/fixtures/projects/hello_world/hello_world.json +41 -0
  89. data/spec/fixtures/projects/hello_world/lib/another.js +1 -0
  90. data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/package.json +5 -2
  91. data/spec/fixtures/projects/hello_world/vendor/lib/something.js +1 -0
  92. data/spec/fixtures/projects/init_app/assets/bpm_libs.js +6 -0
  93. data/spec/fixtures/projects/init_app/assets/bpm_styles.css +5 -0
  94. data/spec/fixtures/projects/init_app/assets/new_project/bpm_libs.js +6 -0
  95. data/spec/fixtures/projects/init_app/assets/new_project/bpm_styles.css +5 -0
  96. data/spec/fixtures/projects/init_app/new_project.json +27 -0
  97. data/spec/fixtures/projects/init_default/assets/bpm_libs.js +6 -0
  98. data/spec/fixtures/projects/init_default/assets/bpm_styles.css +5 -0
  99. data/spec/fixtures/projects/init_default/new_project.json +15 -0
  100. data/spec/fixtures/projects/minitest/minitest.json +26 -0
  101. data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/package.json +1 -1
  102. data/spec/fixtures/projects/needs_rake/needs_rake.json +7 -0
  103. data/spec/fixtures/{transporter → projects/transporter}/packages/transport/package.json +1 -1
  104. data/spec/package_spec.rb +343 -315
  105. data/spec/pipeline_spec.rb +89 -71
  106. data/spec/plugins/minifier_spec.rb +25 -16
  107. data/spec/plugins/transport_spec.rb +1 -1
  108. data/spec/project_spec.rb +97 -34
  109. data/spec/spec_helper.rb +41 -0
  110. data/spec/support/fake_gem_server.rb +8 -4
  111. data/spec/support/path.rb +8 -0
  112. data/spec/support/project.rb +50 -17
  113. data/templates/init/project.json +12 -14
  114. data/templates/project/LICENSE +1 -1
  115. data/templates/project/app/main.js +6 -0
  116. data/templates/project/css/main.css +1 -0
  117. data/templates/project/index.html +4 -3
  118. data/vendor/sprockets/.travis.yml +3 -2
  119. data/vendor/sprockets/Gemfile +0 -6
  120. data/vendor/sprockets/lib/sprockets/asset.rb +7 -12
  121. data/vendor/sprockets/lib/sprockets/asset_attributes.rb +70 -53
  122. data/vendor/sprockets/lib/sprockets/base.rb +1 -14
  123. data/vendor/sprockets/lib/sprockets/bundled_asset.rb +72 -45
  124. data/vendor/sprockets/lib/sprockets/caching.rb +28 -23
  125. data/vendor/sprockets/lib/sprockets/context.rb +56 -26
  126. data/vendor/sprockets/lib/sprockets/directive_processor.rb +21 -4
  127. data/vendor/sprockets/lib/sprockets/eco_template.rb +3 -4
  128. data/vendor/sprockets/lib/sprockets/ejs_template.rb +3 -4
  129. data/vendor/sprockets/lib/sprockets/engines.rb +26 -1
  130. data/vendor/sprockets/lib/sprockets/environment.rb +2 -1
  131. data/vendor/sprockets/lib/sprockets/index.rb +1 -0
  132. data/vendor/sprockets/lib/sprockets/mime.rb +38 -0
  133. data/vendor/sprockets/lib/sprockets/processing.rb +4 -45
  134. data/vendor/sprockets/lib/sprockets/static_asset.rb +5 -6
  135. data/vendor/sprockets/lib/sprockets/static_compilation.rb +4 -12
  136. data/vendor/sprockets/lib/sprockets/trail.rb +2 -1
  137. data/vendor/sprockets/test/fixtures/default/blank.gif +0 -0
  138. data/vendor/sprockets/test/fixtures/default/with_data_uri.css.erb +3 -0
  139. data/vendor/sprockets/test/test_asset.rb +121 -15
  140. data/vendor/sprockets/test/test_asset_attributes.rb +85 -21
  141. data/vendor/sprockets/test/test_environment.rb +13 -36
  142. metadata +564 -444
  143. data/spec/cli/new_spec.rb +0 -118
  144. data/spec/fixtures/hello_world/assets/bpm_packages.js +0 -13
  145. data/spec/fixtures/hello_world/assets/bpm_styles.css +0 -14
  146. data/spec/fixtures/hello_world/hello_world.json +0 -20
  147. /data/spec/fixtures/{badrake-0.8.7.bpkg → gems/badrake-0.8.7.bpkg} +0 -0
  148. /data/spec/fixtures/{builder-3.0.0.bpkg → gems/builder-3.0.0.bpkg} +0 -0
  149. /data/spec/fixtures/{bundler-1.1.pre.bpkg → gems/bundler-1.1.pre.bpkg} +0 -0
  150. /data/spec/fixtures/{coffee-1.0.1.pre.bpkg → gems/coffee-1.0.1.pre.bpkg} +0 -0
  151. /data/spec/fixtures/{custom_generator-1.0.bpkg → gems/custom_generator-1.0.bpkg} +0 -0
  152. /data/spec/fixtures/{highline-1.6.1.bpkg → gems/highline-1.6.1.bpkg} +0 -0
  153. /data/spec/fixtures/{ivory-0.0.1.bpkg → gems/ivory-0.0.1.bpkg} +0 -0
  154. /data/spec/fixtures/{jquery-1.4.3.bpkg → gems/jquery-1.4.3.bpkg} +0 -0
  155. /data/spec/fixtures/{optparse-1.0.1.bpkg → gems/optparse-1.0.1.bpkg} +0 -0
  156. /data/spec/fixtures/{rake-0.8.6.bpkg → gems/rake-0.8.6.bpkg} +0 -0
  157. /data/spec/fixtures/{rake-0.8.7.bpkg → gems/rake-0.8.7.bpkg} +0 -0
  158. /data/spec/fixtures/{spade-0.5.0.bpkg → gems/spade-0.5.0.bpkg} +0 -0
  159. /data/spec/fixtures/{src → packages}/README.txt +0 -0
  160. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/.gitignore +0 -0
  161. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/CHANGELOG.md +0 -0
  162. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/ISSUES.md +0 -0
  163. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/LICENSE +0 -0
  164. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/README.md +0 -0
  165. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/UPGRADING.md +0 -0
  166. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/bin/bundle +0 -0
  167. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/definition.js +0 -0
  168. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/dependency.js +0 -0
  169. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/dsl.js +0 -0
  170. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler/ui.js +0 -0
  171. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/lib/bundler.js +0 -0
  172. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-config.ronn +0 -0
  173. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-exec.ronn +0 -0
  174. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-install.ronn +0 -0
  175. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-package.ronn +0 -0
  176. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle-update.ronn +0 -0
  177. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/bundle.ronn +0 -0
  178. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/gemfile.5.ronn +0 -0
  179. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/man/index.txt +0 -0
  180. /data/spec/fixtures/{src → packages}/bundler-1.1.pre/package.json +0 -0
  181. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/bin/cake +0 -0
  182. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/bin/coffee +0 -0
  183. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee/base.js +0 -0
  184. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee/mocha/chai.js +0 -0
  185. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/lib/coffee.js +0 -0
  186. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/package.json +0 -0
  187. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/qunit/coffee/test.js +0 -0
  188. /data/spec/fixtures/{src → packages}/coffee-1.0.1.pre/qunit/test.js +0 -0
  189. /data/spec/fixtures/{core-test → packages/core-test}/bin/cot +0 -0
  190. /data/spec/fixtures/{core-test → packages/core-test}/lib/main.js +0 -0
  191. /data/spec/fixtures/{core-test → packages/core-test}/resources/runner.css +0 -0
  192. /data/spec/fixtures/{core-test → packages/core-test}/tests/test.js +0 -0
  193. /data/spec/fixtures/{custom_generator → packages/custom_generator}/lib/main.js +0 -0
  194. /data/spec/fixtures/{custom_generator → packages/custom_generator}/package.json +0 -0
  195. /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/init/project.json +0 -0
  196. /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project/app.js +0 -0
  197. /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project/lib/main.js +0 -0
  198. /data/spec/fixtures/{custom_generator → packages/custom_generator}/templates/project_generator.rb +0 -0
  199. /data/spec/fixtures/{src → packages}/jquery/lib/main.js +0 -0
  200. /data/spec/fixtures/{src → packages}/jquery/package.json +0 -0
  201. /data/spec/fixtures/{src → packages}/rake-0.8.6/CHANGES +0 -0
  202. /data/spec/fixtures/{src → packages}/rake-0.8.6/MIT-LICENSE +0 -0
  203. /data/spec/fixtures/{src → packages}/rake-0.8.6/README +0 -0
  204. /data/spec/fixtures/{src → packages}/rake-0.8.6/Rakefile +0 -0
  205. /data/spec/fixtures/{src → packages}/rake-0.8.6/TODO +0 -0
  206. /data/spec/fixtures/{src → packages}/rake-0.8.6/bin/rake +0 -0
  207. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/command_line_usage.rdoc +0 -0
  208. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/Rakefile1 +0 -0
  209. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/Rakefile2 +0 -0
  210. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/a.c +0 -0
  211. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/b.c +0 -0
  212. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/example/main.c +0 -0
  213. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/glossary.rdoc +0 -0
  214. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/jamis.rb +0 -0
  215. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/proto_rake.rdoc +0 -0
  216. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rake.1.gz +0 -0
  217. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rakefile.rdoc +0 -0
  218. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/rational.rdoc +0 -0
  219. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.4.14.rdoc +0 -0
  220. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.4.15.rdoc +0 -0
  221. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.0.rdoc +0 -0
  222. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.3.rdoc +0 -0
  223. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.5.4.rdoc +0 -0
  224. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.6.0.rdoc +0 -0
  225. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.0.rdoc +0 -0
  226. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.1.rdoc +0 -0
  227. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.2.rdoc +0 -0
  228. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.7.3.rdoc +0 -0
  229. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.0.rdoc +0 -0
  230. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.2.rdoc +0 -0
  231. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.3.rdoc +0 -0
  232. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.4.rdoc +0 -0
  233. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.5.rdoc +0 -0
  234. /data/spec/fixtures/{src → packages}/rake-0.8.6/doc/release_notes/rake-0.8.6.rdoc +0 -0
  235. /data/spec/fixtures/{src → packages}/rake-0.8.6/install.rb +0 -0
  236. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/alt_system.rb +0 -0
  237. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/classic_namespace.rb +0 -0
  238. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/clean.rb +0 -0
  239. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/compositepublisher.rb +0 -0
  240. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/ftptools.rb +0 -0
  241. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/publisher.rb +0 -0
  242. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/rubyforgepublisher.rb +0 -0
  243. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/sshpublisher.rb +0 -0
  244. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/contrib/sys.rb +0 -0
  245. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/gempackagetask.rb +0 -0
  246. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/loaders/makefile.rb +0 -0
  247. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/packagetask.rb +0 -0
  248. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/rake_test_loader.rb +0 -0
  249. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/rdoctask.rb +0 -0
  250. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/ruby182_test_unit_fix.rb +0 -0
  251. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/runtest.rb +0 -0
  252. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/tasklib.rb +0 -0
  253. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/testtask.rb +0 -0
  254. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake/win32.rb +0 -0
  255. /data/spec/fixtures/{src → packages}/rake-0.8.6/lib/rake.rb +0 -0
  256. /data/spec/fixtures/{src → packages}/rake-0.8.6/package.json +0 -0
  257. /data/spec/fixtures/{src → packages}/rake-0.8.6/test/capture_stdout.rb +0 -0
  258. /data/spec/fixtures/{src → packages}/rake-0.8.7/CHANGES +0 -0
  259. /data/spec/fixtures/{src → packages}/rake-0.8.7/MIT-LICENSE +0 -0
  260. /data/spec/fixtures/{src → packages}/rake-0.8.7/README +0 -0
  261. /data/spec/fixtures/{src → packages}/rake-0.8.7/Rakefile +0 -0
  262. /data/spec/fixtures/{src → packages}/rake-0.8.7/TODO +0 -0
  263. /data/spec/fixtures/{src → packages}/rake-0.8.7/bin/rake +0 -0
  264. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/command_line_usage.rdoc +0 -0
  265. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/Rakefile1 +0 -0
  266. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/Rakefile2 +0 -0
  267. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/a.c +0 -0
  268. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/b.c +0 -0
  269. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/example/main.c +0 -0
  270. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/glossary.rdoc +0 -0
  271. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/jamis.rb +0 -0
  272. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/proto_rake.rdoc +0 -0
  273. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rake.1.gz +0 -0
  274. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rakefile.rdoc +0 -0
  275. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/rational.rdoc +0 -0
  276. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +0 -0
  277. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +0 -0
  278. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +0 -0
  279. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +0 -0
  280. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +0 -0
  281. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +0 -0
  282. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +0 -0
  283. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +0 -0
  284. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +0 -0
  285. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +0 -0
  286. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +0 -0
  287. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +0 -0
  288. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +0 -0
  289. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +0 -0
  290. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +0 -0
  291. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +0 -0
  292. /data/spec/fixtures/{src → packages}/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +0 -0
  293. /data/spec/fixtures/{src → packages}/rake-0.8.7/install.rb +0 -0
  294. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/alt_system.rb +0 -0
  295. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/classic_namespace.rb +0 -0
  296. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/clean.rb +0 -0
  297. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +0 -0
  298. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/ftptools.rb +0 -0
  299. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/publisher.rb +0 -0
  300. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +0 -0
  301. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +0 -0
  302. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/contrib/sys.rb +0 -0
  303. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/gempackagetask.rb +0 -0
  304. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/loaders/makefile.rb +0 -0
  305. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/packagetask.rb +0 -0
  306. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/rake_test_loader.rb +0 -0
  307. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/rdoctask.rb +0 -0
  308. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +0 -0
  309. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/runtest.rb +0 -0
  310. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/tasklib.rb +0 -0
  311. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/testtask.rb +0 -0
  312. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake/win32.rb +0 -0
  313. /data/spec/fixtures/{src → packages}/rake-0.8.7/lib/rake.rb +0 -0
  314. /data/spec/fixtures/{src → packages}/rake-0.8.7/package.json +0 -0
  315. /data/spec/fixtures/{src → packages}/rake-0.8.7/test/capture_stdout.rb +0 -0
  316. /data/spec/fixtures/{src → packages}/spade/lib/main.js +0 -0
  317. /data/spec/fixtures/{src → packages}/spade/package.json +0 -0
  318. /data/spec/fixtures/{custom_name → projects/custom_name}/MyProject.json +0 -0
  319. /data/spec/fixtures/{hello_world → projects/hello2}/LICENSE +0 -0
  320. /data/{templates/project → spec/fixtures/projects/hello2}/app.js +0 -0
  321. /data/spec/fixtures/{hello_world → projects/hello_world}/README.md +0 -0
  322. /data/spec/fixtures/{hello_world → projects/hello_world}/assets/papa-smurf.jpg +0 -0
  323. /data/spec/fixtures/{hello_world → projects/hello_world}/css/dummy.css +0 -0
  324. /data/spec/fixtures/{hello_world → projects/hello_world}/lib/main.js +0 -0
  325. /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/assets/dummy.txt +0 -0
  326. /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/css/sample_styles.css +0 -0
  327. /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/custom_dir/basic-module.js +0 -0
  328. /data/spec/fixtures/{hello_world → projects/hello_world}/packages/custom_package/lib/main.js +0 -0
  329. /data/spec/fixtures/{hello_world → projects/hello_world}/tests/main-test.js +0 -0
  330. /data/spec/fixtures/{minitest → projects/minitest}/assets/bpm_packages.js +0 -0
  331. /data/spec/fixtures/{minitest → projects/minitest}/assets/bpm_styles.css +0 -0
  332. /data/spec/fixtures/{minitest → projects/minitest}/assets/minitest/app_package.js +0 -0
  333. /data/spec/fixtures/{minitest → projects/minitest}/lib/main.js +0 -0
  334. /data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/lib/main.js +0 -0
  335. /data/spec/fixtures/{minitest → projects/minitest}/packages/uglyduck/minifier/main.js +0 -0
  336. /data/spec/fixtures/{simple_hello/assets/bpm_packages.js → projects/simple_hello/assets/bpm_libs.js} +0 -0
  337. /data/spec/fixtures/{simple_hello → projects/simple_hello}/lib/main.js +0 -0
  338. /data/spec/fixtures/{transporter → projects/transporter}/lib/main.js +0 -0
  339. /data/spec/fixtures/{transporter → projects/transporter}/packages/transport/lib/main.js +0 -0
  340. /data/spec/fixtures/{transporter → projects/transporter}/packages/transport/transports/wrapper.js +0 -0
  341. /data/spec/fixtures/{transporter → projects/transporter}/transporter.json +0 -0
@@ -4,7 +4,10 @@ describe BPM::Pipeline, "asset_path" do
4
4
 
5
5
  before do
6
6
  goto_home
7
- FileUtils.cp_r(fixtures('hello_world'), '.')
7
+ set_host
8
+ start_fake(FakeGemServer.new)
9
+ FileUtils.cp_r(project_fixture('hello_world'), '.')
10
+ cd home('hello_world')
8
11
  end
9
12
 
10
13
  subject do
@@ -13,31 +16,22 @@ describe BPM::Pipeline, "asset_path" do
13
16
  end
14
17
 
15
18
  it "should find any asset in the assets directory" do
19
+ bpm 'update' and wait
16
20
  asset = subject.find_asset 'papa-smurf.jpg'
17
21
  asset.pathname.should == home('hello_world', 'assets', 'papa-smurf.jpg')
18
22
  end
19
23
 
20
24
  it "should find any asset in packages" do
21
- goto_home
22
- set_host
23
- start_fake(FakeGemServer.new)
24
- cd home('hello_world')
25
-
26
- bpm 'add', 'custom_package'
27
- wait
25
+ bpm 'fetch' and wait
26
+ bpm 'add', 'custom_package' and wait
28
27
 
29
28
  asset = subject.find_asset 'custom_package/assets/dummy.txt'
30
29
  asset.pathname.should == home('hello_world', '.bpm', 'packages', 'custom_package', 'assets', 'dummy.txt')
31
30
  end
32
31
 
33
32
  it "should find any asset in installed packages" do
34
- goto_home
35
- set_host
36
- start_fake(FakeGemServer.new)
37
- cd home('hello_world')
38
-
39
- bpm 'compile'
40
- wait
33
+ bpm 'fetch' and wait
34
+ bpm 'compile' and wait
41
35
 
42
36
  asset = subject.find_asset 'core-test/resources/runner.css'
43
37
  asset.pathname.should == home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')
@@ -46,37 +40,33 @@ describe BPM::Pipeline, "asset_path" do
46
40
  describe "generated assets" do
47
41
 
48
42
  before do
49
- goto_home
50
- set_host
51
- start_fake(FakeGemServer.new)
52
- cd home('hello_world')
53
-
54
- bpm 'add', 'custom_package'
55
- wait
43
+ bpm 'fetch' and wait
44
+ bpm 'add', 'custom_package' and wait
56
45
 
57
46
  @project = BPM::Project.new home('hello_world')
58
47
  end
59
48
 
60
- describe "bpm_packages.js" do
61
-
49
+ describe "bpm_libs.js" do
50
+
62
51
  subject do
63
- BPM::Pipeline.new(@project).find_asset 'bpm_packages.js'
52
+ BPM::Pipeline.new(@project).find_asset 'bpm_libs.js'
64
53
  end
65
54
 
66
55
  it "should return an asset of type BPM::GeneratedAsset" do
67
56
  subject.class.should == BPM::GeneratedAsset
68
57
  end
69
58
 
70
- it "should find the bpm_packages.js" do
71
- subject.pathname.should == home('hello_world', 'assets', 'bpm_packages.js')
59
+ it "should find the bpm_libs.js" do
60
+ subject.pathname.should == home('hello_world', 'assets', 'bpm_libs.js')
72
61
  end
73
-
74
- it "should find bpm_packages as well" do
75
- BPM::Pipeline.new(@project).find_asset('bpm_packages').should == subject
62
+
63
+ it "should find bpm_libs as well" do
64
+ BPM::Pipeline.new(@project).find_asset('bpm_libs').should == subject
76
65
  end
77
66
 
78
67
  it "should have a manifest line" do
79
- subject.to_s.should include('MANIFEST: core-test (0.4.9) custom_package (2.0.0) ivory (0.0.1) optparse (1.0.1) rake (0.8.6) spade (0.5.0)')
68
+ # Right now we're including dev deps
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) optparse (1.0.1) rake (0.8.6) spade (0.5.0)')
80
70
  end
81
71
 
82
72
  it "should include any required modules in the bpm_package.js" do
@@ -88,9 +78,9 @@ describe BPM::Pipeline, "asset_path" do
88
78
  end
89
79
 
90
80
  end
91
-
81
+
92
82
  describe "bpm_styles.css" do
93
-
83
+
94
84
  subject do
95
85
  BPM::Pipeline.new(@project).find_asset 'bpm_styles.css'
96
86
  end
@@ -102,78 +92,106 @@ describe BPM::Pipeline, "asset_path" do
102
92
  it "should include any required modules in the bpm_styles.css" do
103
93
  subject.to_s.should include(File.read(home('hello_world', 'packages', 'custom_package', 'css', 'sample_styles.css')))
104
94
  end
105
-
95
+
106
96
  it "should reference installed package styles as well" do
107
97
  subject.to_s.should include(File.read(home('hello_world', '.bpm', 'packages', 'core-test', 'resources', 'runner.css')))
108
98
  end
109
99
 
110
100
  end
111
-
112
- describe "hello_world/app_package.js" do
101
+
102
+ describe "hello_world/bpm_libs.js" do
113
103
 
104
+ subject do
105
+ BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_libs.js'
106
+ end
107
+
108
+ it "should return an asset of type BPM::GeneratedAsset" do
109
+ subject.class.should == BPM::GeneratedAsset
110
+ end
111
+
112
+ it "should find the bpm_libs.js" do
113
+ subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_libs.js')
114
+ end
115
+
116
+ it "should find bpm_libs as well" do
117
+ BPM::Pipeline.new(@project).find_asset('hello_world/bpm_libs').should == subject
118
+ end
119
+
120
+ it "should have a manifest line" do
121
+ subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
122
+ end
123
+
124
+ it "should include any required modules in the bpm_libs" do
125
+ subject.to_s.should include(File.read(home('hello_world', 'lib', 'main.js')))
126
+ end
127
+ end
128
+
129
+ describe "hello_world/bpm_styles.css" do
130
+
114
131
  before do
115
132
  FileUtils.mkdir_p home('hello_world', 'assets', 'hello_world')
116
- FileUtils.touch home('hello_world', 'assets', 'hello_world', 'app_package.js')
133
+ FileUtils.touch home('hello_world', 'assets', 'hello_world', 'bpm_styles.css')
117
134
  end
118
135
 
119
136
  subject do
120
- BPM::Pipeline.new(@project).find_asset 'hello_world/app_package.js'
137
+ BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_styles.css'
121
138
  end
122
139
 
123
140
  it "should return an asset of type BPM::GeneratedAsset" do
124
141
  subject.class.should == BPM::GeneratedAsset
125
142
  end
126
143
 
127
- it "should find the app_package.js" do
128
- subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'app_package.js')
144
+ it "should find the app_styles.css" do
145
+ subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_styles.css')
129
146
  end
130
-
131
- it "should find app_package as well" do
132
- BPM::Pipeline.new(@project).find_asset('hello_world/app_package').should == subject
147
+
148
+ it "should find bpm_styles as well" do
149
+ BPM::Pipeline.new(@project).find_asset('hello_world/bpm_styles').should == subject
133
150
  end
134
151
 
135
152
  it "should have a manifest line" do
136
153
  subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
137
154
  end
138
155
 
139
- it "should include any required modules in the app_package" do
140
- subject.to_s.should include(File.read(home('hello_world', 'lib', 'main.js')))
156
+ it "should include any required modules in the bpm_styles" do
157
+ subject.to_s.should include(File.read(home('hello_world', 'css', 'dummy.css')))
141
158
  end
159
+
142
160
  end
143
-
144
- describe "hello_world/app_styles.css" do
145
-
161
+
162
+ describe "hello_world/app_tests.js" do
163
+
146
164
  before do
147
165
  FileUtils.mkdir_p home('hello_world', 'assets', 'hello_world')
148
- FileUtils.touch home('hello_world', 'assets', 'hello_world', 'app_styles.css')
166
+ FileUtils.touch home('hello_world', 'assets', 'hello_world', 'app_tests.js')
149
167
  end
150
-
168
+
151
169
  subject do
152
- BPM::Pipeline.new(@project).find_asset 'hello_world/app_styles.css'
170
+ BPM::Pipeline.new(@project).find_asset 'hello_world/bpm_tests.js'
153
171
  end
154
-
172
+
155
173
  it "should return an asset of type BPM::GeneratedAsset" do
156
174
  subject.class.should == BPM::GeneratedAsset
157
175
  end
158
-
159
- it "should find the app_styles.css" do
160
- subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'app_styles.css')
176
+
177
+ it "should find the app_tests.js" do
178
+ subject.pathname.should == home('hello_world', 'assets', 'hello_world', 'bpm_tests.js')
161
179
  end
162
-
163
- it "should find app_styles as well" do
164
- BPM::Pipeline.new(@project).find_asset('hello_world/app_styles').should == subject
180
+
181
+ it "should find app_tests as well" do
182
+ BPM::Pipeline.new(@project).find_asset('hello_world/bpm_tests').should == subject
165
183
  end
166
-
184
+
167
185
  it "should have a manifest line" do
168
186
  subject.to_s.should include('MANIFEST: hello_world (2.0.0)')
169
187
  end
170
-
171
- it "should include any required modules in the app_package" do
172
- subject.to_s.should include(File.read(home('hello_world', 'css', 'dummy.css')))
188
+
189
+ it "should include any required modules in the bpm_tests" do
190
+ subject.to_s.should include(File.read(home('hello_world', 'tests', 'main-test.js')))
173
191
  end
174
-
192
+
175
193
  end
176
-
194
+
177
195
  end
178
196
 
179
197
  end
@@ -184,14 +202,14 @@ describe BPM::Pipeline, "buildable_assets" do
184
202
  before do
185
203
  set_host
186
204
  goto_home
187
- FileUtils.cp_r(fixtures('hello_world'), '.')
205
+ FileUtils.cp_r(project_fixture('hello_world'), '.')
188
206
  reset_libgems bpm_dir.to_s
189
207
 
190
208
  start_fake(FakeGemServer.new)
191
209
  cd home('hello_world')
192
210
 
193
- bpm 'add', 'custom_package', '--verbose'
194
- wait
211
+ bpm 'fetch' and wait
212
+ bpm 'add', 'custom_package', '--verbose' and wait
195
213
 
196
214
  @project = BPM::Project.new home('hello_world')
197
215
  end
@@ -208,10 +226,10 @@ describe BPM::Pipeline, "buildable_assets" do
208
226
  subject.find { |x| x.logical_path == logical_path }
209
227
  end
210
228
 
211
- it "should include bpm_packages.js" do
212
- asset = find_asset 'bpm_packages.js'
229
+ it "should include bpm_libs.js" do
230
+ asset = find_asset 'bpm_libs.js'
213
231
  asset.should_not be_nil
214
- asset.pathname.should == project('assets', 'bpm_packages.js')
232
+ asset.pathname.should == project('assets', 'bpm_libs.js')
215
233
  end
216
234
 
217
235
  it "should include bpm_styles.css" do
@@ -238,4 +256,4 @@ describe BPM::Pipeline, "buildable_assets" do
238
256
  end
239
257
 
240
258
  end
241
-
259
+
@@ -8,7 +8,7 @@ describe BPM::Pipeline, 'minifier' do
8
8
  reset_libgems bpm_dir.to_s
9
9
  start_fake(FakeGemServer.new)
10
10
 
11
- FileUtils.cp_r fixtures('minitest'), '.'
11
+ FileUtils.cp_r project_fixture('minitest'), '.'
12
12
  cd home('minitest')
13
13
 
14
14
  bpm 'compile'
@@ -17,23 +17,21 @@ describe BPM::Pipeline, 'minifier' do
17
17
 
18
18
  subject do
19
19
  project = BPM::Project.new home('minitest')
20
- BPM::Pipeline.new project
20
+ BPM::Pipeline.new project, :production
21
21
  end
22
22
 
23
- it "should wrap bpm_packages.js" do
24
- asset = subject.find_asset 'bpm_packages.js'
25
- file_path = home('minitest', 'packages', 'uglyduck', 'lib', 'main.js')
23
+ it "should wrap bpm_libs.js" do
24
+ asset = subject.find_asset 'bpm_libs.js'
26
25
  expected = <<EOF
27
- //MINIFIED START
28
- UGLY DUCK IS UGLY
29
26
  /* ===========================================================================
30
- BPM Static Dependencies
31
- MANIFEST: uglyduck (1.0.0)
27
+ BPM Combined Asset File
28
+ MANIFEST: (none)
32
29
  This file is generated automatically by the bpm (http://www.bpmjs.org)
33
- To use this file, load this file in your HTML head.
34
30
  =========================================================================*/
31
+ //MINIFIED START
32
+ UGLY DUCK IS UGLY
33
+
35
34
 
36
- #{File.read file_path}
37
35
  //MINIFIED END
38
36
  EOF
39
37
 
@@ -41,17 +39,16 @@ EOF
41
39
  end
42
40
 
43
41
  it "should wrap app_package.js" do
44
- asset = subject.find_asset 'minitest/app_package.js'
42
+ asset = subject.find_asset 'minitest/bpm_libs.js'
45
43
  file_path = home('minitest', 'lib', 'main.js')
46
44
  expected = <<EOF
47
- //MINIFIED START
48
- UGLY DUCK IS UGLY
49
45
  /* ===========================================================================
50
- BPM Static Dependencies
46
+ BPM Combined Asset File
51
47
  MANIFEST: minitest (2.0.0)
52
48
  This file is generated automatically by the bpm (http://www.bpmjs.org)
53
- To use this file, load this file in your HTML head.
54
49
  =========================================================================*/
50
+ //MINIFIED START
51
+ UGLY DUCK IS UGLY
55
52
 
56
53
  #{File.read(file_path)}
57
54
  //MINIFIED END
@@ -59,6 +56,18 @@ EOF
59
56
  asset.to_s.should == expected
60
57
  end
61
58
 
59
+ subject do
60
+ project = BPM::Project.new home('minitest')
61
+ BPM::Pipeline.new project, :production
62
+ end
63
+
64
+ it "should not wrap bpm_libs.js in debug mode" do
65
+ project = BPM::Project.new home('minitest')
66
+ pipeline = BPM::Pipeline.new project, :debug
67
+ asset = pipeline.find_asset 'minitest/app_package.js'
68
+ asset.to_s.should_not include('//MINIFIED START')
69
+ end
70
+
62
71
  end
63
72
 
64
73
 
@@ -8,7 +8,7 @@ describe BPM::Pipeline, 'transport processor' do
8
8
  reset_libgems bpm_dir.to_s
9
9
  start_fake(FakeGemServer.new)
10
10
 
11
- FileUtils.cp_r fixtures('transporter'), '.'
11
+ FileUtils.cp_r project_fixture('transporter'), '.'
12
12
  cd home('transporter')
13
13
 
14
14
  bpm 'compile'
data/spec/project_spec.rb CHANGED
@@ -3,23 +3,23 @@ require "spec_helper"
3
3
  describe BPM::Project, "project_file_path" do
4
4
 
5
5
  it "should return project file path" do
6
- path = fixtures('hello_world')
6
+ path = project_fixture('hello_world')
7
7
  expected = File.join(path, 'hello_world.json')
8
8
  BPM::Project.project_file_path(path).should == expected
9
9
  end
10
10
 
11
11
  it "should return nil on a package" do
12
- path = fixtures('core-test')
12
+ path = package_fixture('core-test')
13
13
  BPM::Project.project_file_path(path).should == nil
14
14
  end
15
15
 
16
16
  it "should return nil on a project with no file" do
17
- path = fixtures('simple_hello')
17
+ path = project_fixture('simple_hello')
18
18
  BPM::Project.project_file_path(path).should == nil
19
19
  end
20
20
 
21
21
  it "should return project path with different name" do
22
- path = fixtures('custom_name')
22
+ path = project_fixture('custom_name')
23
23
  expected = File.join(path, 'MyProject.json')
24
24
  BPM::Project.project_file_path(path).should == expected
25
25
  end
@@ -29,15 +29,15 @@ end
29
29
  describe BPM::Project, "is_project_root?" do
30
30
 
31
31
  it "should return true for a project path" do
32
- BPM::Project.is_project_root?(fixtures('hello_world')).should == true
32
+ BPM::Project.is_project_root?(project_fixture('hello_world')).should == true
33
33
  end
34
34
 
35
35
  it "should return false for a package" do
36
- BPM::Project.is_project_root?(fixtures('core-test')).should == false
36
+ BPM::Project.is_project_root?(package_fixture('core-test')).should == false
37
37
  end
38
38
 
39
39
  it "should return true for a project with no project file" do
40
- BPM::Project.is_project_root?(fixtures('simple_hello')).should == true
40
+ BPM::Project.is_project_root?(project_fixture('simple_hello')).should == true
41
41
  end
42
42
 
43
43
  end
@@ -46,7 +46,7 @@ describe BPM::Project, "nearest_project" do
46
46
 
47
47
  describe "standard project" do
48
48
  subject do
49
- fixtures('hello_world').to_s # string not Pathname
49
+ project_fixture('hello_world').to_s # string not Pathname
50
50
  end
51
51
 
52
52
  it "should return project instance for project path" do
@@ -61,7 +61,7 @@ describe BPM::Project, "nearest_project" do
61
61
 
62
62
  describe "simple project" do
63
63
  subject do
64
- fixtures('simple_hello').to_s # string not Pathname
64
+ project_fixture('simple_hello').to_s # string not Pathname
65
65
  end
66
66
 
67
67
  it "should return project instance for project path" do
@@ -75,7 +75,7 @@ describe BPM::Project, "nearest_project" do
75
75
  end
76
76
 
77
77
  it "should return nil for a package" do
78
- BPM::Project.nearest_project(fixtures('core-test')).should == nil
78
+ BPM::Project.nearest_project(package_fixture('core-test')).should == nil
79
79
  end
80
80
 
81
81
  end
@@ -84,13 +84,11 @@ describe BPM::Project, "project metadata" do
84
84
 
85
85
  describe "standard project" do
86
86
  subject do
87
- BPM::Project.new fixtures('hello_world')
87
+ BPM::Project.new project_fixture('hello_world')
88
88
  end
89
89
 
90
- it "should be valid" do
91
- subject.valid?.should == true
92
- end
93
-
90
+ it { should be_valid }
91
+
94
92
  it "should get project name" do
95
93
  subject.name.should == "hello_world"
96
94
  end
@@ -105,18 +103,42 @@ describe BPM::Project, "project metadata" do
105
103
  "core-test" => "0.4.9"
106
104
  }
107
105
  end
108
-
106
+
107
+ it "should get development dependencies" do
108
+ subject.dependencies_development.should == {
109
+ "custom_generator" => "1.0",
110
+ "jquery" => "1.4.3"
111
+ }
112
+ end
113
+
109
114
  end
110
115
 
116
+ describe "project with different name" do
117
+ before do
118
+ goto_home
119
+ FileUtils.cp_r project_fixture('hello_world'), 'HelloWorld2'
120
+ end
121
+
122
+ subject do
123
+ BPM::Project.new home('HelloWorld2')
124
+ end
125
+
126
+ # packages do not allow the directory and "name" to be different. make
127
+ # sure project doesn't inherit this.
128
+ it "should not raise exception when loading json" do
129
+ lambda {
130
+ subject.load_json
131
+ }.should_not raise_error
132
+ end
133
+ end
134
+
111
135
  describe "simple project" do
112
136
  subject do
113
- BPM::Project.new fixtures('simple_hello')
137
+ BPM::Project.new project_fixture('simple_hello')
114
138
  end
115
139
 
116
- it "should be valid" do
117
- subject.valid?.should == true
118
- end
119
-
140
+ it { should be_valid }
141
+
120
142
  it "should get project name" do
121
143
  subject.name.should == "simple_hello"
122
144
  end
@@ -126,7 +148,8 @@ describe BPM::Project, "project metadata" do
126
148
  subject.version.should == "0.0.1"
127
149
  end
128
150
 
129
- it "should get dependencies read from bpm_packages.js file" do
151
+ # FIXME: Is this test even useful?
152
+ it "should get dependencies read from bpm_libs.js file" do
130
153
  subject.dependencies.should == {
131
154
  }
132
155
  end
@@ -137,30 +160,70 @@ end
137
160
 
138
161
  describe BPM::Project, "converting" do
139
162
  subject do
140
- BPM::Project.nearest_project(fixtures("hello_world")).as_json
163
+ BPM::Project.nearest_project(project_fixture("hello_world")).as_json
141
164
  end
142
165
 
143
- it "should have bpm set to current version" do
144
- subject["bpm"].should == BPM::VERSION
166
+ it "should have bpm set to current compatible version" do
167
+ subject["bpm"].should == BPM::COMPAT_VERSION
145
168
  end
146
169
  end
147
170
 
148
171
  describe BPM::Project, "package_and_module_from_path" do
149
172
 
150
- it "should find package in deps"
173
+ before do
174
+ # This seems a bit overkill, but we need our dependencies installed
175
+ goto_home
176
+ set_host
177
+ start_fake(FakeGemServer.new)
178
+ FileUtils.cp_r(project_fixture('hello_world'), '.')
179
+ cd home('hello_world')
180
+ end
151
181
 
152
- it "should fallback to self if not found in deps"
182
+ subject do
183
+ proj = BPM::Project.nearest_project('.')
184
+ with_env{ proj.fetch_dependencies }
185
+ proj
186
+ end
153
187
 
154
- it "should throw error if no package"
188
+ # TODO: Make into a nice matcher
189
+ def check_package_and_module(proj, path, pkg_name, module_id)
190
+ pkg, id = proj.package_and_module_from_path(path)
191
+ pkg.name.should == pkg_name
192
+ id.should == module_id
193
+ end
155
194
 
156
- it "should not match partial directories"
157
- # i.e. packages/sproutcore should not match for packages/sproutcore-runtime
195
+ it "should find path in self" do
196
+ check_package_and_module(subject, home("hello_world", "css", "dummy.css"),
197
+ "hello_world", "~css/dummy")
198
+ end
158
199
 
159
- it "should handle and valid directory reference in package directories array"
160
- # i.e. "lib": ["./lib", "./vendor/lib"]
200
+ it "should find path in dependencies" do
201
+ check_package_and_module(subject, home("hello_world", ".bpm", "packages", "core-test", "resources", "runner.css"),
202
+ "core-test", "~resources/runner")
203
+ end
204
+
205
+ it "should throw error if no package" do
206
+ l = lambda{ subject.package_and_module_from_path(project_fixture("simple_hello")) }
207
+ l.should raise_error(/simple_hello is not within a known package/)
208
+ end
161
209
 
162
- it "should replace with directory names"
210
+ it "should not match partial directories" do
211
+ # We're verifying that core-testing doesn't match core-test
212
+ # Since there is no core-testing package it will fall back to the base package, hello_world
213
+ check_package_and_module(subject, home("hello_world", ".bpm", "packages", "core-testing", "resources", "runner.css"),
214
+ "hello_world", "~.bpm/packages/core-testing/resources/runner")
215
+ end
163
216
 
164
- it "should not include lib directory in module name"
217
+ it "should handle directory reference in package directories array" do
218
+ check_package_and_module(subject, home("hello_world", "lib", "main.js"),
219
+ "hello_world", "main")
220
+ check_package_and_module(subject, home("hello_world", "vendor", "lib", "something.js"),
221
+ "hello_world", "something")
222
+ end
223
+
224
+ it "should replace with directory names" do
225
+ check_package_and_module(subject, home("hello_world", "custom_dir", "custom.js"),
226
+ "hello_world", "~custom/custom")
227
+ end
165
228
 
166
229
  end
data/spec/spec_helper.rb CHANGED
@@ -21,6 +21,47 @@ module SpecHelpers
21
21
  LibGems.host = @original_host if @original_host
22
22
  LibGems.sources = @original_sources if @original_sources
23
23
  end
24
+
25
+ # Use to avoid throwing errors just because an extra newline shows up
26
+ # somewhere
27
+ def normalize_whitespace(string)
28
+ string.gsub(/ +/, ' ').gsub(/\n+/,"\n")
29
+ end
30
+
31
+ def compare_file_contents(actual_path, expected_path)
32
+ actual_contents = normalize_whitespace File.read(actual_path)
33
+ expected_contents = normalize_whitespace File.read(expected_path)
34
+ actual_contents.should == expected_contents
35
+ end
36
+
37
+ # compares the contents of two directories to ensure they are the same.
38
+ # ignores any whitespaces on files.
39
+ def compare_contents(actual_root, expected_root)
40
+ actual_root = actual_root.to_s
41
+ expected_root = expected_root.to_s # incase Pathname is passed
42
+
43
+ if File.directory? expected_root
44
+ # first make sure the same files are in each.
45
+ expected_files = Dir.glob(File.join(expected_root, '**', '*')).sort
46
+ actual_files = Dir.glob(File.join(actual_root, '**', '*')).sort
47
+
48
+ actual_files.map! { |path| expected_root + path[actual_root.size..-1] }
49
+ actual_files.should == expected_files
50
+
51
+ expected_files.each do |expected_path|
52
+ display_path = expected_path[expected_root.size..-1]
53
+ actual_path = @project_path + display_path
54
+ if File.directory? expected_path
55
+ File.directory?(actual_path).should be_true
56
+ else
57
+ compare_file_contents actual_path, expected_path
58
+ end
59
+ end
60
+ else
61
+ compare_file_contents actual_path, expected_path
62
+ end
63
+ end
64
+
24
65
  end
25
66
 
26
67
  RSpec.configure do |config|