bpm 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. data/.gitmodules +3 -0
  2. data/Gemfile +0 -13
  3. data/TODO.md +1 -0
  4. data/bpm.gemspec +8 -3
  5. data/lib/bpm/cli/base.rb +22 -20
  6. data/lib/bpm/generator.rb +3 -3
  7. data/lib/bpm/libgems_ext/dependency_installer.rb +4 -4
  8. data/lib/bpm/libgems_ext/installer.rb +1 -1
  9. data/lib/bpm/package.rb +13 -9
  10. data/lib/bpm/pipeline/generated_asset.rb +30 -3
  11. data/lib/bpm/pipeline/transport_processor.rb +20 -12
  12. data/lib/bpm/pipeline.rb +17 -9
  13. data/lib/bpm/project.rb +42 -10
  14. data/lib/bpm/server.rb +5 -0
  15. data/lib/bpm/version.rb +1 -1
  16. data/lib/bpm.rb +2 -0
  17. data/lib/vendored_sprockets.rb +7 -0
  18. data/spec/cli/add_spec.rb +40 -37
  19. data/spec/cli/build_spec.rb +5 -5
  20. data/spec/cli/new_spec.rb +49 -23
  21. data/spec/cli/push_spec.rb +5 -5
  22. data/spec/cli/unpack_spec.rb +14 -14
  23. data/spec/fixtures/{badrake-0.8.7.spd → badrake-0.8.7.bpkg} +0 -0
  24. data/spec/fixtures/{builder-3.0.0.spd → builder-3.0.0.bpkg} +0 -0
  25. data/spec/fixtures/{bundler-1.1.pre.spd → bundler-1.1.pre.bpkg} +0 -0
  26. data/spec/fixtures/{coffee-1.0.1.pre.spd → coffee-1.0.1.pre.bpkg} +0 -0
  27. data/spec/fixtures/{core-test-0.4.9.spd → core-test-0.4.9.bpkg} +0 -0
  28. data/spec/fixtures/{custom_generator-1.0.spd → custom_generator-1.0.bpkg} +0 -0
  29. data/spec/fixtures/custom_name/MyProject.json +4 -0
  30. data/spec/fixtures/hello_world/css/dummy.css +3 -0
  31. data/spec/fixtures/{highline-1.6.1.spd → highline-1.6.1.bpkg} +0 -0
  32. data/spec/fixtures/{ivory-0.0.1.spd → ivory-0.0.1.bpkg} +0 -0
  33. data/spec/fixtures/{jquery-1.4.3.spd → jquery-1.4.3.bpkg} +0 -0
  34. data/spec/fixtures/minitest/assets/bpm_packages.js +1 -0
  35. data/spec/fixtures/minitest/assets/bpm_styles.css +0 -0
  36. data/spec/fixtures/minitest/assets/minitest/app_package.js +1 -0
  37. data/spec/fixtures/minitest/lib/main.js +1 -0
  38. data/spec/fixtures/minitest/minitest.json +22 -0
  39. data/spec/fixtures/minitest/packages/uglyduck/lib/main.js +1 -0
  40. data/spec/fixtures/minitest/packages/uglyduck/minifier/main.js +4 -0
  41. data/spec/fixtures/minitest/packages/uglyduck/package.json +21 -0
  42. data/spec/fixtures/{optparse-1.0.1.spd → optparse-1.0.1.bpkg} +0 -0
  43. data/spec/fixtures/{rake-0.8.6.spd → rake-0.8.6.bpkg} +0 -0
  44. data/spec/fixtures/{rake-0.8.7.spd → rake-0.8.7.bpkg} +0 -0
  45. data/spec/fixtures/{spade-0.5.0.spd → spade-0.5.0.bpkg} +0 -0
  46. data/spec/fixtures/transporter/packages/transport/lib/main.js +1 -0
  47. data/spec/fixtures/transporter/packages/transport/package.json +1 -1
  48. data/spec/fixtures/transporter/packages/transport/transports/wrapper.js +5 -0
  49. data/spec/gauntlet_spec.rb +2 -2
  50. data/spec/package_spec.rb +3 -3
  51. data/spec/pipeline_spec.rb +175 -54
  52. data/spec/project_spec.rb +19 -3
  53. data/spec/support/fake_gem_server.rb +4 -4
  54. data/templates/init/project.json +3 -1
  55. data/templates/project/index.html +1 -1
  56. data/vendor/sprockets/.gitignore +7 -0
  57. data/vendor/sprockets/.travis.yml +6 -0
  58. data/vendor/sprockets/Gemfile +8 -0
  59. data/vendor/sprockets/LICENSE +20 -0
  60. data/vendor/sprockets/README.md +22 -0
  61. data/vendor/sprockets/Rakefile +8 -0
  62. data/vendor/sprockets/lib/sprockets/asset.rb +203 -0
  63. data/vendor/sprockets/lib/sprockets/asset_attributes.rb +161 -0
  64. data/vendor/sprockets/lib/sprockets/base.rb +147 -0
  65. data/vendor/sprockets/lib/sprockets/bundled_asset.rb +222 -0
  66. data/vendor/sprockets/lib/sprockets/cache/file_store.rb +41 -0
  67. data/vendor/sprockets/lib/sprockets/caching.rb +121 -0
  68. data/vendor/sprockets/lib/sprockets/charset_normalizer.rb +41 -0
  69. data/vendor/sprockets/lib/sprockets/context.rb +191 -0
  70. data/vendor/sprockets/lib/sprockets/digest.rb +73 -0
  71. data/vendor/sprockets/lib/sprockets/directive_processor.rb +380 -0
  72. data/vendor/sprockets/lib/sprockets/eco_template.rb +39 -0
  73. data/vendor/sprockets/lib/sprockets/ejs_template.rb +38 -0
  74. data/vendor/sprockets/lib/sprockets/engines.rb +92 -0
  75. data/vendor/sprockets/lib/sprockets/environment.rb +93 -0
  76. data/vendor/sprockets/lib/sprockets/errors.rb +17 -0
  77. data/vendor/sprockets/lib/sprockets/index.rb +80 -0
  78. data/vendor/sprockets/lib/sprockets/jst_processor.rb +26 -0
  79. data/vendor/sprockets/lib/sprockets/processing.rb +310 -0
  80. data/vendor/sprockets/lib/sprockets/processor.rb +32 -0
  81. data/vendor/sprockets/lib/sprockets/safety_colons.rb +28 -0
  82. data/vendor/sprockets/lib/sprockets/server.rb +270 -0
  83. data/vendor/sprockets/lib/sprockets/static_asset.rb +87 -0
  84. data/vendor/sprockets/lib/sprockets/static_compilation.rb +82 -0
  85. data/vendor/sprockets/lib/sprockets/trail.rb +122 -0
  86. data/vendor/sprockets/lib/sprockets/utils.rb +67 -0
  87. data/vendor/sprockets/lib/sprockets/version.rb +3 -0
  88. data/vendor/sprockets/lib/sprockets.rb +31 -0
  89. data/vendor/sprockets/sprockets.gemspec +30 -0
  90. data/vendor/sprockets/test/fixtures/asset/POW.png +0 -0
  91. data/vendor/sprockets/test/fixtures/asset/application.js +6 -0
  92. data/vendor/sprockets/test/fixtures/asset/bar-utf8.css +2 -0
  93. data/vendor/sprockets/test/fixtures/asset/charset.css +2 -0
  94. data/vendor/sprockets/test/fixtures/asset/circle/a.js +2 -0
  95. data/vendor/sprockets/test/fixtures/asset/circle/b.js +2 -0
  96. data/vendor/sprockets/test/fixtures/asset/circle/c.js +2 -0
  97. data/vendor/sprockets/test/fixtures/asset/compat.js +4 -0
  98. data/vendor/sprockets/test/fixtures/asset/constants.js +2 -0
  99. data/vendor/sprockets/test/fixtures/asset/constants.yml +1 -0
  100. data/vendor/sprockets/test/fixtures/asset/default_mime_type.js +1 -0
  101. data/vendor/sprockets/test/fixtures/asset/filename.js.erb +1 -0
  102. data/vendor/sprockets/test/fixtures/asset/foo-utf8.css +2 -0
  103. data/vendor/sprockets/test/fixtures/asset/included_header.js +4 -0
  104. data/vendor/sprockets/test/fixtures/asset/jquery.tmpl.min.js +1 -0
  105. data/vendor/sprockets/test/fixtures/asset/mismatch.js +1 -0
  106. data/vendor/sprockets/test/fixtures/asset/multiple.js +2 -0
  107. data/vendor/sprockets/test/fixtures/asset/multipleengine.js +1 -0
  108. data/vendor/sprockets/test/fixtures/asset/noengine.js +1 -0
  109. data/vendor/sprockets/test/fixtures/asset/noformat.coffee +1 -0
  110. data/vendor/sprockets/test/fixtures/asset/one.css +1 -0
  111. data/vendor/sprockets/test/fixtures/asset/oneengine.js +1 -0
  112. data/vendor/sprockets/test/fixtures/asset/project.css +1 -0
  113. data/vendor/sprockets/test/fixtures/asset/project.js.erb +4 -0
  114. data/vendor/sprockets/test/fixtures/asset/relative/include.js +4 -0
  115. data/vendor/sprockets/test/fixtures/asset/relative/require.js +1 -0
  116. data/vendor/sprockets/test/fixtures/asset/relative/require_outside_path.js +1 -0
  117. data/vendor/sprockets/test/fixtures/asset/require_self.css +9 -0
  118. data/vendor/sprockets/test/fixtures/asset/require_self_twice.css +8 -0
  119. data/vendor/sprockets/test/fixtures/asset/semicolons/bar.js +1 -0
  120. data/vendor/sprockets/test/fixtures/asset/semicolons/index.js +5 -0
  121. data/vendor/sprockets/test/fixtures/asset/sprite.css.erb +12 -0
  122. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/d.js +2 -0
  123. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c/e.js +1 -0
  124. data/vendor/sprockets/test/fixtures/asset/tree/all/b/c.js +1 -0
  125. data/vendor/sprockets/test/fixtures/asset/tree/all/b.css +2 -0
  126. data/vendor/sprockets/test/fixtures/asset/tree/all/b.js.erb +1 -0
  127. data/vendor/sprockets/test/fixtures/asset/tree/all/d/c.js.coffee +1 -0
  128. data/vendor/sprockets/test/fixtures/asset/tree/all/d/e.js +1 -0
  129. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require.js +7 -0
  130. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_directory.js +1 -0
  131. data/vendor/sprockets/test/fixtures/asset/tree/all_with_require_tree.js +2 -0
  132. data/vendor/sprockets/test/fixtures/asset/tree/directory/application.js +2 -0
  133. data/vendor/sprockets/test/fixtures/asset/tree/directory/bar.js +1 -0
  134. data/vendor/sprockets/test/fixtures/asset/tree/directory/foo.js +1 -0
  135. data/vendor/sprockets/test/fixtures/asset/tree/tree/application.js +2 -0
  136. data/vendor/sprockets/test/fixtures/asset/tree/tree/bar.js +1 -0
  137. data/vendor/sprockets/test/fixtures/asset/tree/tree/foo.js +1 -0
  138. data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/a/a.js +1 -0
  139. data/vendor/sprockets/test/fixtures/asset/tree/with_logical_path/require_tree_with_logical_path.js +1 -0
  140. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/a.js +1 -0
  141. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/b.js +1 -0
  142. data/vendor/sprockets/test/fixtures/asset/tree/without_argument/require_tree_without_argument.js +1 -0
  143. data/vendor/sprockets/test/fixtures/asset/two.css +1 -0
  144. data/vendor/sprockets/test/fixtures/asset/unicode.js +2 -0
  145. data/vendor/sprockets/test/fixtures/asset/unknownexts.min.js +2 -0
  146. data/vendor/sprockets/test/fixtures/asset/users.js.erb.str +4 -0
  147. data/vendor/sprockets/test/fixtures/context/POW.png +0 -0
  148. data/vendor/sprockets/test/fixtures/context/application.js.yml +3 -0
  149. data/vendor/sprockets/test/fixtures/context/bar.js +1 -0
  150. data/vendor/sprockets/test/fixtures/context/foo.js +2 -0
  151. data/vendor/sprockets/test/fixtures/context/helpers.css.erb +3 -0
  152. data/vendor/sprockets/test/fixtures/context/properties.js.erb +7 -0
  153. data/vendor/sprockets/test/fixtures/context/require_glob.js +1 -0
  154. data/vendor/sprockets/test/fixtures/context/resolve_content_type.js.erb +4 -0
  155. data/vendor/sprockets/test/fixtures/context/sprite.css.embed +3 -0
  156. data/vendor/sprockets/test/fixtures/default/application.js.coffee +4 -0
  157. data/vendor/sprockets/test/fixtures/default/coffee/foo.coffee +1 -0
  158. data/vendor/sprockets/test/fixtures/default/coffee/index.js +3 -0
  159. data/vendor/sprockets/test/fixtures/default/empty +0 -0
  160. data/vendor/sprockets/test/fixtures/default/gallery.css.erb +3 -0
  161. data/vendor/sprockets/test/fixtures/default/gallery.js +1 -0
  162. data/vendor/sprockets/test/fixtures/default/goodbye.jst.eco +1 -0
  163. data/vendor/sprockets/test/fixtures/default/hello.jst.ejs +1 -0
  164. data/vendor/sprockets/test/fixtures/default/hello.txt +1 -0
  165. data/vendor/sprockets/test/fixtures/default/interpolation.js +1 -0
  166. data/vendor/sprockets/test/fixtures/default/missing_require.js +1 -0
  167. data/vendor/sprockets/test/fixtures/default/mobile/a.js +1 -0
  168. data/vendor/sprockets/test/fixtures/default/mobile/b.js +1 -0
  169. data/vendor/sprockets/test/fixtures/default/mobile/c.css +1 -0
  170. data/vendor/sprockets/test/fixtures/default/mobile/d.css +1 -0
  171. data/vendor/sprockets/test/fixtures/default/mobile/index.css +3 -0
  172. data/vendor/sprockets/test/fixtures/default/mobile/index.js +1 -0
  173. data/vendor/sprockets/test/fixtures/default/noreturn.js +1 -0
  174. data/vendor/sprockets/test/fixtures/default/project.js.coffee.erb +2 -0
  175. data/vendor/sprockets/test/fixtures/directives/code_before_comment +3 -0
  176. data/vendor/sprockets/test/fixtures/directives/comment_without_directives +6 -0
  177. data/vendor/sprockets/test/fixtures/directives/directive_word_splitting +6 -0
  178. data/vendor/sprockets/test/fixtures/directives/directives_after_header +16 -0
  179. data/vendor/sprockets/test/fixtures/directives/double_slash +9 -0
  180. data/vendor/sprockets/test/fixtures/directives/hash +8 -0
  181. data/vendor/sprockets/test/fixtures/directives/no_header +2 -0
  182. data/vendor/sprockets/test/fixtures/directives/slash_star +10 -0
  183. data/vendor/sprockets/test/fixtures/directives/slash_star_single +4 -0
  184. data/vendor/sprockets/test/fixtures/directives/space_between_directive_word +2 -0
  185. data/vendor/sprockets/test/fixtures/directives/triple_hash +10 -0
  186. data/vendor/sprockets/test/fixtures/encoding/ascii.js +1 -0
  187. data/vendor/sprockets/test/fixtures/encoding/ascii_utf8.js +2 -0
  188. data/vendor/sprockets/test/fixtures/encoding/utf16.js +0 -0
  189. data/vendor/sprockets/test/fixtures/encoding/utf8.js +1 -0
  190. data/vendor/sprockets/test/fixtures/encoding/utf8_bom.js +1 -0
  191. data/vendor/sprockets/test/fixtures/engines/hello.alert +1 -0
  192. data/vendor/sprockets/test/fixtures/engines/moo.js.str +1 -0
  193. data/vendor/sprockets/test/fixtures/public/compiled-digest-0aa2105d29558f3eb790d411d7d8fb66.js +3 -0
  194. data/vendor/sprockets/test/fixtures/public/compiled-digest-1c41eb0cf934a0c76babe875f982f9d1.js +1 -0
  195. data/vendor/sprockets/test/fixtures/server/app/javascripts/application.js +5 -0
  196. data/vendor/sprockets/test/fixtures/server/app/javascripts/bar.js +1 -0
  197. data/vendor/sprockets/test/fixtures/server/app/javascripts/foo.js +1 -0
  198. data/vendor/sprockets/test/fixtures/server/app/javascripts/hello.txt +2 -0
  199. data/vendor/sprockets/test/fixtures/server/app/javascripts/tree.js +1 -0
  200. data/vendor/sprockets/test/fixtures/server/vendor/javascripts/missing_require.js +1 -0
  201. data/vendor/sprockets/test/fixtures/server/vendor/stylesheets/missing_require.css +1 -0
  202. data/vendor/sprockets/test/sprockets_test.rb +56 -0
  203. data/vendor/sprockets/test/test_asset.rb +593 -0
  204. data/vendor/sprockets/test/test_asset_attributes.rb +86 -0
  205. data/vendor/sprockets/test/test_caching.rb +62 -0
  206. data/vendor/sprockets/test/test_context.rb +115 -0
  207. data/vendor/sprockets/test/test_directive_processor.rb +124 -0
  208. data/vendor/sprockets/test/test_encoding.rb +65 -0
  209. data/vendor/sprockets/test/test_engines.rb +73 -0
  210. data/vendor/sprockets/test/test_environment.rb +610 -0
  211. data/vendor/sprockets/test/test_server.rb +227 -0
  212. metadata +258 -54
  213. data/spec/fixtures/transporter/packages/transport/lib/wrapper.js +0 -5
