bpm 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/.gitignore +4 -0
  2. data/.gitmodules +0 -0
  3. data/Gemfile +16 -0
  4. data/README.md +55 -0
  5. data/TODO.md +3 -0
  6. data/bin/bpm +8 -0
  7. data/bpm.gemspec +41 -0
  8. data/lib/bpm.rb +18 -0
  9. data/lib/bpm/cli.rb +6 -0
  10. data/lib/bpm/cli/base.rb +358 -0
  11. data/lib/bpm/cli/owner.rb +46 -0
  12. data/lib/bpm/credentials.rb +36 -0
  13. data/lib/bpm/default.json +9 -0
  14. data/lib/bpm/generator.rb +69 -0
  15. data/lib/bpm/init_generator.rb +43 -0
  16. data/lib/bpm/libgems_ext.rb +11 -0
  17. data/lib/bpm/libgems_ext/config_file.rb +33 -0
  18. data/lib/bpm/libgems_ext/dependency_installer.rb +150 -0
  19. data/lib/bpm/libgems_ext/installer.rb +39 -0
  20. data/lib/bpm/libgems_ext/libgems.rb +39 -0
  21. data/lib/bpm/libgems_ext/spec_fetcher.rb +11 -0
  22. data/lib/bpm/local.rb +76 -0
  23. data/lib/bpm/package.rb +277 -0
  24. data/lib/bpm/pipeline.rb +100 -0
  25. data/lib/bpm/pipeline/directive_processor.rb +47 -0
  26. data/lib/bpm/pipeline/generated_asset.rb +68 -0
  27. data/lib/bpm/pipeline/transport_processor.rb +32 -0
  28. data/lib/bpm/project.rb +427 -0
  29. data/lib/bpm/project_generator.rb +34 -0
  30. data/lib/bpm/remote.rb +104 -0
  31. data/lib/bpm/repository.rb +18 -0
  32. data/lib/bpm/server.rb +44 -0
  33. data/lib/bpm/version.rb +3 -0
  34. data/spec/cli/add_spec.rb +159 -0
  35. data/spec/cli/build_spec.rb +87 -0
  36. data/spec/cli/fetch_spec.rb +135 -0
  37. data/spec/cli/fetched_spec.rb +52 -0
  38. data/spec/cli/init_spec.rb +50 -0
  39. data/spec/cli/list_spec.rb +74 -0
  40. data/spec/cli/login_spec.rb +110 -0
  41. data/spec/cli/new_spec.rb +92 -0
  42. data/spec/cli/owner_spec.rb +114 -0
  43. data/spec/cli/push_spec.rb +73 -0
  44. data/spec/cli/remove_spec.rb +84 -0
  45. data/spec/cli/unpack_spec.rb +72 -0
  46. data/spec/cli/unyank_spec.rb +73 -0
  47. data/spec/cli/yank_spec.rb +73 -0
  48. data/spec/credentials_spec.rb +23 -0
  49. data/spec/fixtures/badrake-0.8.7.spd +0 -0
  50. data/spec/fixtures/builder-3.0.0.spd +0 -0
  51. data/spec/fixtures/bundler-1.1.pre.spd +0 -0
  52. data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
  53. data/spec/fixtures/core-test-0.4.9.spd +0 -0
  54. data/spec/fixtures/core-test/bin/cot +3 -0
  55. data/spec/fixtures/core-test/lib/main.js +1 -0
  56. data/spec/fixtures/core-test/package.json +46 -0
  57. data/spec/fixtures/core-test/resources/runner.css +1 -0
  58. data/spec/fixtures/core-test/tests/test.js +1 -0
  59. data/spec/fixtures/custom_generator-1.0.spd +0 -0
  60. data/spec/fixtures/custom_generator/lib/main.js +1 -0
  61. data/spec/fixtures/custom_generator/package.json +12 -0
  62. data/spec/fixtures/custom_generator/templates/init/project.json +19 -0
  63. data/spec/fixtures/custom_generator/templates/project/app.js +1 -0
  64. data/spec/fixtures/custom_generator/templates/project/lib/main.js +0 -0
  65. data/spec/fixtures/custom_generator/templates/project_generator.rb +20 -0
  66. data/spec/fixtures/hello_world/LICENSE +19 -0
  67. data/spec/fixtures/hello_world/README.md +21 -0
  68. data/spec/fixtures/hello_world/assets/bpm_packages.js +13 -0
  69. data/spec/fixtures/hello_world/assets/bpm_styles.css +14 -0
  70. data/spec/fixtures/hello_world/assets/papa-smurf.jpg +0 -0
  71. data/spec/fixtures/hello_world/hello_world.json +20 -0
  72. data/spec/fixtures/hello_world/lib/main.js +9 -0
  73. data/spec/fixtures/hello_world/packages/custom_package/assets/dummy.txt +1 -0
  74. data/spec/fixtures/hello_world/packages/custom_package/css/sample_styles.css +3 -0
  75. data/spec/fixtures/hello_world/packages/custom_package/custom_dir/basic-module.js +1 -0
  76. data/spec/fixtures/hello_world/packages/custom_package/lib/main.js +1 -0
  77. data/spec/fixtures/hello_world/packages/custom_package/package.json +22 -0
  78. data/spec/fixtures/hello_world/tests/main-test.js +8 -0
  79. data/spec/fixtures/highline-1.6.1.spd +0 -0
  80. data/spec/fixtures/ivory-0.0.1.spd +0 -0
  81. data/spec/fixtures/jquery-1.4.3.spd +0 -0
  82. data/spec/fixtures/optparse-1.0.1.spd +0 -0
  83. data/spec/fixtures/rake-0.8.6.spd +0 -0
  84. data/spec/fixtures/rake-0.8.7.spd +0 -0
  85. data/spec/fixtures/simple_hello/assets/bpm_packages.js +1 -0
  86. data/spec/fixtures/simple_hello/lib/main.js +1 -0
  87. data/spec/fixtures/spade-0.5.0.spd +0 -0
  88. data/spec/fixtures/src/README.txt +1 -0
  89. data/spec/fixtures/src/bundler-1.1.pre/.gitignore +22 -0
  90. data/spec/fixtures/src/bundler-1.1.pre/CHANGELOG.md +646 -0
  91. data/spec/fixtures/src/bundler-1.1.pre/ISSUES.md +47 -0
  92. data/spec/fixtures/src/bundler-1.1.pre/LICENSE +21 -0
  93. data/spec/fixtures/src/bundler-1.1.pre/README.md +29 -0
  94. data/spec/fixtures/src/bundler-1.1.pre/UPGRADING.md +103 -0
  95. data/spec/fixtures/src/bundler-1.1.pre/bin/bundle +20 -0
  96. data/spec/fixtures/src/bundler-1.1.pre/lib/bundler.js +23 -0
  97. data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/definition.js +14 -0
  98. data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dependency.js +15 -0
  99. data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dsl.js +9 -0
  100. data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/ui.js +6 -0
  101. data/spec/fixtures/src/bundler-1.1.pre/man/bundle-config.ronn +90 -0
  102. data/spec/fixtures/src/bundler-1.1.pre/man/bundle-exec.ronn +111 -0
  103. data/spec/fixtures/src/bundler-1.1.pre/man/bundle-install.ronn +314 -0
  104. data/spec/fixtures/src/bundler-1.1.pre/man/bundle-package.ronn +59 -0
  105. data/spec/fixtures/src/bundler-1.1.pre/man/bundle-update.ronn +176 -0
  106. data/spec/fixtures/src/bundler-1.1.pre/man/bundle.ronn +80 -0
  107. data/spec/fixtures/src/bundler-1.1.pre/man/gemfile.5.ronn +279 -0
  108. data/spec/fixtures/src/bundler-1.1.pre/man/index.txt +6 -0
  109. data/spec/fixtures/src/bundler-1.1.pre/package.json +19 -0
  110. data/spec/fixtures/src/coffee-1.0.1.pre/bin/cake +0 -0
  111. data/spec/fixtures/src/coffee-1.0.1.pre/bin/coffee +0 -0
  112. data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee.js +0 -0
  113. data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/base.js +0 -0
  114. data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/mocha/chai.js +0 -0
  115. data/spec/fixtures/src/coffee-1.0.1.pre/package.json +19 -0
  116. data/spec/fixtures/src/coffee-1.0.1.pre/qunit/coffee/test.js +0 -0
  117. data/spec/fixtures/src/coffee-1.0.1.pre/qunit/test.js +0 -0
  118. data/spec/fixtures/src/jquery/lib/main.js +7179 -0
  119. data/spec/fixtures/src/jquery/package.json +15 -0
  120. data/spec/fixtures/src/rake-0.8.6/CHANGES +436 -0
  121. data/spec/fixtures/src/rake-0.8.6/MIT-LICENSE +21 -0
  122. data/spec/fixtures/src/rake-0.8.6/README +196 -0
  123. data/spec/fixtures/src/rake-0.8.6/Rakefile +430 -0
  124. data/spec/fixtures/src/rake-0.8.6/TODO +20 -0
  125. data/spec/fixtures/src/rake-0.8.6/bin/rake +31 -0
  126. data/spec/fixtures/src/rake-0.8.6/doc/command_line_usage.rdoc +102 -0
  127. data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile1 +38 -0
  128. data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile2 +35 -0
  129. data/spec/fixtures/src/rake-0.8.6/doc/example/a.c +6 -0
  130. data/spec/fixtures/src/rake-0.8.6/doc/example/b.c +6 -0
  131. data/spec/fixtures/src/rake-0.8.6/doc/example/main.c +11 -0
  132. data/spec/fixtures/src/rake-0.8.6/doc/glossary.rdoc +51 -0
  133. data/spec/fixtures/src/rake-0.8.6/doc/jamis.rb +591 -0
  134. data/spec/fixtures/src/rake-0.8.6/doc/proto_rake.rdoc +127 -0
  135. data/spec/fixtures/src/rake-0.8.6/doc/rake.1.gz +0 -0
  136. data/spec/fixtures/src/rake-0.8.6/doc/rakefile.rdoc +534 -0
  137. data/spec/fixtures/src/rake-0.8.6/doc/rational.rdoc +151 -0
  138. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.14.rdoc +23 -0
  139. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.15.rdoc +35 -0
  140. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.0.rdoc +53 -0
  141. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.3.rdoc +78 -0
  142. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.4.rdoc +46 -0
  143. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.6.0.rdoc +141 -0
  144. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.0.rdoc +119 -0
  145. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.1.rdoc +59 -0
  146. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.2.rdoc +121 -0
  147. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.3.rdoc +47 -0
  148. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.0.rdoc +114 -0
  149. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.2.rdoc +165 -0
  150. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.3.rdoc +112 -0
  151. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.4.rdoc +147 -0
  152. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.5.rdoc +53 -0
  153. data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.6.rdoc +55 -0
  154. data/spec/fixtures/src/rake-0.8.6/install.rb +88 -0
  155. data/spec/fixtures/src/rake-0.8.6/lib/rake.rb +2502 -0
  156. data/spec/fixtures/src/rake-0.8.6/lib/rake/alt_system.rb +108 -0
  157. data/spec/fixtures/src/rake-0.8.6/lib/rake/classic_namespace.rb +8 -0
  158. data/spec/fixtures/src/rake-0.8.6/lib/rake/clean.rb +33 -0
  159. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/compositepublisher.rb +24 -0
  160. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/ftptools.rb +153 -0
  161. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/publisher.rb +75 -0
  162. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  163. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sshpublisher.rb +47 -0
  164. data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sys.rb +209 -0
  165. data/spec/fixtures/src/rake-0.8.6/lib/rake/gempackagetask.rb +97 -0
  166. data/spec/fixtures/src/rake-0.8.6/lib/rake/loaders/makefile.rb +42 -0
  167. data/spec/fixtures/src/rake-0.8.6/lib/rake/packagetask.rb +184 -0
  168. data/spec/fixtures/src/rake-0.8.6/lib/rake/rake_test_loader.rb +5 -0
  169. data/spec/fixtures/src/rake-0.8.6/lib/rake/rdoctask.rb +209 -0
  170. data/spec/fixtures/src/rake-0.8.6/lib/rake/ruby182_test_unit_fix.rb +23 -0
  171. data/spec/fixtures/src/rake-0.8.6/lib/rake/runtest.rb +23 -0
  172. data/spec/fixtures/src/rake-0.8.6/lib/rake/tasklib.rb +23 -0
  173. data/spec/fixtures/src/rake-0.8.6/lib/rake/testtask.rb +161 -0
  174. data/spec/fixtures/src/rake-0.8.6/lib/rake/win32.rb +55 -0
  175. data/spec/fixtures/src/rake-0.8.6/package.json +18 -0
  176. data/spec/fixtures/src/rake-0.8.6/test/capture_stdout.rb +26 -0
  177. data/spec/fixtures/src/rake-0.8.7/CHANGES +440 -0
  178. data/spec/fixtures/src/rake-0.8.7/MIT-LICENSE +21 -0
  179. data/spec/fixtures/src/rake-0.8.7/README +196 -0
  180. data/spec/fixtures/src/rake-0.8.7/Rakefile +430 -0
  181. data/spec/fixtures/src/rake-0.8.7/TODO +20 -0
  182. data/spec/fixtures/src/rake-0.8.7/bin/rake +31 -0
  183. data/spec/fixtures/src/rake-0.8.7/doc/command_line_usage.rdoc +102 -0
  184. data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile1 +38 -0
  185. data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile2 +35 -0
  186. data/spec/fixtures/src/rake-0.8.7/doc/example/a.c +6 -0
  187. data/spec/fixtures/src/rake-0.8.7/doc/example/b.c +6 -0
  188. data/spec/fixtures/src/rake-0.8.7/doc/example/main.c +11 -0
  189. data/spec/fixtures/src/rake-0.8.7/doc/glossary.rdoc +51 -0
  190. data/spec/fixtures/src/rake-0.8.7/doc/jamis.rb +591 -0
  191. data/spec/fixtures/src/rake-0.8.7/doc/proto_rake.rdoc +127 -0
  192. data/spec/fixtures/src/rake-0.8.7/doc/rake.1.gz +0 -0
  193. data/spec/fixtures/src/rake-0.8.7/doc/rakefile.rdoc +534 -0
  194. data/spec/fixtures/src/rake-0.8.7/doc/rational.rdoc +151 -0
  195. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +23 -0
  196. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +35 -0
  197. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +53 -0
  198. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +78 -0
  199. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +46 -0
  200. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +141 -0
  201. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +119 -0
  202. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +59 -0
  203. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +121 -0
  204. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +47 -0
  205. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +114 -0
  206. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +165 -0
  207. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +112 -0
  208. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +147 -0
  209. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +53 -0
  210. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +55 -0
  211. data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +55 -0
  212. data/spec/fixtures/src/rake-0.8.7/install.rb +88 -0
  213. data/spec/fixtures/src/rake-0.8.7/lib/rake.rb +2506 -0
  214. data/spec/fixtures/src/rake-0.8.7/lib/rake/alt_system.rb +108 -0
  215. data/spec/fixtures/src/rake-0.8.7/lib/rake/classic_namespace.rb +8 -0
  216. data/spec/fixtures/src/rake-0.8.7/lib/rake/clean.rb +33 -0
  217. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +24 -0
  218. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/ftptools.rb +153 -0
  219. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/publisher.rb +75 -0
  220. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  221. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +47 -0
  222. data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sys.rb +209 -0
  223. data/spec/fixtures/src/rake-0.8.7/lib/rake/gempackagetask.rb +97 -0
  224. data/spec/fixtures/src/rake-0.8.7/lib/rake/loaders/makefile.rb +42 -0
  225. data/spec/fixtures/src/rake-0.8.7/lib/rake/packagetask.rb +184 -0
  226. data/spec/fixtures/src/rake-0.8.7/lib/rake/rake_test_loader.rb +5 -0
  227. data/spec/fixtures/src/rake-0.8.7/lib/rake/rdoctask.rb +209 -0
  228. data/spec/fixtures/src/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +23 -0
  229. data/spec/fixtures/src/rake-0.8.7/lib/rake/runtest.rb +23 -0
  230. data/spec/fixtures/src/rake-0.8.7/lib/rake/tasklib.rb +23 -0
  231. data/spec/fixtures/src/rake-0.8.7/lib/rake/testtask.rb +161 -0
  232. data/spec/fixtures/src/rake-0.8.7/lib/rake/win32.rb +55 -0
  233. data/spec/fixtures/src/rake-0.8.7/package.json +18 -0
  234. data/spec/fixtures/src/rake-0.8.7/test/capture_stdout.rb +26 -0
  235. data/spec/fixtures/src/spade/lib/main.js +1 -0
  236. data/spec/fixtures/src/spade/package.json +15 -0
  237. data/spec/fixtures/transporter/lib/main.js +3 -0
  238. data/spec/fixtures/transporter/packages/transport/lib/wrapper.js +5 -0
  239. data/spec/fixtures/transporter/packages/transport/package.json +21 -0
  240. data/spec/fixtures/transporter/transporter.json +18 -0
  241. data/spec/gauntlet_spec.rb +33 -0
  242. data/spec/package_spec.rb +319 -0
  243. data/spec/pipeline_spec.rb +213 -0
  244. data/spec/project_spec.rb +130 -0
  245. data/spec/spec_helper.rb +42 -0
  246. data/spec/support/cli.rb +93 -0
  247. data/spec/support/env.rb +18 -0
  248. data/spec/support/fake.rb +53 -0
  249. data/spec/support/fake_gem_server.rb +72 -0
  250. data/spec/support/fake_gemcutter.rb +50 -0
  251. data/spec/support/matchers.rb +32 -0
  252. data/spec/support/path.rb +63 -0
  253. data/spec/support/project.rb +43 -0
  254. data/templates/init/assets/bpm_packages.js +7 -0
  255. data/templates/init/assets/bpm_styles.css +7 -0
  256. data/templates/init/project.json +16 -0
  257. data/templates/project/LICENSE +19 -0
  258. data/templates/project/README.md +21 -0
  259. data/templates/project/app.js +1 -0
  260. data/templates/project/index.html +13 -0
  261. metadata +627 -0
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ tmp
2
+ devbin
3
+ .bundle
4
+ Gemfile.lock
data/.gitmodules ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ if ENV["SPADE_PATH"]
5
+ gem 'spade', :path => ENV["SPADE_PATH"]
6
+ else
7
+ gem 'spade', :git => "git://github.com/sproutcore/spade-ruby"
8
+ end
9
+
10
+ if ENV["SPOCKETS_PATH"]
11
+ gem 'sprockets', :path => ENV["SPROCKETS_PATH"]
12
+ else
13
+ gem 'sprockets', :git => "git://github.com/sstephenson/sprockets"
14
+ end
15
+
16
+ gemspec
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ bpm - browser packager manager
2
+
3
+ bpm is a system for managing resource dependencies for client-side browser
4
+ applications. It is inspired by npm, but has better support for the unique
5
+ needs of browser applications including:
6
+
7
+ * Supports multiple module loaders (i.e. you can choose RequireJS, spade or
8
+ even no loader at all)
9
+ * Handles non-JS assets such as CSS and images. (Support for SCSS/Sass
10
+ coming soon)
11
+ * Can autocompile other languages such as CoffeeScript.
12
+
13
+ bpm also implements a basic build system that generates cache-optimized
14
+ assets.
15
+
16
+ Finally, bpm is based on the rubygems library. Although you don't need to
17
+ know any ruby to use bpm, this means that we also benefit from nearly 10 years
18
+ of lessons learned to jump start bpm.
19
+
20
+ # Workflow Quick Start
21
+
22
+ Once you have bpm installed (see below), create a demo app like so:
23
+
24
+ bpm new my_app
25
+ cd my_app
26
+
27
+ Then add jquery as a dependency:
28
+
29
+ bpm add jquery
30
+
31
+ This will create a file called `assets/bpm_packages.js` which will include
32
+ jquery. You can then create an index.html and reference that js. Everytime
33
+ you add a dependency, it will be based into this JS file .
34
+
35
+ Note that there is also a CSS file at `assets/bpm_styles.css` - we do the same
36
+ thing there.
37
+
38
+ # Installing
39
+
40
+ When we release, bpm will be available via PKG and MSI installers as well as via rubygems. For now the best way to try bpm is to clone it from github and then:
41
+
42
+ `bundle install`
43
+
44
+ From the directory. (If you don't have bundler, you will need ruby 1.9.2 installed and type `gem install bundler` to get it.)
45
+
46
+ # Current Development Status
47
+
48
+ Alpha. You should be able to work the basic system, but some features are
49
+ still incomplete including:
50
+
51
+ * SASS and other CSS plugins
52
+ * Format plugins (i.e. CoffeeScript)
53
+ * Minification plugins
54
+ * lots of other stuff I am forgetting
55
+ * node support - you will eventually be able to run JS that doesn't require the DOM in node. We've prototyped this but it needs to be polished still.
data/TODO.md ADDED
@@ -0,0 +1,3 @@
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.
3
+
data/bin/bpm ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
3
+ $:.unshift(lib) if File.exists?(lib)
4
+
5
+ require 'bpm'
6
+
7
+ BPM::CLI::Base.start
8
+
data/bpm.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'bpm/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "bpm"
9
+ s.version = BPM::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Charles Jolley", "Peter Wagenet"]
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"
15
+
16
+ mswin = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
17
+ mri = !mswin && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
18
+
19
+ s.add_dependency "libgems", "~> 0.0.2"
20
+ s.add_dependency "gemcutter", "~> 0.6.1"
21
+ s.add_dependency "highline", "~> 1.6.1"
22
+ s.add_dependency "json_pure", "~> 1.4.6"
23
+ s.add_dependency "thor", "~> 0.14.3"
24
+ s.add_dependency "sprockets"
25
+ s.add_dependency "spade"
26
+
27
+ s.add_development_dependency "rspec"
28
+ s.add_development_dependency "rack", "~> 1.2.1"
29
+
30
+ paths = `git submodule`.split("\n").map do |line|
31
+ path = line.gsub(/^ \w+ ([^\s]+) .+$/,'\1')
32
+ `cd #{path}; git ls-files`.split("\n").map { |p| File.join(path, p) }
33
+ end
34
+ paths << `git ls-files`.split("\n")
35
+ s.files = paths.flatten
36
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
37
+
38
+ s.executables = ['bpm']
39
+ s.require_paths = ["lib"]
40
+ end
41
+
data/lib/bpm.rb ADDED
@@ -0,0 +1,18 @@
1
+ module BPM
2
+ BPM_DIR = ".bpm"
3
+ TEMPLATES_DIR = File.expand_path("../../templates", __FILE__)
4
+
5
+ autoload :CLI, 'bpm/cli'
6
+ autoload :Credentials, 'bpm/credentials'
7
+ autoload :Local, 'bpm/local'
8
+ autoload :Package, 'bpm/package'
9
+ autoload :Remote, 'bpm/remote'
10
+ autoload :Repository, 'bpm/repository'
11
+ autoload :Project, 'bpm/project'
12
+ autoload :Server, 'bpm/server'
13
+
14
+ end
15
+
16
+ require 'bpm/libgems_ext'
17
+ require 'bpm/pipeline'
18
+
data/lib/bpm/cli.rb ADDED
@@ -0,0 +1,6 @@
1
+ module BPM
2
+ module CLI
3
+ autoload :Base, 'bpm/cli/base'
4
+ autoload :Owner, 'bpm/cli/owner'
5
+ end
6
+ end
@@ -0,0 +1,358 @@
1
+ require 'thor'
2
+ require 'highline'
3
+
4
+ module BPM
5
+ module CLI
6
+ LOGIN_MESSAGE = "Please login first with `bpm login`."
7
+
8
+ class Base < Thor
9
+
10
+ class_option :verbose, :type => :boolean, :default => false,
11
+ :aliases => ['-V'],
12
+ :desc => 'Show additional debug information while running'
13
+
14
+ desc "owner", "Manage users for a package"
15
+ subcommand "owner", BPM::CLI::Owner
16
+
17
+ desc "fetch [PACKAGE]", "Fetch one or many bpm packages to local cache"
18
+ method_option :version, :type => :string, :default => ">= 0", :aliases => ['-v'], :desc => 'Specify a version to install'
19
+ method_option :prerelease, :type => :boolean, :default => false, :aliases => ['--pre'], :desc => 'Install a prerelease version'
20
+ def fetch(*packages)
21
+ project = BPM::Project.nearest_project(Dir.pwd) if packages.empty?
22
+ if project
23
+ success = project.fetch_dependencies options[:verbose]
24
+ if !success
25
+ abort project.errors * "\n"
26
+ else
27
+ say "Fetched dependent packages for #{project.name}"
28
+ end
29
+
30
+ else
31
+ report_arity_error("fetch") and return if packages.size.zero?
32
+
33
+ begin
34
+ packages.each do |package|
35
+ installed = BPM::Remote.new.install(package, options[:version], options[:prerelease])
36
+ installed.each do |spec|
37
+ say "Successfully fetched #{spec.name} (#{spec.version})"
38
+ end
39
+ end
40
+ rescue LibGems::InstallError => e
41
+ abort "Fetch error: #{e}"
42
+ rescue LibGems::GemNotFoundException => e
43
+ abort "Can't find package #{e.name} #{e.version} available for fetch"
44
+ rescue Errno::EACCES, LibGems::FilePermissionError => e
45
+ abort e.message
46
+ end
47
+ end
48
+ end
49
+
50
+
51
+ desc "fetched [PACKAGE]", "Shows what bpm packages are fetched"
52
+ def fetched(*packages)
53
+ local = BPM::Local.new
54
+ index = local.installed(packages)
55
+ print_specs(packages, index)
56
+ end
57
+
58
+ desc "add [PACKAGE]", "Add package to project"
59
+ method_option :version, :type => :string, :default => ">= 0", :aliases => ['-v'], :desc => 'Specify a version to install'
60
+ method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
61
+ method_option :prerelease, :type => :boolean, :default => false, :aliases => ['--pre'], :desc => 'Install a prerelease version'
62
+ def add(*package_names)
63
+
64
+ # map to dependencies
65
+ if package_names.size.zero?
66
+ abort "You must specify at least one package"
67
+ elsif package_names.size == 1
68
+ deps = {}
69
+ vers = options[:version]
70
+ vers = '>= 0-pre' if vers == '>= 0' && options[:prerelease]
71
+ deps[package_names.first] = vers
72
+ else
73
+ if options[:version] != '>= 0'
74
+ abort "You can only name one package with the version option"
75
+ end
76
+
77
+ deps = {}
78
+ vers = options[:prerelease] ? '>= 0-pre' : '>= 0'
79
+ package_names.each { |name| deps[name] = vers }
80
+ end
81
+
82
+ # find project
83
+ project = find_project
84
+
85
+ begin
86
+ project.add_dependencies deps, true
87
+ project.build :debug, true
88
+ # rescue Exception => e
89
+ # abort e.message
90
+ end
91
+ end
92
+
93
+ desc "remove [PACKAGE]", "Remove package from project"
94
+ method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
95
+ def remove(*package_names)
96
+
97
+ # map to dependencies
98
+ if package_names.size.zero?
99
+ abort "You must specify at least one package"
100
+ end
101
+
102
+ begin
103
+ project = find_project
104
+ project.unbuild options[:verbose]
105
+ project.remove_dependencies package_names, true
106
+ project.build :debug, true
107
+
108
+ rescue Exception => e
109
+ abort e.message
110
+ end
111
+ end
112
+
113
+ desc "autocompile", "Preview server that will autocompile assets. Useful for hacking"
114
+ method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Set build mode for compile (default debug)'
115
+ method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
116
+ method_option :port, :type => :string, :default => '4020', :desc => "Port to host server on"
117
+ def autocompile
118
+
119
+ project = find_project
120
+ puts project
121
+ BPM::Server.start project, :Port => options[:port]
122
+
123
+ end
124
+
125
+ desc "compile", "Build the bpm_package.js for development"
126
+ method_option :mode, :type => :string, :default => :debug, :aliases => ['-m'], :desc => 'Set build mode for compile (default debug)'
127
+ method_option :project, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify project location other than working directory'
128
+ def compile
129
+
130
+ begin
131
+ project = find_project
132
+ project.fetch_dependencies options[:verbose]
133
+ project.build options[:mode], options[:verbose]
134
+ rescue Exception => e
135
+ abort e.message
136
+ end
137
+ end
138
+
139
+ desc "login", "Log in with your BPM credentials"
140
+ method_option :username, :type => :string, :default => nil, :aliases => ['-u'], :desc => 'Specify the username to login as'
141
+ method_option :password, :type => :string, :default => nil, :aliases => ['-p'], :desc => 'Specify the login password'
142
+ def login
143
+ email = options[:username]
144
+ password = options[:password]
145
+
146
+ unless email && password
147
+ highline = HighLine.new
148
+ say "Enter your BPM credentials."
149
+
150
+ begin
151
+ email ||= highline.ask "\nEmail:" do |q|
152
+ next unless STDIN.tty?
153
+ q.readline = true
154
+ end
155
+
156
+ password ||= highline.ask "\nPassword:" do |q|
157
+ next unless STDIN.tty?
158
+ q.echo = "*"
159
+ end
160
+ rescue Interrupt => ex
161
+ abort "Cancelled login."
162
+ end
163
+ end
164
+
165
+ say "\nLogging in as #{email}..."
166
+
167
+ if BPM::Remote.new.login(email, password)
168
+ say "Logged in!"
169
+ else
170
+ say "Incorrect email or password."
171
+ login unless options[:username] && options[:password]
172
+ end
173
+ end
174
+
175
+ desc "push", "Distribute your bpm package"
176
+ def push(package)
177
+ remote = BPM::Remote.new
178
+ if remote.logged_in?
179
+ say remote.push(package)
180
+ else
181
+ say LOGIN_MESSAGE
182
+ end
183
+ end
184
+
185
+ desc "yank", "Remove a specific package version release from SproutCutter"
186
+ method_option :version, :type => :string, :default => nil, :aliases => ['-v'], :desc => 'Specify a version to yank'
187
+ method_option :undo, :type => :boolean, :default => false, :desc => 'Unyank package'
188
+ def yank(package)
189
+ if options[:version]
190
+ remote = BPM::Remote.new
191
+ if remote.logged_in?
192
+ if options[:undo]
193
+ say remote.unyank(package, options[:version])
194
+ else
195
+ say remote.yank(package, options[:version])
196
+ end
197
+ else
198
+ say LOGIN_MESSAGE
199
+ end
200
+ else
201
+ say "Version required"
202
+ end
203
+ end
204
+
205
+ desc "list", "View available packages for download"
206
+ method_option :all, :type => :boolean, :default => false, :aliases => ['-a'], :desc => 'List all versions available'
207
+ method_option :prerelease, :type => :boolean, :default => false, :aliases => ['--pre'], :desc => 'List prerelease versions available'
208
+ def list(*packages)
209
+ remote = BPM::Remote.new
210
+ index = remote.list_packages(packages, options[:all], options[:prerelease])
211
+ print_specs(packages, index)
212
+ end
213
+
214
+ desc "new [NAME]", "Generate a new project skeleton"
215
+ method_option :path, :type => :string, :default => nil, :desc => 'Specify a different name for the project'
216
+ method_option :package, :type => :string, :default => nil, :desc => 'Specify a package template to build from'
217
+ def new(name)
218
+ package = install_package(options[:package])
219
+ template_path = package ? package.template_path(:project) : nil
220
+
221
+ path = File.expand_path(options[:path] || underscore(name))
222
+ generator = get_generator(:project, package)
223
+ success = generator.new(self, name, path, template_path).run
224
+
225
+ run_init(name, path, package) if success
226
+ end
227
+
228
+ desc "init [PATHS]", "Configure a project to use bpm for management"
229
+ method_option :name, :type => :string, :default => nil, :desc => 'Specify a different name for the project'
230
+ method_option :skip, :type => :boolean, :default => false, :desc => 'Skip any conflicting files'
231
+ def init(*paths)
232
+ paths = [Dir.pwd] if paths.empty?
233
+ paths.map!{|p| File.expand_path(p) }
234
+
235
+ if paths.length > 1 && options[:name]
236
+ abort "Can't specify a name with multiple paths"
237
+ end
238
+
239
+ paths.each do |path|
240
+ run_init(options[:name] || File.basename(path), path)
241
+ end
242
+ end
243
+
244
+ desc "build [PACKAGE]", "Build a bpm package from a package.json"
245
+ method_option :email, :type => :string, :default => nil, :aliases => ['-e'], :desc => 'Specify an author email address'
246
+ def build(package_path=nil)
247
+ package_path ||= Dir.pwd
248
+ local = BPM::Local.new
249
+ package = local.pack(File.join(package_path, "package.json"), options[:email])
250
+
251
+ if package.errors.empty?
252
+ puts "Successfully built package: #{package.to_ext}"
253
+ else
254
+ failure_message = "BPM encountered the following problems building your package:"
255
+ package.errors.each do |error|
256
+ failure_message << "\n* #{error}"
257
+ end
258
+ abort failure_message
259
+ end
260
+ end
261
+
262
+ desc "unpack [PACKAGE]", "Extract files from a bpm package"
263
+ method_option :target, :type => :string, :default => ".", :aliases => ['-t'], :desc => 'Unpack to given directory'
264
+ def unpack(*paths)
265
+ local = BPM::Local.new
266
+
267
+ paths.each do |path|
268
+ begin
269
+ package = local.unpack(path, options[:target])
270
+ unpack_path = File.expand_path(File.join(Dir.pwd, options[:target], package.to_full_name))
271
+ puts "Unpacked package into: #{unpack_path}"
272
+ rescue Errno::EACCES, LibGems::FilePermissionError => ex
273
+ abort "There was a problem unpacking #{path}:\n#{ex.message}"
274
+ end
275
+ end
276
+ end
277
+
278
+ private
279
+
280
+ def get_generator(type, package=nil)
281
+ require 'bpm/generator'
282
+ generator_pkg = package ? package.name : :default
283
+ package ? package.generator_for(type) : BPM.generator_for(type)
284
+ end
285
+
286
+ def run_init(name, path, package=nil)
287
+ template_path = package ? package.template_path(:init) : nil
288
+
289
+ generator = get_generator(:init, package)
290
+ generator.new(self, name, path, package && template_path).run
291
+
292
+ project = BPM::Project.new(path, name)
293
+ project.fetch_dependencies true
294
+ project.build :debug, true
295
+ end
296
+
297
+ def report_arity_error(name)
298
+ self.class.handle_argument_error(self.class.tasks[name], nil)
299
+ end
300
+
301
+ def find_project
302
+ if options[:project]
303
+ project_path = File.expand_path options[:project]
304
+ if BPM::Project.is_project_root? project_path
305
+ abort "#{project_path} does not appear to be managed by bpm"
306
+ else
307
+ project = BPM::Project.new project_path
308
+ end
309
+ else
310
+ project = BPM::Project.nearest_project Dir.pwd
311
+ if project.nil?
312
+ abort "You do not appear to be inside of a bpm project"
313
+ end
314
+ end
315
+
316
+ project
317
+ end
318
+
319
+ def print_specs(names, index)
320
+ packages = {}
321
+
322
+ index.each do |(name, version, platform)|
323
+ packages[name] ||= []
324
+ packages[name] << version
325
+ end
326
+
327
+ if packages.size.zero?
328
+ abort %{No packages found matching "#{names.join('", "')}".}
329
+ else
330
+ packages.each do |name, versions|
331
+ puts "#{name} (#{versions.sort.reverse.join(", ")})"
332
+ end
333
+ end
334
+ end
335
+
336
+ def install_package(pkg_name)
337
+ return nil unless pkg_name
338
+ dep = LibGems::Dependency.new(pkg_name)
339
+ installed = LibGems.source_index.search(dep)
340
+ if installed.empty?
341
+ installed = BPM::Remote.new.install(pkg_name)
342
+ end
343
+ spec = installed.find{|p| p.name == pkg_name }
344
+ abort "Unable to find package: #{pkg_name}" unless spec
345
+ BPM::Package.from_spec(spec)
346
+ end
347
+
348
+ def underscore(str)
349
+ str.gsub(/::/, '/').
350
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
351
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
352
+ tr("-", "_").
353
+ downcase
354
+ end
355
+
356
+ end
357
+ end
358
+ end