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
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+
2
+ * Fixed issue with compile that would cause exceptions if you deleted the
3
+ global .bpm directory
4
+ * BPM now complains if you load a package whose directory name does not
5
+ match the name in the package.json (this was causing exceptions in some
6
+ cases)
7
+ * BPM is more whiny now when it tries to load a package with invalid or
8
+ missing package.json.
9
+ * the version stored in the `bpm` key on new projects is a compatible
10
+ version instead of the actual version. Right now this means it is frozen
11
+ at 1.0.0
12
+ * merge `bpm new` into `bpm init`. now this works like git. If you
13
+ `bpm init` on an existing directory, bpm will try to update it. If you
14
+ `bpm init` and pass a new path, bpm will create it.
15
+ * now showing version of bpm in bpm help
16
+
17
+ # 1.0.0.beta.3.pre
18
+
19
+ * started changelog
20
+
data/README.md CHANGED
@@ -28,7 +28,7 @@ Then add jquery as a dependency:
28
28
 
29
29
  bpm add jquery
30
30
 
31
- This will create a file called `assets/bpm_packages.js` which will include
31
+ This will create a file called `assets/bpm_libs` which will include
32
32
  jquery. You can then create an index.html and reference that js. Everytime
33
33
  you add a dependency, it will be based into this JS file .
34
34
 
data/TODO.md CHANGED
@@ -1,4 +1,92 @@
1
1
 
2
- * Better support for using plugins during builds. Ideal solution would create a .js file for each plugin and load it in a separate context. This would allow each plugin to actually require other dependencies, etc. This is required to properly support format plugins.
2
+ * you should be able to place other projects into a vendor directory and
3
+ have their packages appear.
3
4
 
4
- * Development dependencies
5
+ * Multiple format support. Format processors supplied by dependencies should
6
+ be used to resolve formats.
7
+
8
+ * minify then transport -> this will allow for string loading.
9
+
10
+ * HTML manifest support [in general we need a way for packages to generate new assets]
11
+
12
+ * cache-friendly URLs
13
+
14
+ * HTML files should be able to process as templates using a template plugin
15
+
16
+ * Should log clearly when fetching from remotes
17
+
18
+ * Can we use YAML instead of JSON?
19
+
20
+ * Changing a dependency in a package.json should rebuild all files in preview mode (in case the transport was modified)
21
+
22
+ * Need to run bpm update before bpm preview for the first time
23
+
24
+ * "directories" should be optional in package.json - we can infer it.
25
+
26
+ ----------------
27
+
28
+ # SCENARIOS
29
+
30
+ ## New user with existing app using bpm to manage dependencies
31
+
32
+ bpm init . # creates bpm.json, assets/bpm_libs.js etc.
33
+
34
+ bpm add sproutcore # updates json & packages with sproutcore
35
+ > Fetching sproutcore...
36
+ > Building bpm_libs.js
37
+ > New library size ~24Kb
38
+
39
+ # now just load assets/bpm_libs.js to get it all
40
+
41
+ bpm remove sproutcore # updates json & packages to remove...
42
+ ...
43
+
44
+ ## User migrates to use bpm to manage their app as well
45
+
46
+ bpm init --app # enables app management, creates app dir for JS
47
+
48
+ # now just make your index.html load assets/app_name/app_package.js
49
+
50
+ bpm preview # returns auto-compiled resources while working.
51
+ # also we could publish a rails plugin that bakes in to
52
+ # rails app
53
+
54
+ bpm compile # generates a built app when you are ready to go to prod
55
+ # maybe should build the entire thing into a different
56
+ # loc?
57
+
58
+ bpm update # invoke if you modify the bpm.json to update settings
59
+
60
+ ## User working with unit tests in their app
61
+
62
+ # to enable unit testing add a unit testing framework as a dev dependency
63
+ bpm add qunit --dev
64
+
65
+ # you can also use the generator to introduce a unit test
66
+ bpm gen qunit test foo_test # creates tests/foo_test.js
67
+
68
+ # next time you update it will add a assets/app_name/bpm_tests.js file
69
+ # this isn't really necessary though because bpm preview runs this.
70
+ bpm update --no-fetch
71
+
72
+ # start the preview app and then navigate to the qunit
73
+ bpm preview
74
+
75
+ # then to run the unit tests - load the qunit viewer...
76
+ visit: http://localhost:4020/assets/qunit
77
+
78
+ ## Developer hacking on a package they intend to redistribute
79
+
80
+ This works the same way whether you intend to redistribute or not; just put
81
+ it inside of a project and name your development dependencies there. Workflow
82
+ is the same as unit testing an app except that the tests should be in the
83
+ package and the tests will be built into `assets/package_name/bpm_tests.js`
84
+
85
+ ## Including a developer package inside of another project
86
+
87
+ All packages must be developed inside of a project - this means that a package
88
+ you intend to distribute via bpm must itself be developed inside of a project.
89
+
90
+ If you just want to include a developer package just add the project to your
91
+ 'vendor' directory.
92
+
data/bpm.gemspec CHANGED
@@ -10,13 +10,13 @@ Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Charles Jolley", "Peter Wagenet"]
12
12
  s.email = ["charles@sproutcore.com", "peterw@strobecorp.com"]