data/spec/cli/add_spec.rb CHANGED
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
  require 'json'
3
3
 
4
4
  describe 'bpm add' do
5
-
5
+
6
6
  before do
7
7
  goto_home
8
8
  set_host
9
9
  start_fake(FakeGemServer.new)
10
10
  FileUtils.cp_r(fixtures('hello_world'), '.')
11
11
  cd home('hello_world')
12
-
12
+
13
13
  bpm 'compile'
14
14
  wait
15
15
  end
@@ -19,93 +19,93 @@ describe 'bpm add' do
19
19
  bpm "add", "jquery", :track_stderr => true
20
20
  stderr.read.should include("inside of a bpm project")
21
21
  end
22
-
22
+
23
23
  it "should add a new hard dependency" do
24
24
  bpm 'add', 'jquery'
25
25
  wait
26
-
26
+
27
27
  output = stdout.read
28
28
  output.should include("Added package 'jquery' (1.4.3)")
29
29
  has_dependency 'jquery', '1.4.3'
30
30
  end
31
-
31
+
32
32
  it "adds multiple package dependencies" do
33
33
  bpm "add", "jquery", "rake"
34
-
34
+
35
35
  output = stdout.read
36
-
36
+
37
37
  %w(jquery:1.4.3 rake:0.8.7).each do |pkg|
