bpm 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bpm/cli/base.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'thor'
2
- require 'highline'
3
2
 
4
3
  module BPM
5
4
  module CLI
@@ -144,6 +143,7 @@ module BPM
144
143
  password = options[:password]
145
144
 
146
145
  unless email && password
146
+ require 'highline'
147
147
  highline = HighLine.new
148
148
  say "Enter your BPM credentials."
149
149
 
data/lib/bpm/pipeline.rb CHANGED
@@ -3,10 +3,6 @@ require 'v8'
3
3
 
4
4
  module BPM
5
5
 
6
- autoload :DirectiveProcessor, 'bpm/pipeline/directive_processor'
7
- autoload :GeneratedAsset, 'bpm/pipeline/generated_asset'
8
- autoload :TransportProcessor, 'bpm/pipeline/transport_processor'
9
-
10
6
  # A BPM package-aware asset pipeline. Asset lookup respects package.json
11
7
  # directory configurations as well as loading preprocessors, formats, and
12
8
  # postprocessors from the package config.
data/lib/bpm/project.rb CHANGED
@@ -203,27 +203,40 @@ module BPM
203
203
  # a package known to the project.
204
204
  def package_and_module_from_path(path)
205
205
  path = File.expand_path path.to_s
206
- pkg = local_deps.find {|cur| path =~ /^#{Regexp.escape cur.root_path.to_s}/}
206
+ pkg = local_deps.find {|cur| path =~ /^#{Regexp.escape cur.root_path.to_s}\//}
207
207
  pkg = self if pkg.nil? && path =~ /^#{Regexp.escape root_path.to_s}/
208
208
  raise "#{path} is not within a known package" if pkg.nil?
209
-
210
- path = Pathname.new(path).relative_path_from(Pathname.new(pkg.root_path)).split.map { |x| x.to_s }
211
-
212
- dir_name = pkg.directories.find do |dir_key, dname|
213
- Array(dname).include?(path.first)
209
+
210
+ dir_name = nil
211
+ pkg.directories.each do |dname, dpath|
212
+ dpaths = Array(dpath).map{|d| File.expand_path(d, pkg.root_path) }
213
+ dpaths.each do |d|
214
+ # Find a match and see if we can replace
215
+ if path.gsub!(/^#{Regexp.escape(d)}\//, "#{dname}/")
216
+ dir_name = dname
217
+ break
218
+ end
219
+ end
220
+ break if dir_name
214
221
  end
215
-
216
- dir_name = dir_name ? dir_name.first : path.first
222
+
223
+ if dir_name
224
+ parts = path.split("/")
225
+ else
226
+ parts = Pathname.new(path).relative_path_from(Pathname.new(pkg.root_path)).to_s.split("/")
227
+ dir_name = parts.first
228
+ end
229
+
217
230
  if dir_name == 'lib'
218
- path.shift
231
+ parts.shift
219
232
  else
220
- path[0] = "~#{dir_name}"
233
+ parts[0] = "~#{dir_name}"
221
234
  end
222
-
223
- path[path.size-1] = File.basename path.last, '.*'
224
- [pkg, path.join('/')]
235
+
236
+ parts[parts.size-1] = File.basename(parts.last, '.*')
237
+ [pkg, parts.join('/')]
225
238
  end
226
-
239
+
227
240
  def local_deps(verbose=false)
228
241
  @local_deps ||= build_local_deps
229
242
  end
data/lib/bpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module BPM
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/bpm.rb CHANGED
@@ -1,4 +1,5 @@
1
- require 'vendored_sprockets'
1
+ # Included vendored sprockets
2
+ $:.unshift File.expand_path('../../vendor/sprockets/lib', __FILE__)
2
3
 
3
4
  module BPM
4
5
  BPM_DIR = ".bpm"
@@ -12,9 +13,12 @@ module BPM
12
13
  autoload :Repository, 'bpm/repository'
13
14
  autoload :Project, 'bpm/project'
14
15
  autoload :Server, 'bpm/server'
15
-
16
+ autoload :Pipeline, 'bpm/pipeline'
17
+ autoload :DirectiveProcessor, 'bpm/pipeline/directive_processor'
18
+ autoload :GeneratedAsset, 'bpm/pipeline/generated_asset'
19
+ autoload :TransportProcessor, 'bpm/pipeline/transport_processor'
16
20
  end
17
21
 
22
+ # The BPM constants need to be defined first
18
23
  require 'bpm/libgems_ext'
19
- require 'bpm/pipeline'
20
24
 
data/spec/project_spec.rb CHANGED
@@ -144,3 +144,23 @@ describe BPM::Project, "converting" do
144
144
  subject["bpm"].should == BPM::VERSION
145
145
  end
146
146
  end
147
+
148
+ describe BPM::Project, "package_and_module_from_path" do
149
+
150
+ it "should find package in deps"
151
+
152
+ it "should fallback to self if not found in deps"
153
+
154
+ it "should throw error if no package"
155
+
156
+ it "should not match partial directories"
157
+ # i.e. packages/sproutcore should not match for packages/sproutcore-runtime
158
+
159
+ it "should handle and valid directory reference in package directories array"
160
+ # i.e. "lib": ["./lib", "./vendor/lib"]
161
+
162
+ it "should replace with directory names"
163
+
164
+ it "should not include lib directory in module name"
165
+
166
+ end
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: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-07-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: libgems
17
- requirement: &2152900100 !ruby/object:Gem::Requirement
17
+ requirement: &2152430900 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.0.2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152900100
25
+ version_requirements: *2152430900
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: gemcutter
28
- requirement: &2152899580 !ruby/object:Gem::Requirement
28
+ requirement: &2152429720 !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: *2152899580
36
+ version_requirements: *2152429720
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: highline
39
- requirement: &2152892580 !ruby/object:Gem::Requirement
39
+ requirement: &2152428900 !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: *2152892580
47
+ version_requirements: *2152428900
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: json_pure
50
- requirement: &2152892040 !ruby/object:Gem::Requirement
50
+ requirement: &2152427980 !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: *2152892040
58
+ version_requirements: *2152427980
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: thor
61
- requirement: &2152891520 !ruby/object:Gem::Requirement
61
+ requirement: &2152427400 !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: *2152891520
69
+ version_requirements: *2152427400
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: therubyracer
72
- requirement: &2152890860 !ruby/object:Gem::Requirement
72
+ requirement: &2152426800 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.9.2
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2152890860
80
+ version_requirements: *2152426800
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: hike
83
- requirement: &2152890280 !ruby/object:Gem::Requirement
83
+ requirement: &2152426080 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '1.1'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2152890280
91
+ version_requirements: *2152426080
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rack
94
- requirement: &2152889680 !ruby/object:Gem::Requirement
94
+ requirement: &2152424780 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '1.0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2152889680
102
+ version_requirements: *2152424780
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: tilt
105
- requirement: &2152889020 !ruby/object:Gem::Requirement
105
+ requirement: &2152423440 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -113,10 +113,10 @@ dependencies:
113
113
  version: 1.3.0
114
114
  type: :runtime
115
115
  prerelease: false
116
- version_requirements: *2152889020
116
+ version_requirements: *2152423440
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rspec
119
- requirement: &2152888020 !ruby/object:Gem::Requirement
119
+ requirement: &2152420620 !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
122
122
  - - ! '>='
@@ -124,10 +124,10 @@ dependencies:
124
124
  version: '0'
125
125
  type: :development
126
126
  prerelease: false
127
- version_requirements: *2152888020
127
+ version_requirements: *2152420620
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: rack
130
- requirement: &2152886700 !ruby/object:Gem::Requirement
130
+ requirement: &2152418640 !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
133
133
  - - ~>
@@ -135,7 +135,7 @@ dependencies:
135
135
  version: 1.2.1
136
136
  type: :development
137
137
  prerelease: false
138
- version_requirements: *2152886700
138
+ version_requirements: *2152418640
139
139
  description: Package Manager for JavaScript
140
140
  email:
141
141
  - charles@sproutcore.com
@@ -334,7 +334,6 @@ files:
334
334
  - lib/bpm/repository.rb
335
335
  - lib/bpm/server.rb
336
336
  - lib/bpm/version.rb
337
- - lib/vendored_sprockets.rb
338
337
  - spec/cli/add_spec.rb
339
338
  - spec/cli/build_spec.rb
340
339
  - spec/cli/fetch_spec.rb
@@ -1,7 +0,0 @@
1
- if defined?(Sprockets)
2
- warn "Sprockets has already been required. " +
3
- "This may cause BPM to malfunction in unexpected ways."
4
- end
5
- $:.unshift File.expand_path('../../vendor/sprockets/lib', __FILE__)
6
- require 'sprockets'
7
-