13
- s.homepage = "http://github.com/strobecorp/spade"
14
- s.summary = s.description = "Package Manager for JavaScript"
13
+ s.homepage = "http://github.com/getbpm/bpm"
14
+ s.summary = s.description = "Browser Package Manager"
15
15
 
16
16
  mswin = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
17
17
  mri = !mswin && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
18
18
 
19
- s.add_dependency "libgems", "~> 0.0.2"
19
+ s.add_dependency "libgems", "~> 0.0.5"
20
20
  s.add_dependency "gemcutter", "~> 0.6.1"
21
21
  s.add_dependency "highline", "~> 1.6.1"
22
22
  s.add_dependency "json_pure", "~> 1.4.6"
data/lib/bpm/cli/base.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'thor'
2
+ require 'json'
3
+ require 'bpm/version'
2
4
 
3
5
  module BPM
4
6
  module CLI
@@ -10,6 +12,11 @@ module BPM
10
12
  :aliases => ['-V'],
11
13
  :desc => 'Show additional debug information while running'
12
14
 
15
+ def self.help(shell, subcommand = false)
16
+ shell.say "\nbpm (v#{BPM::VERSION}) - the browser package manager\n\n"
17
+ super shell, subcommand
18
+ end
19
+
13
20
  desc "owner", "Manage users for a package"
14
21
  subcommand "owner", BPM::CLI::Owner
15
22
 
@@ -47,17 +54,19 @@ module BPM
47
54
  end
48
55
 
49
56
 
50
- desc "fetched [PACKAGE]", "Shows what bpm packages are fetched"
57
+ desc "fetched [PACKAGE]", "Display locally fetched bpm packages"
51
58
  def fetched(*packages)
52
59
  local = BPM::Local.new
53
60
  index = local.installed(packages)
54
61
  print_specs(packages, index)
55
62
  end
56
63
 
57
- desc "add [PACKAGE]", "Add package to project"
64
+ desc "add [PACKAGE]", "Add one or more packages to a bpm project"
58
65
  method_option :version, :type => :string, :default => nil, :aliases => ['-v'], :desc => 'Specify a version to install'
59
66
  method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
60
67
  method_option :prerelease, :type => :boolean, :default => false, :aliases => ['--pre'], :desc => 'Install a prerelease version'
68
+ method_option :development, :type => :boolean, :default => false, :aliases => ['--dev'], :desc => "Add as a development dependency"
69
+ method_option :mode, :type => :string, :default => :production, :aliases => ['-m'], :desc => "Build mode for compile (default production)"
61
70
  def add(*package_names)
62
71
  # map to dependencies
63
72
  if package_names.empty?
@@ -81,13 +90,17 @@ module BPM
81
90
  # find project
82
91
  project = find_project
83
92
 
84
- # This was wrapped in a begin/rescue Exception, but we should be selective if we rescue
85
- project.add_dependencies deps, true
86
- project.build :debug, true
93
+ begin
94
+ project.add_dependencies deps, options[:development], true
95
+ project.build options[:mode], true
96
+ rescue BPM::Error => e
97
+ abort e.message
98
+ end
87
99
  end
88
100
 
89
- desc "remove [PACKAGE]", "Remove package from project"
101
+ desc "remove [PACKAGE]", "Remove one or more packages from a bpm project"
90
102
  method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
103
+ method_option :mode, :type => :string, :default => :production, :aliases => ['-m'], :desc => "Build mode for compile (default production)"
91
104
  def remove(*package_names)
92
105
 