38
38
  pkg_name, pkg_version = pkg.split ':'
39
39
  output.should include("Added package '#{pkg_name}' (#{pkg_version})")
40
40
  has_dependency pkg_name, pkg_version
41
41
  end
42
42
  end
43
-
43
+
44
44
  it "installs hard and soft dependencies" do
45
45
  bpm 'add', 'coffee', '--pre'
46
46
  wait
47
-
47
+
48
48
  output = stdout.read
49
-
49
+
50
50
  output.should include("Added package 'coffee' (1.0.1.pre)")
51
51
  output.should include("Added package 'jquery' (1.4.3)")
52
-
52
+
53
53
  has_dependency 'coffee', '1.0.1.pre', '>= 0-pre'
54
54
  has_soft_dependency 'jquery', '1.4.3'
55
55
  end
56
-
56
+
57
57
  it "adds no packages when any are invalid" do
58
58
  bpm "add", "jquery", "fake", :track_stderr => true
59
-
60
- stderr.read.should include("Could not find package 'fake'")
61
-
59
+
60
+ stderr.read.should == "Could not find eligable package for 'fake' (>= 0)\n"
61
+
62
62
  no_dependency 'jquery'
63
63
  no_dependency 'fake'
64
64
  end
65
-
65
+
66
66
  it "fails when adding invalid package" do
