bpm 1.0.0.rc.1 → 1.0.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,13 +67,6 @@ module ExecJS
67
67
  end
68
68
 
69
69
  module Runtimes
70
- remove_const :JavaScriptCore
71
- JavaScriptCore = ExternalRuntime.new(
72
- :name => "JavaScriptCore",
73
- :command => ["/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc", "jsc"],
74
- :runner_path => ExecJS.root + "/support/jsc_runner.js"
75
- )
76
-
77
70
  remove_const :JScript
78
71
  JScript = ExternalRuntime.new(
79
72
  :name => "JScript",
@@ -81,7 +74,7 @@ module ExecJS
81
74
  :runner_path => ExecJS.root + "/support/jscript_runner.js",
82
75
  :encoding => 'UTF-16LE' # CScript with //U returns UTF-16LE
83
76
  )
84
-
77
+
85
78
  instance_variable_set(:@runtimes, [
86
79
  RubyRacer,
87
80
  RubyRhino,
@@ -95,5 +88,5 @@ module ExecJS
95
88
  end
96
89
 
97
90
  self.runtime = Runtimes.autodetect
98
-
91
+
99
92
  end
@@ -196,22 +196,6 @@ module BPM
196
196
  end.compact
197
197
  end
198
198
 
199
- def pipeline_libs
200
- (pipeline && pipeline['libs']) || ['lib']
201
- end
202
-
203
- def pipeline_css
204
- (pipeline && pipeline['css']) || ['css']
205
- end
206
-
207
- def pipeline_assets
208
- (pipeline && pipeline['assets']) || ['assets', 'resources']
209
- end
210
-
211
- def pipeline_tests
212
- (pipeline && pipeline['tests']) || ['tests']
213
- end
214
-
215
199
  # Returns a hash of dependencies inferred from the build settings.
216
200
  def dependencies_build
217
201
  ret = {}
@@ -5,8 +5,8 @@ module BPM
5
5
  class GeneratedAsset < Sprockets::BundledAsset
6
6
 
7
7
  FORMAT_METHODS = {
8
- 'text/css' => ['css', 'pipeline_css'],
9
- 'application/javascript' => ['lib', 'pipeline_libs']
8
+ 'text/css' => ['css'],
9
+ 'application/javascript' => ['lib']
10
10
  }
11
11
 
12
12
  def self.generating_asset
@@ -142,8 +142,7 @@ module BPM
142
142
  end
143
143
 
144
144
  def build_dependency_context_and_body
145
-
146
- project = environment.project
145
+ project = environment.project
147
146
  settings = project.build_settings(environment.mode)[asset_name]
148
147
  pkgs = settings.keys.map do |pkg_name|
149
148
  if pkg_name == project.name
@@ -180,13 +179,20 @@ EOF
180
179
  context.require_asset(pathname) # start with self
181
180
 
182
181
  if pathname.to_s =~ /_tests\.js$/
183
- dir_name, dir_method = ['tests', 'pipeline_tests']
182
+ dir_name, dir_method = ['tests']
184
183
  else
185
- dir_name, dir_method = FORMAT_METHODS[content_type] || ['lib', 'pipeline_libs']
184
+ dir_name, dir_method = FORMAT_METHODS[content_type] || ['lib']
186
185
  end
187
186
 
188
- pkgs.map do |pkg|
189
- settings[pkg.name].each do |file|
187
+ require_assets(pkgs, settings, context)
188
+
189
+ return context, body
190
+ end
191
+
192
+ def require_assets(packages, settings, context)
193
+ packages.map do |pkg|
194
+ files = settings[pkg.name] || ['lib']
195
+ files.each do |file|
190
196
  dir = pkg.directories.find{|name, path| file =~ /^#{Regexp.escape(name)}(\/|$)/ }
191
197
  if dir
192
198
  dir_alias = dir[0]
@@ -209,8 +215,6 @@ EOF
209
215
  end
210
216
  end
211
217
  end
212
-
213
- return context, body
214
218
  end
215
219
 
216
220
  end
@@ -35,6 +35,8 @@ module BPM
35
35
  def build_dependency_context_and_body
36
36
 
37
37
  project = environment.project
38
+ # We hardcode this to bpm_libs.js since that's what the plugin should be depending on
39
+ settings = project.build_settings(environment.mode)["bpm_libs.js"]
38
40
  pkg_name, module_id = plugin_module
39
41
  pkg = project.package_from_name pkg_name
40
42
 
@@ -51,18 +53,7 @@ module BPM
51
53
  # add requires for each depedency to context
52
54
  context = blank_context
53
55
 
54
- deps.map do |pkg|
55
- pkg.load_json
56
- pkg.pipeline_libs.each do |dir|
57
- dir_name = pkg.directories[dir] || dir
58
- search_path = File.expand_path File.join(pkg.root_path, dir_name)
59
-
60
- Dir[File.join(search_path, '**', '*')].sort.each do |fn|
61
- context.depend_on File.dirname(fn)
62
- context.require_asset(fn) if context.asset_requirable? fn
63
- end
64
- end
65
- end
56
+ require_assets(deps, settings, context)
66
57
 
67
58
  # require asset itself - this should be included directly in the body
68
59
  # we don't want to use any processors
@@ -1,4 +1,4 @@
1
1
  module BPM
2
- VERSION = "1.0.0.rc.1"
2
+ VERSION = "1.0.0.rc.2"
3
3
  COMPAT_VERSION = '1.0.0'
4
4
  end
@@ -2,24 +2,24 @@ require "spec_helper"
2
2
  require "libgems/format"
3
3
 
4
4
  describe "bpm pack" do
5
-
5
+
6
6
  describe "when logged in" do
7
7
  let(:email) { "who@example.com" }
8
-
8
+
9
9
  before do
10
10
  goto_home
11
11
  write_creds(email, "deadbeef")
12
12
  end
13
-
13
+
14
14
  it "builds a bpm from a given package.json" do
15
15
  FileUtils.cp_r package_fixture("core-test"), "."
16
16
  cd "core-test"
17
17
  bpm "pack"
18
-
18
+
19
19
  exit_status.should be_success
20
20
  output = stdout.read
21
21
  output.should include("Successfully built package: core-test-0.4.9.bpkg")
22
-
22
+
23
23
  package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
24
24
  package.spec.name.should == "core-test"
25
25
  package.spec.version.should == LibGems::Version.new("0.4.9")
@@ -36,67 +36,67 @@ describe "bpm pack" do
36
36
  end
37
37
 
38
38
  end
39
-
39
+
40
40
  describe "without logging in" do
41
41
  before do
42
42
  goto_home
43
43
  end
44
-
44
+
45
45
  it "pack a bpm from a given package.json" do
46
46
  FileUtils.cp_r package_fixture("core-test"), "."
47
47
  cd "core-test"
48
48
  bpm "pack", "-e", "joe@example.com"
49
-
49
+
50
50
  exit_status.should be_success
51
-
51
+
52
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
56
-
56
+
57
57
  it "builds a bpm when given a path to a package" do
58
58
  FileUtils.cp_r package_fixture("core-test"), "."
59
59
  bpm "pack", "core-test", "-e", "joe@example.com"
60
-
60
+
61
61
  exit_status.should be_success
62
-
62
+
63
63
  cd 'core-test'
64
64
  package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
65
65
  package.spec.name.should == "core-test"
66
66
  package.spec.version.should == LibGems::Version.new("0.4.9")
67
67
  end
68
-
68
+
69
69
  it "sets the email address if one is given" do
70
70
  FileUtils.cp_r package_fixture("core-test"), "."
71
71
  cd "core-test"
72
72
  bpm "pack", "-e", "lucy@allen.com"
73
-
73
+
74
74
  exit_status.should be_success
75
75
  output = stdout.read
76
-
76
+
77
77
  package = LibGems::Format.from_file_by_path("core-test-0.4.9.bpkg")
78
78
  package.spec.name.should == "core-test"
79
79
  package.spec.version.should == LibGems::Version.new("0.4.9")
80
80
  package.spec.email.should == "lucy@allen.com"
81
81
  end
82
82
  end
83
-
83
+
84
84
  describe "with an invalid package.json" do
85
85
  before do
86
86
  goto_home
87
87
  write_api_key("deadbeef")
88
88
  end
89
-
89
+
90
90
  it "reports error messages" do
91
91
  FileUtils.touch "package.json"
92
92
  bpm "pack", :track_stderr => true
93
-
93
+
94
94
  exit_status.should_not be_success
95
95
  output = stderr.read
96
96
  output.should include("There was a problem parsing package.json")
97
97
  end
98
98
  end
99
-
99
+
100
100
  describe "npm-compatible package" do
101
101
  before do
102
102
  goto_home
@@ -104,42 +104,54 @@ describe "bpm pack" do
104
104
  cd home("backbone")
105
105
  bpm "pack", :track_stderr => true and wait
106
106
  end
107
-
107
+
108
108
  it "successfully packs" do
109
109
  exit_status.should be_success
110
110
  end
111
-
111
+
112
112
  it "gets name and version" do
113
113
  package = LibGems::Format.from_file_by_path("backbone-0.5.1.bpkg")
114
114
  package.spec.name.should == "backbone"
115
115
  package.spec.version.should == LibGems::Version.new("0.5.1")
116
116
  end
117
-
117
+
118
118
  it "gets the homepage" do
119
119
  package = LibGems::Format.from_file_by_path("backbone-0.5.1.bpkg")
120
120
  package.spec.homepage.should == 'http://documentcloud.github.com/backbone/'
121
121
  end
122
-
122
+
123
123
  end
124
-
124
+
125
125
  describe "package with plugins" do
126
126
  before do
127
127
  goto_home
128
128
  FileUtils.cp_r project_fixture('coffee', 'vendor'), '.'
129
129
  end
130
-
130
+
131
131
  it "should pack transports" do
132
132
  cd home('vendor', 'spade')
133
133
  bpm "pack" and wait
134
- puts stdout.read
135
134
  exit_status.should be_success
136
-
135
+
137
136
  package = LibGems::Format.from_file_by_path 'spade-1.0.0.bpkg'
138
137
  package.spec.files.should include('lib/main.js')
139
138
  package.spec.files.should include('transport.js')
140
139
  end
141
140
  end
142
-
141
+
142
+ describe "lib-less package" do
143
+ before do
144
+ goto_home
145
+ FileUtils.cp_r package_fixture("sproutcore-handlebars-format"), '.'
146
+ end
147
+
148
+ it "should pack without requiring lib" do
149
+ cd home('sproutcore-handlebars-format')
150
+ bpm "pack" and wait
151
+ exit_status.should be_success
152
+ end
153
+ end
154
+
143
155
  end
144
156
 
145
-
157
+
@@ -0,0 +1,5 @@
1
+ /*globals exports */
2
+ exports.compileFormat = function(code, context, filename) {
3
+ return "return SC.Handlebars.compile("+JSON.stringify(code)+");";
4
+ };
5
+
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "sproutcore-handlebars-format",
3
+ "author": "Yehuda Katz",
4
+ "version": "2.0.beta.3.1",
5
+ "description": "Adds format support for handlebars templates",
6
+ "summary": "Adds format support for handlebars templates",
7
+ "homepage": "http://www.sproutcore.com",
8
+
9
+ "directories": {
10
+ "lib": []
11
+ },
12
+
13
+ "bpm:provides": {
14
+ "format": {
15
+ "mime:default": "application/javascript",
16
+ "main": "sproutcore-handlebars-format/format"
17
+ }
18
+ }
19
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.1
4
+ version: 1.0.0.rc.2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-09 00:00:00.000000000Z
13
+ date: 2011-09-14 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: libgems
17
- requirement: &70138028498600 !ruby/object:Gem::Requirement
17
+ requirement: &70191052678920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.1.3
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70138028498600
25
+ version_requirements: *70191052678920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: gemcutter
28
- requirement: &70138028497340 !ruby/object:Gem::Requirement
28
+ requirement: &70191052677960 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.6.1
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70138028497340
36
+ version_requirements: *70191052677960
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: highline
39
- requirement: &70138028496760 !ruby/object:Gem::Requirement
39
+ requirement: &70191052672680 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.6.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70138028496760
47
+ version_requirements: *70191052672680
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: json_pure
50
- requirement: &70138028496200 !ruby/object:Gem::Requirement
50
+ requirement: &70191052671720 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.4.6
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70138028496200
58
+ version_requirements: *70191052671720
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: thor
61
- requirement: &70138028495460 !ruby/object:Gem::Requirement
61
+ requirement: &70191052670660 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.14.3
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70138028495460
69
+ version_requirements: *70191052670660
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: execjs
72
- requirement: &70138028494700 !ruby/object:Gem::Requirement
72
+ requirement: &70191052669580 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.2.4
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70138028494700
80
+ version_requirements: *70191052669580
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: sprockets
83
- requirement: &70138028493980 !ruby/object:Gem::Requirement
83
+ requirement: &70191052668620 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 2.0.0
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *70138028493980
91
+ version_requirements: *70191052668620
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rspec
94
- requirement: &70138028493280 !ruby/object:Gem::Requirement
94
+ requirement: &70191052667680 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70138028493280
102
+ version_requirements: *70191052667680
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rack
105
- requirement: &70138028492180 !ruby/object:Gem::Requirement
105
+ requirement: &70191052666080 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: 1.3.2
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70138028492180
113
+ version_requirements: *70191052666080
114
114
  description: Browser Package Manager
115
115
  email:
116
116
  - charles@sproutcore.com
@@ -400,6 +400,8 @@ files:
400
400
  - spec/fixtures/packages/rake-0.8.7/test/capture_stdout.rb
401
401
  - spec/fixtures/packages/spade/lib/main.js
402
402
  - spec/fixtures/packages/spade/package.json
403
+ - spec/fixtures/packages/sproutcore-handlebars-format/format.js
404
+ - spec/fixtures/packages/sproutcore-handlebars-format/package.json
403
405
  - spec/fixtures/packages/uglify-js/README.html
404
406
  - spec/fixtures/packages/uglify-js/README.org
405
407
  - spec/fixtures/packages/uglify-js/bin/uglifyjs
@@ -772,6 +774,8 @@ test_files:
772
774
  - spec/fixtures/packages/rake-0.8.7/test/capture_stdout.rb
773
775
  - spec/fixtures/packages/spade/lib/main.js
774
776
  - spec/fixtures/packages/spade/package.json
777
+ - spec/fixtures/packages/sproutcore-handlebars-format/format.js
778
+ - spec/fixtures/packages/sproutcore-handlebars-format/package.json
775
779
  - spec/fixtures/packages/uglify-js/README.html
776
780
  - spec/fixtures/packages/uglify-js/README.org
777
781
  - spec/fixtures/packages/uglify-js/bin/uglifyjs