93
106
  # map to dependencies
@@ -99,37 +112,31 @@ module BPM
99
112
  project = find_project
100
113
  project.unbuild options[:verbose]
101
114
  project.remove_dependencies package_names, true
102
- project.build :debug, true
103
-
104
- rescue Exception => e
115
+ project.build options[:mode], true
116
+ rescue BPM::Error => e
105
117
  abort e.message
106
118
  end
107
119
  end
108
120
 
109
- desc "autocompile", "Preview server that will autocompile assets. Useful for hacking"
110
- method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Set build mode for compile (default debug)'
121
+ desc "preview", "Preview server that will autocompile assets as you request them. Useful for hacking"
122
+ method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Build mode for compile (default debug)'
111
123
  method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
112
124
  method_option :port, :type => :string, :default => '4020', :desc => "Port to host server on"
113
- def autocompile
114
-
125
+ def preview
115
126
  project = find_project
116
- puts project
117
- BPM::Server.start project, :Port => options[:port]
118
-
127
+ project.verify_and_repair options[:mode], options[:verbose]
128
+ BPM::Server.start project, :Port => options[:port], :mode => options[:mode].to_sym
119
129
  end
120
130
 
121
- desc "compile", "Build the bpm_package.js for development"
122
- method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Set build mode for compile (default debug)'
131
+ desc "rebuild", "Rebuilds bpm assets, does not update versions"
132
+ method_option :mode, :type => :string, :default => :production, :aliases => ['-m'], :desc => 'Build mode for compile (default production)'
123
133
  method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
124
- def compile
125
-
126
- begin
127
- project = find_project
128
- project.rebuild_dependencies nil, options[:verbose]
129
- project.build options[:mode], options[:verbose]
130
- rescue Exception => e
131
- abort e.message
132
- end
134
+ method_option :update, :type => :boolean, :default => false, :aliases => ['-u'], :desc => 'Updates dependencies to latest compatible version'
135
+ def rebuild
136
+ find_project.fetch_dependencies(true) if options[:update]
137
+ find_project.build options[:mode].to_sym, true
138
+ rescue BPM::Error => e
139
+ abort e.message
133
140
  end
134
141
 
135
142
  desc "login", "Log in with your BPM credentials"
@@ -208,23 +215,11 @@ module BPM
208
215
  print_specs(packages, index)
209
216
  end
210
217
 
211
- desc "new [NAME]", "Generate a new project skeleton"
212
- method_option :path, :type => :string, :default => nil, :desc => 'Specify a different name for the project'
213
- method_option :package, :type => :string, :default => nil, :desc => 'Specify a package template to build from'
214
- def new(name)
215
- package = install_package(options[:package])
216
- template_path = package ? package.template_path(:project) : nil
217
-
218
- path = File.expand_path(options[:path] || underscore(name))
219
- generator = get_generator(:project, package)
220
- success = generator.new(self, name, path, template_path, package).run
221
-
222
- run_init(name, path, package) if success
223
- end
224
-
225
218
  desc "init [PATHS]", "Configure a project to use bpm for management"
226
219
  method_option :name, :type => :string, :default => nil, :desc => 'Specify a different name for the project'
227
220
  method_option :skip, :type => :boolean, :default => false, :desc => 'Skip any conflicting files'
221
+ method_option :app, :type => :boolean, :default => false, :desc => 'Manage app as well as packages'
222
+ method_option :package, :type => :string, :default => nil, :desc => 'Specify a package template to build from'
228
223
  def init(*paths)
229
224
  paths = [Dir.pwd] if paths.empty?
230
225
  paths.map!{|p| File.expand_path(p) }
@@ -234,19 +229,40 @@ module BPM
234
229
  end
235
230
 
236
231
  paths.each do |path|
237
- run_init(options[:name] || File.basename(path), path)
232
+ name = options[:name] || File.basename(path)
233
+
234
+ # if someone specified both a name and path assume they meant
235
+ # exactly what they said and don't normalize it.
236
+ if name == File.basename(path)
237
+ underscored = File.join(File.dirname(path), underscore(File.basename(path)))
238
+ path = underscored if !File.directory?(path)
239
+ end
240
+
241
+ if File.directory?(path)
242
+ run_init(name, options[:app], path)
243
+ else
244
+ package = install_package(options[:package])
245
+ template_path = package ? package.template_path(:project) : nil
246
+ generator = get_generator(:project, package)
247
+ success = generator.new(self, name, path, template_path, package).run
248
+ run_init(name, true, path, package) if success
249
+ end
250
+
238
251
  end