67
67
  bpm "add", "fake", :track_stderr => true
68
-
69
- stderr.read.should include("Could not find package 'fake'")
68
+
69
+ stderr.read.should == "Could not find eligable package for 'fake' (>= 0)\n"
70
70
  no_dependency 'fake'
71
71
  end
72
-
72
+
73
73
  it "fails if bpm can't write to the json or packages directory" do
74
74
  FileUtils.mkdir_p home('hello_world', 'packages')
75
75
  FileUtils.chmod 0555, home('hello_world', 'packages')
76
76
  FileUtils.chmod 0555, home('hello_world', 'hello_world.json')
77
-
77
+
78
78
  bpm "add", "jquery", :track_stderr => true
79
79
  exit_status.should_not be_success
80
80
  no_dependency 'jquery'
81
-
81
+
82
82
  FileUtils.chmod 0755, home('hello_world', 'packages')
83
83
  FileUtils.chmod 0755, home('hello_world', 'hello_world.json')
84
84
  end
85
-
85
+
86
86
  it "adds packages with different versions" do
87
87
  bpm "add", "rake", "-v", "0.8.6"
88
-
88
+
89
89
  stdout.read.should include("Added package 'rake' (0.8.6)")
90
90
  has_dependency 'rake', '0.8.6', '0.8.6'
