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
@@ -0,0 +1,55 @@
1
+
2
+ module Rake
3
+ require 'rake/alt_system'
4
+
5
+ # Win 32 interface methods for Rake. Windows specific functionality
6
+ # will be placed here to collect that knowledge in one spot.
7
+ module Win32
8
+
9
+ # Error indicating a problem in locating the home directory on a
10
+ # Win32 system.
11
+ class Win32HomeError < RuntimeError
12
+ end
13
+
14
+ class << self
15
+ # True if running on a windows system.
16
+ def windows?
17
+ AltSystem::WINDOWS
18
+ end
19
+
20
+ # Run a command line on windows.
21
+ def rake_system(*cmd)
22
+ AltSystem.system(*cmd)
23
+ end
24
+
25
+ # The standard directory containing system wide rake files on
26
+ # Win 32 systems. Try the following environment variables (in
27
+ # order):
28
+ #
29
+ # * HOME
30
+ # * HOMEDRIVE + HOMEPATH
31
+ # * APPDATA
32
+ # * USERPROFILE
33
+ #
34
+ # If the above are not defined, the return nil.
35
+ def win32_system_dir #:nodoc:
36
+ win32_shared_path = ENV['HOME']
37
+ if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
38
+ win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
39
+ end
40
+
41
+ win32_shared_path ||= ENV['APPDATA']
42
+ win32_shared_path ||= ENV['USERPROFILE']
43
+ raise Win32HomeError, "Unable to determine home path environment variable." if
44
+ win32_shared_path.nil? or win32_shared_path.empty?
45
+ normalize(File.join(win32_shared_path, 'Rake'))
46
+ end
47
+
48
+ # Normalize a win32 path so that the slashes are all forward slashes.
49
+ def normalize(path)
50
+ path.gsub(/\\/, '/')
51
+ end
52
+
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rake",
3
+ "version": "0.8.7",
4
+ "description": "rake desc",
5
+ "summary": "rake summary",
6
+ "homepage": "http://rake.com",
7
+ "author": "Joe",
8
+ "keywords": ["rake"],
9
+
10
+ "dependencies": {},
11
+
12
+ "directories": {
13
+ "lib": "lib",
14
+ "test": "test",
15
+ "bin": "bin",
16
+ "doc": "doc"
17
+ }
18
+ }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'stringio'
4
+
5
+ # Mix-in for capturing standard output.
6
+ module CaptureStdout
7
+ def capture_stdout
8
+ s = StringIO.new
9
+ oldstdout = $stdout
10
+ $stdout = s
11
+ yield
12
+ s.string
13
+ ensure
14
+ $stdout = oldstdout
15
+ end
16
+
17
+ def capture_stderr
18
+ s = StringIO.new
19
+ oldstderr = $stderr
20
+ $stderr = s
21
+ yield
22
+ s.string
23
+ ensure
24
+ $stderr = oldstderr
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ // PLACEHOLDER FILE
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "spade",
3
+ "version": "0.5.0",
4
+ "description": "spade browser runtime",
5
+ "summary": "spade summary",
6
+ "homepage": "http://github.com/strobecorp/spade",
7
+ "author": "Charles Jolley",
8
+ "keywords": ["CommonJS", "runtime", "transport"],
9
+
10
+ "dependencies": {},
11
+
12
+ "directories": {
13
+ "lib": "lib"
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ //TRANSPORT
2
+ transporter();
3
+ //TRANSPORT
@@ -0,0 +1,5 @@
1
+
2
+ exports.compileTransport = function(body, pkg, moduleId) {
3
+ return "define_transport(function() {\n"+body+"\n});";
4
+ };
5
+
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "transport",
3
+ "version": "0.5.0",
4
+ "bpm": "0.1.0",
5
+
6
+ "description": "DESCRIPTION HERE",
7
+ "author": "YOUR NAME HERE",
8
+ "homepage": "URL",
9
+
10
+ "directories": {
11
+ "lib": "./lib",
12
+ "test": "./tests"
13
+ },
14
+
15
+ "dependencies": {
16
+
17
+ },
18
+
19
+ "plugin:transport": "transport/wrapper"
20
+
21
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "transporter",
3
+ "version": "2.0.0",
4
+ "bpm": "0.1.0",
5
+
6
+ "description": "DESCRIPTION HERE",
7
+ "author": "YOUR NAME HERE",
8
+ "homepage": "URL",
9
+
10
+ "directories": {
11
+ "lib": "./lib"
12
+ },
13
+
14
+ "dependencies": {
15
+ "transport": "0.5.0"
16
+ }
17
+
18
+ }
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe "bpm build the gauntlet" do
4
+ it "should work" do
5
+ pending "Possibly add some fixtures to test"
6
+ end
7
+
8
+ =begin
9
+ before do
10
+ cd(home)
11
+ env["HOME"] = home.to_s
12
+ write_creds("user@example.com", "deadbeef")
13
+ end
14
+
15
+ {
16
+ "ivory" => "0.0.1",
17
+ "jquery" => "1.4.3",
18
+ "optparse" => "1.0.1",
19
+ "web-file" => "0.0.1",
20
+ "web-typed-array" => "0.0.1",
21
+ }.each do |package, version|
22
+ it "builds a package from #{package}" do
23
+ FileUtils.cp_r root.join("packages/#{package}"), package
24
+ cd package
25
+ bpm "build"
26
+
27
+ exit_status.should be_success
28
+ stdout.read.should include("Successfully built package: #{package}-#{version}.spd")
29
+ File.exist?(tmp.join(package, "#{package}-#{version}.spd"))
30
+ end
31
+ end
32
+ =end
33
+ end
@@ -0,0 +1,319 @@
1
+ require "spec_helper"
2
+
3
+ describe BPM::Package do
4
+ it "should have 'lib' as default lib_path'" do
5
+ subject.send(:lib_path).should == 'lib'
6
+ end
7
+
8
+ it "should have 'tests' as default tests_path'" do
9
+ subject.send(:tests_path).should == 'tests'
10
+ end
11
+ end
12
+
13
+ describe BPM::Package, "#to_spec" do
14
+ let(:email) { "user@example.com" }
15
+
16
+ before do
17
+ cd(home)
18
+ FileUtils.mkdir_p(home("lib"))
19
+ FileUtils.mkdir_p(home("resources"))
20
+ FileUtils.mkdir_p(home("tests"))
21
+ end
22
+
23
+ subject do
24
+ package = BPM::Package.new(nil, email)
25
+ package.json_path = fixtures("core-test", "package.json")
26
+ if spec = package.to_spec
27
+ spec
28
+ else
29
+ puts "Errors: #{package.errors}"
30
+ nil
31
+ end
32
+ end
33
+
34
+ def expand_sort(files)
35
+ files.map { |f| File.expand_path(f) }.sort
36
+ end
37
+
38
+ it "transforms the name" do
39
+ subject.name.should == "core-test"
40
+ end
41
+
42
+ it "transforms the version" do
43
+ subject.version.should == LibGems::Version.new("0.4.9")
44
+ end
45
+
46
+ it "transforms the author" do
47
+ subject.authors.should == ["Charles Jolley"]
48
+ end
49
+
50
+ it "transforms the email" do
51
+ subject.email.should == email
52
+ end
53
+
54
+ it "transforms the homepage" do
55
+ subject.homepage.should == "https://github.com/strobecorp/core-test"
56
+ end
57
+
58
+ it "transforms the description" do
59
+ subject.description.should == "Flexible testing library for JavaScript."
60
+ end
61
+
62
+ it "transforms the description" do
63
+ subject.summary.should == "A fully featured asynchronous testing library for JavaScript, compatible with other frameworks."
64
+ end
65
+
66
+ it "transforms the dependencies" do
67
+ subject.dependencies.map{|d| [d.name, d.requirement]}.should == [["ivory", "= 0.0.1"], ["optparse", "= 1.0.1"]]
68
+ end
69
+
70
+ it "packs metadata into requirements" do
71
+ metadata = JSON.parse(subject.requirements.first)
72
+ metadata["keywords"].should == %w[javascript testing]
73
+ metadata["licenses"].should == [
74
+ {"type" => "MIT",
75
+ "url" => "https://github.com/strobecorp/core-test/raw/master/LICENSE"}
76
+ ]
77
+ metadata["engines"].should == ["browser", "all"]
78
+ metadata["main"].should == "./lib/main"
79
+ metadata["bin"].should == {"cot" => "./bin/cot"}
80
+ end
81
+
82
+ it "expands paths from the directories" do
83
+ others = ["tmp/blah.js", "tmp/whee.txt"]
84
+ files = ["bin/cot", "lib/main.js", "lib/core.js", "lib/test.js", "package.json", "resources/additions.css", "resources/runner.css"]
85
+ test_files = ["tests/apis/core-test.js", "tests/system/test/assert-test.js"]
86
+
87
+ FileUtils.mkdir_p(["bin/", "resources/", "lib/", "tests/apis", "tests/system/test", "tmp/"])
88
+ FileUtils.touch(files + test_files + others)
89
+
90
+ expand_sort(subject.files).should == expand_sort(files + test_files)
91
+ expand_sort(subject.test_files).should == expand_sort(test_files)
92
+ end
93
+
94
+ it "hacks the file name to return .spd" do
95
+ subject.file_name.should == "core-test-0.4.9.spd"
96
+ end
97
+
98
+ it "sets the rubyforge_project to appease older versions of rubygems" do
99
+ subject.rubyforge_project.should == "bpm"
100
+ end
101
+ end
102
+
103
+ describe BPM::Package, "#to_s" do
104
+ let(:email) { "user@example.com" }
105
+
106
+ subject do
107
+ package = BPM::Package.new
108
+ package.json_path = fixtures("core-test","package.json")
109
+ package.valid?
110
+ package
111
+ end
112
+
113
+ it "gives the name and version" do
114
+ subject.to_full_name.should == "core-test-0.4.9"
115
+ end
116
+ end
117
+
118
+ describe BPM::Package, "converting" do
119
+ before do
120
+ cd(home)
121
+ end
122
+
123
+ subject do
124
+ package = BPM::Package.new
125
+ package.bpkg = fixtures("core-test-0.4.9.spd")
126
+ package.as_json
127
+ end
128
+
129
+ it "can recreate the same package.json from the package"
130
+
131
+ # it "can recreate the same package.json from the package" do
132
+ # subject.should == JSON.parse(File.read(fixtures("core-test", "package.json")))
133
+ # end
134
+ end
135
+
136
+ describe BPM::Package, "validating" do
137
+ before do
138
+ cd(home)
139
+ end
140
+
141
+ subject { BPM::Package.new }
142
+
143
+ shared_examples_for "a good parser" do
144
+ it "had a problem parsing package.json" do
145
+ subject.should have_error("There was a problem parsing package.json")
146
+ end
147
+ end
148
+
149
+ context "with a blank file" do
150
+ before do
151
+ FileUtils.touch("package.json")
152
+ subject.json_path = "package.json"
153
+ end
154
+ it_should_behave_like "a good parser"
155
+ end
156
+
157
+ context "with bad json" do
158
+ before do
159
+ File.open("package.json", "w") do |f|
160
+ f.write "---bad json---"
161
+ end
162
+ subject.json_path = "package.json"
163
+ end
164
+ it_should_behave_like "a good parser"
165
+ end
166
+
167
+ context "json can't be read" do
168
+ before do
169
+ FileUtils.cp fixtures("core-test", "package.json"), "."
170
+ FileUtils.chmod 0000, "package.json"
171
+ subject.json_path = "package.json"
172
+ end
173
+ it_should_behave_like "a good parser"
174
+ end
175
+
176
+ context "json can't be found" do
177
+ before do
178
+ subject.json_path = "package.json"
179
+ end
180
+ it_should_behave_like "a good parser"
181
+ end
182
+
183
+ end
184
+
185
+ describe BPM::Package, "validation errors" do
186
+ let(:email) { "user@example.com" }
187
+
188
+ before do
189
+ cd(home)
190
+ FileUtils.mkdir_p(home("lib"))
191
+ FileUtils.mkdir_p(home("tests"))
192
+ end
193
+
194
+ subject do
195
+ BPM::Package.new(nil, email)
196
+ end
197
+
198
+ def write_package
199
+ path = home("package.json")
200
+ package = JSON.parse(File.read(fixtures("core-test","package.json")))
201
+ yield package
202
+ File.open(path, "w") do |file|
203
+ file.write package.to_json
204
+ end
205
+ subject.json_path = path
206
+ end
207
+
208
+ %w[name description summary homepage author version directories].each do |field|
209
+ it "is invalid without a #{field} field" do
210
+ write_package do |package|
211
+ package.delete(field)
212
+ end
213
+
214
+ subject.should have_error("Package requires a '#{field}' field")
215
+ end
216
+
217
+ it "is invalid with a blank #{field} field" do
218
+ write_package do |package|
219
+ package[field] = ""
220
+ end
221
+
222
+ subject.should have_error("Package requires a '#{field}' field")
223
+ end
224
+ end
225
+
226
+ it "is invalid without a proper version number" do
227
+ write_package do |package|
228
+ package["version"] = "bad"
229
+ end
230
+
231
+ subject.should have_error("Malformed version number string bad")
232
+ end
233
+
234
+ it "is valid without specifying a test directory" do
235
+ write_package do |package|
236
+ package["directories"].delete("tests")
237
+ end
238
+
239
+ subject.should be_valid
240
+ subject.to_spec.test_files.should == []
241
+ end
242
+
243
+ it "is valid and has files without specifying bin" do
244
+ write_package do |package|
245
+ package.delete("bin")
246
+ end
247
+
248
+ subject.should be_valid
249
+ subject.to_spec.files.should == ["package.json"]
250
+ end
251
+
252
+ %w(lib tests).each do |dir|
253
+ it "is invalid if #{dir} points to a file" do
254
+ FileUtils.touch(home("somefile"))
255
+ write_package do |package|
256
+ package["directories"][dir] = "./somefile"
257
+ end
258
+
259
+ subject.should have_error("'./somefile', specified for #{dir} directory, is not a directory")
260
+ end
261
+
262
+ it "is invalid with a #{dir} directory that doesn't exist" do
263
+ write_package do |package|
264
+ package["directories"][dir] = "nope"
265
+ end
266
+
267
+ subject.should have_error("'nope', specified for #{dir} directory, is not a directory")
268
+ end
269
+
270
+ it "is valid with a #{dir} directory that exists" do
271
+ FileUtils.mkdir_p(home("somewhere", "else"))
272
+ write_package do |package|
273
+ package["directories"][dir] = "./somewhere/else"
274
+ end
275
+
276
+ subject.should be_valid
277
+ end
278
+ end
279
+
280
+ it "is valid with a lib directory array" do
281
+ FileUtils.mkdir_p(home("vendor/lib"))
282
+ write_package do |package|
283
+ package["directories"]["lib"] = ["./lib", "./vendor/lib"]
284
+ end
285
+
286
+ subject.should be_valid
287
+ end
288
+
289
+ it "is invalid if any lib directories don't exist" do
290
+ write_package do |package|
291
+ package["directories"]["lib"] = ["./lib", "./fake"]
292
+ end
293
+
294
+ subject.should have_error "'./fake', specified for lib directory, is not a directory"
295
+ end
296
+
297
+ it "is invalid if the lib directory array is empty" do
298
+ write_package do |package|
299
+ package["directories"]["lib"] = []
300
+ end
301
+
302
+ subject.should have_error("A lib directory is required")
303
+ end
304
+
305
+ end
306
+
307
+ describe BPM::Package, "templates" do
308
+
309
+ subject do
310
+ package = BPM::Package.new(fixtures("custom_generator"))
311
+ package.load_json
312
+ package
313
+ end
314
+
315
+ it "should have project template" do
316
+ subject.template_path('project').should == fixtures("custom_generator", "templates", "project").to_s
317
+ end
318
+
319
+ end