252
+
253
+ rescue BPM::Error => e
254
+ abort e.message
239
255
  end
240
256
 
241
- desc "build [PACKAGE]", "Build a bpm package from a package.json"
257
+ desc "pack [PACKAGE]", "Build a bpm package from a package.json"
242
258
  method_option :email, :type => :string, :default => nil, :aliases => ['-e'], :desc => 'Specify an author email address'
243
- def build(package_path=nil)
259
+ def pack(package_path=nil)
244
260
  package_path ||= Dir.pwd
245
261
  local = BPM::Local.new
246
262
  package = local.pack(File.join(package_path, "package.json"), options[:email])
247
263
 
248
264
  if package.errors.empty?
249
- puts "Successfully built package: #{package.to_ext}"
265
+ puts "Successfully built package: #{package.file_name}"
250
266
  else
251
267
  failure_message = "BPM encountered the following problems building your package:"
252
268
  package.errors.each do |error|
@@ -254,6 +270,8 @@ module BPM
254
270
  end
255
271
  abort failure_message
256
272
  end
273
+ rescue BPM::Error => e
274
+ abort e.message
257
275
  end
258
276
 
259
277
  desc "unpack [PACKAGE]", "Extract files from a bpm package"
@@ -264,7 +282,7 @@ module BPM
264
282
  paths.each do |path|
265
283
  begin
266
284
  package = local.unpack(path, options[:target])
267
- unpack_path = File.expand_path(File.join(Dir.pwd, options[:target], package.to_full_name))
285
+ unpack_path = File.expand_path(File.join(Dir.pwd, options[:target], package.full_name))
268
286
  puts "Unpacked package into: #{unpack_path}"
269
287
  rescue Errno::EACCES, LibGems::FilePermissionError => ex
270
288
  abort "There was a problem unpacking #{path}:\n#{ex.message}"
@@ -272,6 +290,21 @@ module BPM
272
290
  end
273
291
  end
274
292
 
293
+ desc "debug [OPTION]", "Display various options for debugging"
294
+ method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
295
+ method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Build mode (default debug)'
296
+ def debug(option)
297
+ case option
298
+ when 'build'
299
+ say JSON.pretty_generate find_project.build_settings(options[:mode].to_sym)
300
+ when 'repair'
301
+ say "Verifying and repairing project..."
302
+ find_project.verify_and_repair options[:mode].to_sym, true
303
+ else
304
+ abort "Do not know how to display #{option}"
305
+ end
306
+ end
307
+
275
308
  private
276
309
 
277
310
  def get_generator(type, package=nil)
@@ -280,15 +313,33 @@ module BPM
280
313
  package ? package.generator_for(type) : BPM.generator_for(type)
281
314
  end
282
315
 
283
- def run_init(name, path, package=nil)
284
- template_path = package ? package.template_path(:init) : nil
316
+ def run_init(name, include_app, path, package=nil)
317
+
318
+ # we only need to create a new project.json if one does not
319
+ # already exist.
320
+ unless BPM::Project.is_project_root? path
321
+ template_path = package ? package.template_path(:init) : nil
285
322
 
286
- generator = get_generator(:init, package)
287
- generator.new(self, name, path, template_path, package).run
323
+ generator = get_generator(:init, package)
324
+ generator.new(self, name, path, template_path, package).run
325
+ end
288
326
 
327
+ # make sure the project app status matches
289
328
  project = BPM::Project.new(path, name)
290
- project.fetch_dependencies true
291
- project.build :debug, true
329
+
330
+ if project.build_app? != !!include_app
331
+ project.build_app = include_app
332
+ project.save!
333
+ end
334
+
335
+ project.build :production, true
336
+
337
+ if package
338
+ deps = {}
339
+ deps[package.name] = package.version
340
+ project.add_dependencies deps, false, true
341
+ end
342
+
292
343
  end
293
344
 
294
345
  def report_arity_error(name)