91
91
  end
92
-
92
+
93
93
  it "updates a package to latest version" do
94
94
  bpm 'add', 'rake', '-v', '0.8.6'
95
95
  wait
96
96
  has_dependency 'rake', '0.8.6', '0.8.6' # precond
97
-
97
+
98
98
  output = stdout.read
99
99
  bpm 'add', 'rake'
100
100
  wait
101
-
101
+
102
102
  output = stdout.read
103
103
  output.should_not include('Fetched spade') # not required 2nd time
104
104
  output.should_not include("Added package 'spade' (0.5.0)")
105
105
  output.should include("Added package 'rake' (0.8.7)")
106
106
  has_dependency 'rake', '0.8.7'
107
107
  end
108
-
108
+
109
109
  it "adds a valid prerelease package" do
110
110
  bpm "add", "bundler", "--pre", "--verbose"
111
111
  wait
@@ -113,24 +113,24 @@ describe 'bpm add' do
113
113
  output.should include("Added package 'bundler' (1.1.pre)")
114
114
  has_dependency 'bundler', '1.1.pre', '>= 0-pre'
115
115
  end
116
-
116
+
117
117
  it "does not add the normal package when asking for a prerelease" do
118
118
  bpm "add", "rake", "--pre", :track_stderr => true
119
119
  wait
120
- stderr.read.should include("Could not find prerelease package 'rake'")
120
+ stderr.read.should == "Could not find eligable package for 'rake' (>= 0-pre)\n"
121
121
  no_dependency 'rake'
122
122
  end
123
-
123
+
124
124
  it "requires at least one package to add" do
125
125
  bpm "add", :track_stderr => true
126
126
  stderr.read.should include("at least one package")
127
127
  end
128
-
128
+
129
129
  it "should make a soft dependency a hard dependency" do
130
130
  bpm 'compile'
131
131
  wait
132
132
  has_soft_dependency 'ivory', '0.0.1' # precond
133
-
133
+
134
134
  bpm 'add', 'ivory'
135
135
  wait
136
136
  has_dependency 'ivory', '0.0.1'
@@ -138,22 +138,25 @@ describe 'bpm add' do
138
138
 
139
139
  it "should use local package if available" do
140
140
  no_dependency 'custom_package'
141
-
141
+
142
142
  bpm "add", "custom_package"
143
143
  output = stdout.read
144
-
144
+
145
145
  output.should include("Using local package 'custom_package'")
146
146
  has_dependency 'custom_package', '2.0.0'
147
147
  has_soft_dependency 'rake', '0.8.6'
148
148
  end
149
-
149
+
150
150
  it "should fail if local package version is not compatible" do
151
151
  bpm "add", "custom_package", "-v", "3.0.0", :track_stderr => true
152
152
  output = stderr.read
153
153
  output.should include("'custom_package' (2.0.0) is not compatible")
154
154
  no_dependency 'custom_package'
155
155
  end
156
-
156
+
157
157
  it "should verify working with config-less projects"
158
-
158
+
159
+ it "should work with .bpkg file"
160
+ # i.e. `bpm add package.bpkg`
161
+
159
162
  end
@@ -16,9 +16,9 @@ describe "bpm build when logged in" do
16
16
 
17
17
  exit_status.should be_success
18
18
  output = stdout.read
19
- output.should include("Successfully built package: core-test-0.4.9.spd")
19
+ output.should include("Successfully built package: core-test-0.4.9.bpkg")
20
20
 
21
- package = LibGems::Format.from_file_by_path("core-test-0.4.9.spd")
21
+ package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
22
22
  package.spec.name.should == "core-test"
23
23
  package.spec.version.should == LibGems::Version.new("0.4.9")
24
24
  package.spec.email.should == email
@@ -37,7 +37,7 @@ describe "bpm build without logging in" do
37
37
 
38
38
  exit_status.should be_success
39
39
 
40
- package = LibGems::Format.from_file_by_path("core-test-0.4.9.spd")
40
+ package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
41
41
  package.spec.name.should == "core-test"
42
42
  package.spec.version.should == LibGems::Version.new("0.4.9")
43
43
  end
@@ -49,7 +49,7 @@ describe "bpm build without logging in" do
49
49
  exit_status.should be_success
50
50
 
51
51
  cd 'core-test'
52
- package = LibGems::Format.from_file_by_path("core-test-0.4.9.spd")
52
+ package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
53
53
  package.spec.name.should == "core-test"
54
54
  package.spec.version.should == LibGems::Version.new("0.4.9")
55
55
  end
@@ -62,7 +62,7 @@ describe "bpm build without logging in" do
62
62
  exit_status.should be_success
63
63
  output = stdout.read
64
64
 
65
- package = LibGems::Format.from_file_by_path("core-test-0.4.9.spd")
65
+ package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
66
66
  package.spec.name.should == "core-test"
67
67
  package.spec.version.should == LibGems::Version.new("0.4.9")
68
68
  package.spec.email.should == "lucy@allen.com"
data/spec/cli/new_spec.rb CHANGED
@@ -48,41 +48,67 @@ describe "bpm new" do
48
48
 
49
49
  describe "package templates" do
50
50
 
51
- before do
52
- goto_home
51
+ describe "with custom generator" do
52
+
53
+ before do
54
+ goto_home
53
55
 
54
- # Install package
55
- cd fixtures
56
- with_env do
57
- BPM::Remote.new.install("custom_generator-1.0.spd", ">= 0", false)
56
+ # Install package
57
+ cd fixtures
58
+ with_env do
59
+ BPM::Remote.new.install("custom_generator-1.0.bpkg", ">= 0", false)
60
+ end
61
+ cd home
58
62
  end
59
- cd home
60
- end
61
63
 
62
- it "should create custom files" do
63
- bpm 'new', 'BpmTest', '--package=custom_generator'
64
+ it "should create custom files" do
65
+ bpm 'new', 'BpmTest', '--package=custom_generator'
64
66
 
65
- files = %w(lib lib/main.js app.js BpmTest.json assets assets/bpm_packages.js assets/bpm_styles.css)
67
+ files = %w(lib lib/main.js app.js BpmTest.json assets assets/bpm_packages.js assets/bpm_styles.css)
66
68
 