data/lib/bpm/errors.rb ADDED
@@ -0,0 +1,51 @@
1
+ module BPM
2
+
3
+ class Error < StandardError
4
+
5
+ def format_message(*args)
6
+ args.join ","
7
+ end
8
+
9
+ def initialize(*args)
10
+ super format_message(*args)
11
+ end
12
+ end
13
+
14
+ class InvalidPackageError < BPM::Error
15
+ def format_message(package, msg=nil)
16
+ msg = msg.nil? ? '' : ": #{msg}"
17
+ "There was a problem parsing #{File.basename(package.json_path)}#{msg}"
18
+ end
19
+ end
20
+
21
+ class InvalidPackageNameError < BPM::InvalidPackageError
22
+ def format_message(package)
23
+ "Package at #{package.root_path} name and directory do not match. (name: #{package.name}). Change the directory or package.json name to match."
24
+ end
25
+ end
26
+
27
+ class PackageNotFoundError < BPM::Error
28
+ def format_message(name, version)
29
+ "Could not find eligible package for '#{name}' (#{version})"
30
+ end
31
+ end
32
+
33
+ class MinifierNotFoundError < PackageNotFoundError
34
+ def format_message(minifier_name)
35
+ "Minifier package #{minifier_name} was not found. Try running bpm update to refresh."
36
+ end
37
+ end
38
+
39
+ class PackageConflictError < BPM::Error
40
+ def format_message(name, version_a, version_b)
41
+ "Conflicting requirement for '#{name}' (requires #{version_a} and #{version_b})"
42
+ end
43
+ end
44
+
45
+ class LocalPackageConflictError < PackageConflictError
46
+ def format_message(name, version_a, version_b)
47
+ "Local package '#{name}' (#{version_b}) is not compatible with required version #{version_a}"
48
+ end
49
+ end
50
+
51
+ end
@@ -6,7 +6,7 @@ module BPM
6
6
  source_root File.join(::BPM::TEMPLATES_DIR, 'init')
7
7
 
8
8
  def bpm_version
9
- BPM::VERSION
9
+ BPM::COMPAT_VERSION
10
10
  end
11
11
 
12
12
  def run
@@ -16,13 +16,6 @@ module BPM
16
16
  template "project.json", "#{name}.json"
17
17
  end
18
18
 
19
- empty_directory "assets"
20
-
21
- inside "assets" do
22
- template "bpm_packages.js"
23
- template "bpm_styles.css"
24
- end
25
-
26
19
  true
27
20
  end
28
21
 
@@ -36,4 +36,13 @@ module LibGems
36
36
  set_home(ENV['BPM_HOME'] || LibGems.configuration.home || default_dir) unless @gem_home
37
37
  @gem_home
38
38
  end
39
+
40
+ def self.with_silence
41
+ original_verbose = LibGems.configuration.verbose
42
+ LibGems.configuration.verbose = false
43
+ yield
44
+ ensure
45
+ LibGems.configuration.verbose = original_verbose
46
+ end
47
+
39
48
  end
data/lib/bpm/local.rb CHANGED
@@ -29,9 +29,9 @@ module BPM
29
29
  end
30
30
 
31
31
  def unpack(path, target)
32
- package = BPM::Package.new
33
- package.bpkg = path
34
- unpack_dir = File.expand_path(File.join(Dir.pwd, target, package.to_full_name))
32
+ package = BPM::Package.new
33
+ package.fill_from_gemspec(path)
34
+ unpack_dir = File.expand_path(File.join(Dir.pwd, target, package.full_name))
35
35
  LibGems::Installer.new(path, :unpack => true).unpack unpack_dir
36
36
  package
37
37
  end
@@ -44,22 +44,17 @@ module BPM
44
44
  end
45
45
  end
46
46
 
47
- def preferred_version(package, vers, prerelease)
47
+ def preferred_version(package, vers)
48
48
  dep = LibGems::Dependency.new package, vers
49
49
  specs = LibGems.source_index.search dep
50
50
  specs.last.version.to_s
51
51
  end
52
52
 
53
- def source_root(package, vers, prerelease)
53
+ def source_root(package, vers)
54
54
  dep = LibGems::Dependency.new package, vers
55
55
  specs = LibGems.source_index.search dep
56
-
57
- dep2 = LibGems::Dependency.new package, '>= 0'
58
- specs2 = LibGems.source_index.search dep2
59
-
60
56
  spec = specs.last
61
- spec &&
62
- File.join(spec.installation_path, 'gems', "#{spec.name}-#{spec.version}")
57
+ spec && File.join(spec.installation_path, 'gems', "#{spec.name}-#{spec.version}")
63
58
  end
64
59
 
65
60
  private