67
- # output without coloration
68
- output = stdout.read.gsub(/\e\[\d+m/,'')
69
+ # output without coloration
70
+ output = stdout.read.gsub(/\e\[\d+m/,'')
69
71
 
70
- files.each do |file|
71
- output.should =~ /create\s+#{file}$/
72
- home("bpm_test", file).should exist
72
+ files.each do |file|
73
+ output.should =~ /create\s+#{file}$/
74
+ home("bpm_test", file).should exist
75
+ end
73
76
  end
74
- end
75
77
 
76
- it "should create custom app.js with explicit generator" do
77
- bpm 'new', 'BpmTest', '--package=custom_generator' and wait
78
+ it "should create custom app.js with explicit generator" do
79
+ bpm 'new', 'BpmTest', '--package=custom_generator' and wait
80
+
81
+ File.read(home("bpm_test", "app.js")).should == "require('BpmTest/main.js')\n"
82
+ end
83
+
84
+ it "should create custom project.json without explicit generator" do
85
+ bpm 'new', 'BpmTest', '--package=custom_generator' and wait
86
+
87
+ File.read(home("bpm_test", "BpmTest.json")).should =~ /"spade": ">= 0"/
88
+ end
78
89
 
79
- File.read(home("bpm_test", "app.js")).should == "require('BpmTest/main.js')\n"
80
90
  end
81
91
 
82
- it "should create custom project.json without explicit generator" do
83
- bpm 'new', 'BpmTest', '--package=custom_generator' and wait
92
+ describe "with custom generator" do
93
+
94
+ before do
95
+ goto_home
96
+
97
+ # Install package
98
+ cd fixtures
99
+ with_env do
100
+ installed = BPM::Remote.new.install("jquery-1.4.3.bpkg", ">= 0", false)
101
+ puts installed.inspect
102
+ end
103
+ cd home
104
+ end
105
+
106
+ it "should add package as a dependency even if it doesn't have custom generator" do
107
+ bpm 'new', 'BpmTest', '--package=jquery' and wait
108
+
109
+ File.read(home("bpm_test", "BpmTest.json")).should =~ /"dependencies": {\n\s+"jquery": "1.4.3"\n\s+}/
110
+ end
84
111
 
85
- File.read(home("bpm_test", "BpmTest.json")).should =~ /"spade": ">= 0"/
86
112
  end
87
113
 
88
114
  it "should install the package if it doesn't exist locally"
@@ -16,7 +16,7 @@ describe "bpm push" do
16
16
  end
17
17
 
18
18
  it "registers a gem when sent with the right api key" do
19
- bpm "push", "../../spec/fixtures/rake-0.8.7.spd"
19
+ bpm "push", "../../spec/fixtures/rake-0.8.7.bpkg"
20
20
 
21
21
  stdout.read.should include("Successfully registered rake (0.8.7)")
22
22
  end
@@ -25,7 +25,7 @@ describe "bpm push" do
25
25
  it "shows rejection message if wrong api key is supplied" do
26
26
  write_api_key("beefbeef")
27
27
 
28
- bpm "push", "../../spec/fixtures/rake-0.8.7.spd"
28
+ bpm "push", "../../spec/fixtures/rake-0.8.7.bpkg"
29
29
 
30
30
  stdout.read.should include("One cannot simply walk into Mordor!")
31
31
  end
@@ -40,13 +40,13 @@ describe "bpm push without api key" do
40
40
  end
41
41
 
42
42
  it "ignores files that don't exist" do
43
- bpm "push", "rake-1.0.0.spd"
43
+ bpm "push", "rake-1.0.0.bpkg"
44
44
 
45
45
  stdout.read.should include("No such file")
46
46
  end
47
47
 
48
48
  it "must push a valid gem" do
49
- bpm "push", "../../spec/fixtures/badrake-0.8.7.spd"
49
+ bpm "push", "../../spec/fixtures/badrake-0.8.7.bpkg"
50
50
 
51
51
  stdout.read.should include("There was a problem opening your package.")
52
52
  end
@@ -66,7 +66,7 @@ describe "bpm push without api key" do
66
66
  end
67
67
 
68
68
  it "asks for login first if api key does not exist" do
69
- bpm "push", "../../spec/fixtures/rake-0.8.7.spd"
69
+ bpm "push", "../../spec/fixtures/rake-0.8.7.bpkg"
70
70
 
71
71
  stdout.read.should include("Please login first with `bpm login`")
72
72
  end
@@ -6,8 +6,8 @@ describe "bpm unpack" do
6
6
  end
7
7
 
8
8
  it "builds a gem from a given package.json" do
9
- FileUtils.cp fixtures("coffee-1.0.1.pre.spd"), "."
10
- bpm "unpack", "coffee-1.0.1.pre.spd"
9
+ FileUtils.cp fixtures("coffee-1.0.1.pre.bpkg"), "."
10
+ bpm "unpack", "coffee-1.0.1.pre.bpkg"
11
11
 
12
12
  exit_status.should be_success
13
13
  output = stdout.read
@@ -22,8 +22,8 @@ describe "bpm unpack" do
22
22
  end
23
23
 
24
24
  it "can unpack to a different directory" do
25
- FileUtils.cp fixtures("coffee-1.0.1.pre.spd"), "."
26
- bpm "unpack", "coffee-1.0.1.pre.spd", "--target", "star/bucks"
25
+ FileUtils.cp fixtures("coffee-1.0.1.pre.bpkg"), "."
26
+ bpm "unpack", "coffee-1.0.1.pre.bpkg", "--target", "star/bucks"
27
27
 
28
28
  exit_status.should be_success
29
29
  output = stdout.read
@@ -33,9 +33,9 @@ describe "bpm unpack" do
33
33
  end
34
34
 
35
35
  it "can unpack more than one package" do
36
- FileUtils.cp fixtures("coffee-1.0.1.pre.spd"), "."
37
- FileUtils.cp fixtures("jquery-1.4.3.spd"), "."
38
- bpm "unpack", "coffee-1.0.1.pre.spd", "jquery-1.4.3.spd"
36
+ FileUtils.cp fixtures("coffee-1.0.1.pre.bpkg"), "."
37
+ FileUtils.cp fixtures("jquery-1.4.3.bpkg"), "."
38
+ bpm "unpack", "coffee-1.0.1.pre.bpkg", "jquery-1.4.3.bpkg"
39
39
 
40
40
  exit_status.should be_success
41
41
  output = stdout.read
@@ -49,24 +49,24 @@ describe "bpm unpack" do
49
49
  it "shows a friendly error message if bpm can't write to the given directory" do
50
50
  FileUtils.mkdir_p(home("bad"))
51
51
  cd(home("bad"))
52
- FileUtils.cp fixtures("jquery-1.4.3.spd"), "."
52
+ FileUtils.cp fixtures("jquery-1.4.3.bpkg"), "."
53
53
  FileUtils.chmod 0555, "."
54
- bpm "unpack", "jquery-1.4.3.spd", :track_stderr => true
54
+ bpm "unpack", "jquery-1.4.3.bpkg", :track_stderr => true
55
55
 
56
56
  exit_status.should_not be_success
57
57
  output = stderr.read
58
- output.should include("There was a problem unpacking jquery-1.4.3.spd:")
58
+ output.should include("There was a problem unpacking jquery-1.4.3.bpkg:")
59
59
  output.should include("Permission denied")
60
60
  end
61
61
 
62
62
  it "shows a friendly error message if bpm can't read the package" do
63
- FileUtils.cp fixtures("jquery-1.4.3.spd"), "."
64
- FileUtils.chmod 0000, "jquery-1.4.3.spd"
65
- bpm "unpack", "jquery-1.4.3.spd", :track_stderr => true
63
+ FileUtils.cp fixtures("jquery-1.4.3.bpkg"), "."
64
+ FileUtils.chmod 0000, "jquery-1.4.3.bpkg"
65
+ bpm "unpack", "jquery-1.4.3.bpkg", :track_stderr => true
66
66
 
67
67
  exit_status.should_not be_success
68
68
  output = stderr.read
69
- output.should include("There was a problem unpacking jquery-1.4.3.spd:")
69
+ output.should include("There was a problem unpacking jquery-1.4.3.bpkg:")
70
70
  output.should include("Permission denied")
71
71
  end
72
72
  end
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "MyProject",
3
+ "bpm": "0.1.0"
4
+ }
@@ -0,0 +1,3 @@
1
+ .hello-world {
2
+ font-size: 2.0em;
3
+ }
File without changes
@@ -0,0 +1 @@
1
+ // TEST
File without changes
@@ -0,0 +1 @@
1
+ // MAIN
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "minitest",
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
+ "uglyduck": "1.0.0"
16
+ },
17
+
18
+ "pipeline": {
19
+ "minifier": "uglyduck"
20
+ }
21
+
22
+ }
@@ -0,0 +1 @@
1
+ //UGLY DUCK
@@ -0,0 +1,4 @@
1
+
2
+ exports.minify = function(body, pkg, moduleId, pathname) {
3
+ return "//MINIFIED START\n"+body+"\n//MINIFIED END\n";
4
+ };
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "uglyduck",
3
+ "version": "1.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
+ "minifier": "minifier",
13
+ "test": "tests"
14
+ },
15
+
16
+ "dependencies": {
17
+ },
18
+
19
+ "plugin:minifier": "uglyduck/~minifier/main"
20
+
21
+ }
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ // TRANSPORT DEMO
@@ -16,6 +16,6 @@
16
16
 
17
17
  },
18
18
 
19
- "plugin:transport": "transport/wrapper"
19
+ "plugin:transport": "transport/~transports/wrapper"
20
20
 
21
21
  }
@@ -0,0 +1,5 @@
1
+
2
+ exports.compileTransport = function(body, pkg, moduleId, filename) {
3
+ return "define_transport(function() {\n"+body+"\n}), '"+pkg.name+"', '"+moduleId+"', '"+filename+"');";
4
+ };
5
+
@@ -25,8 +25,8 @@ describe "bpm build the gauntlet" do
25
25
  bpm "build"
26
26
 
27
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"))
28
+ stdout.read.should include("Successfully built package: #{package}-#{version}.bpkg")
29
+ File.exist?(tmp.join(package, "#{package}-#{version}.bpkg"))
30
30
  end
31
31
  end
32
32
  =end
data/spec/package_spec.rb CHANGED
@@ -91,8 +91,8 @@ describe BPM::Package, "#to_spec" do
91
91
  expand_sort(subject.test_files).should == expand_sort(test_files)
92
92
  end
93
93
 
94
- it "hacks the file name to return .spd" do
95
- subject.file_name.should == "core-test-0.4.9.spd"
94
+ it "hacks the file name to return .bpkg" do
95
+ subject.file_name.should == "core-test-0.4.9.bpkg"
96
96
  end
97
97
 
98
98
  it "sets the rubyforge_project to appease older versions of rubygems" do
@@ -122,7 +122,7 @@ describe BPM::Package, "converting" do
122
122
 
123
123
  subject do
124
124
  package = BPM::Package.new
125
- package.bpkg = fixtures("core-test-0.4.9.spd")
125
+ package.bpkg = fixtures("core-test-0.4.9.bpkg")
126
126
  package.as_json
127
127
  end
128
128