bpm 1.0.0.rc.2 → 1.0.0.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bpm.gemspec +2 -0
- data/lib/bpm.rb +3 -0
- data/lib/bpm/package.rb +1 -7
- data/lib/bpm/pipeline.rb +6 -0
- data/lib/bpm/pipeline/generated_asset.rb +1 -1
- data/lib/bpm/pipeline/package_pipeline.rb +6 -1
- data/lib/bpm/rack.rb +20 -0
- data/lib/bpm/railtie.rb +17 -0
- data/lib/bpm/server.rb +6 -9
- data/lib/bpm/version.rb +1 -1
- metadata +44 -20
data/bpm.gemspec
CHANGED
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency "thor", "~> 0.14.3"
|
24
24
|
s.add_dependency "execjs", "~> 1.2.4"
|
25
25
|
s.add_dependency "sprockets", "~> 2.0.0"
|
26
|
+
s.add_dependency "eventmachine", "~> 1.0.0.beta.4" # There are issues with 0.12.10 and thin
|
27
|
+
s.add_dependency "thin", "~> 1.2"
|
26
28
|
|
27
29
|
s.add_development_dependency "rspec"
|
28
30
|
s.add_development_dependency "rack", "~> 1.3.2"
|
data/lib/bpm.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
Encoding.default_external = 'UTF-8'
|
2
2
|
|
3
|
+
require 'bpm/railtie' if defined?(Rails)
|
4
|
+
|
3
5
|
module BPM
|
4
6
|
BPM_DIR = ".bpm"
|
5
7
|
TEMPLATES_DIR = File.expand_path("../../templates", __FILE__)
|
@@ -12,6 +14,7 @@ module BPM
|
|
12
14
|
autoload :Remote, 'bpm/remote'
|
13
15
|
autoload :Repository, 'bpm/repository'
|
14
16
|
autoload :Project, 'bpm/project'
|
17
|
+
autoload :Rack, 'bpm/rack'
|
15
18
|
autoload :Server, 'bpm/server'
|
16
19
|
autoload :Pipeline, 'bpm/pipeline'
|
17
20
|
autoload :DirectiveProcessor, 'bpm/pipeline/directive_processor'
|
data/lib/bpm/package.rb
CHANGED
@@ -401,19 +401,13 @@ module BPM
|
|
401
401
|
# TODO: Make better errors
|
402
402
|
# TODO: This might not work well with conflicting versions
|
403
403
|
def local_deps(search_paths=nil)
|
404
|
-
|
405
|
-
packages_path = File.join(root_path, "packages")
|
406
|
-
search_paths ||= [File.join(root_path, "vendor"), packages_path]
|
404
|
+
search_paths ||= [File.join(root_path, "vendor"), File.join(root_path, "packages")]
|
407
405
|
|
408
406
|
dependencies.inject([]) do |list, (name, version)|
|
409
407
|
packages = search_paths.map{|p| Package.new(File.join(p, name)) }.select{|p| p.has_json? }
|
410
408
|
|
411
409
|
raise "Can't find package #{name} required in #{self.name}" if packages.empty?
|
412
410
|
|
413
|
-
if packages.any?{|p| p.root_path =~ /^#{Regexp.escape(packages_path)}\// }
|
414
|
-
BPM.deprecation_warning "Use the vendor directory instead of the packages directory for #{root_path}"
|
415
|
-
end
|
416
|
-
|
417
411
|
packages.each{|p| p.load_json }
|
418
412
|
|
419
413
|
unless satisfied_by?(version, package.version)
|
data/lib/bpm/pipeline.rb
CHANGED
@@ -118,7 +118,7 @@ module BPM
|
|
118
118
|
|
119
119
|
hash = environment.cache_hash("#{pathname}:minify", id) do
|
120
120
|
data = minify_body hash['source']
|
121
|
-
{ 'length' => Rack::Utils.bytesize(data),
|
121
|
+
{ 'length' => ::Rack::Utils.bytesize(data),
|
122
122
|
'digest' => environment.digest.update(data).hexdigest,
|
123
123
|
'source' => data }
|
124
124
|
end
|
@@ -73,7 +73,12 @@ module BPM
|
|
73
73
|
rescue Sprockets::FileNotFound => e
|
74
74
|
raise Sprockets::FileNotFound, "#{e.message} in package '#{package_name}'"
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
|
+
# Index is for caching, but it causes us problem,
|
78
|
+
# we don't need the caching
|
79
|
+
def index
|
80
|
+
self
|
81
|
+
end
|
77
82
|
|
78
83
|
end
|
79
84
|
end
|
data/lib/bpm/rack.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module BPM
|
2
|
+
class Rack
|
3
|
+
def initialize(app, project, opts={})
|
4
|
+
mode = opts[:mode] || :debug
|
5
|
+
|
6
|
+
@app = app
|
7
|
+
@prefix = File.join('/', opts[:url_prefix] || '', 'assets')
|
8
|
+
@pipeline = BPM::Pipeline.new(project, mode, true)
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
if env['PATH_INFO'] =~ /^#{@prefix}\/(.+)$/
|
13
|
+
env['PATH_INFO'] = $1
|
14
|
+
@pipeline.call(env)
|
15
|
+
else
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bpm/railtie.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module BPM
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
railtie_name :bpm_rails
|
4
|
+
|
5
|
+
config.preview_bpm_app = false
|
6
|
+
config.bpm_app_dir = 'app'
|
7
|
+
|
8
|
+
initializer "bpm_rails.insert_bpm_pipeline" do |app|
|
9
|
+
if app.config.preview_bpm_app
|
10
|
+
path = app.config.bpm_app_dir
|
11
|
+
full_path = File.join(app.paths['public'].first, app.config.bpm_app_dir)
|
12
|
+
project = BPM::Project.new(full_path)
|
13
|
+
app.config.middleware.insert_before 'ActionDispatch::Static', 'BPM::Rack', project, :mode => :debug, :url_prefix => path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/bpm/server.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'sprockets'
|
3
|
+
require 'thin'
|
3
4
|
|
4
5
|
module BPM
|
5
6
|
|
6
|
-
class Server < Rack::Server
|
7
|
+
class Server < ::Rack::Server
|
7
8
|
|
8
9
|
def initialize(project, options={})
|
9
10
|
options = default_options.merge(options)
|
11
|
+
options[:server] ||= 'thin'
|
10
12
|
@project = project
|
11
13
|
@mode = options[:mode] || :debug
|
12
14
|
super options
|
@@ -29,14 +31,9 @@ module BPM
|
|
29
31
|
cur_project = @project
|
30
32
|
cur_mode = @mode
|
31
33
|
|
32
|
-
@app ||= Rack::Builder.new do
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
map '/' do
|
38
|
-
run Rack::Directory.new cur_project.root_path
|
39
|
-
end
|
34
|
+
@app ||= ::Rack::Builder.new do
|
35
|
+
use BPM::Rack, cur_project, :mode => cur_mode
|
36
|
+
run ::Rack::Directory.new cur_project.root_path
|
40
37
|
end.to_app
|
41
38
|
end
|
42
39
|
end
|
data/lib/bpm/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0.rc.3
|
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-
|
13
|
+
date: 2011-09-15 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: libgems
|
17
|
-
requirement: &
|
17
|
+
requirement: &70174351642100 !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: *
|
25
|
+
version_requirements: *70174351642100
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: gemcutter
|
28
|
-
requirement: &
|
28
|
+
requirement: &70174351641560 !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: *
|
36
|
+
version_requirements: *70174351641560
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: highline
|
39
|
-
requirement: &
|
39
|
+
requirement: &70174351641000 !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: *
|
47
|
+
version_requirements: *70174351641000
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: json_pure
|
50
|
-
requirement: &
|
50
|
+
requirement: &70174351640500 !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: *
|
58
|
+
version_requirements: *70174351640500
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: thor
|
61
|
-
requirement: &
|
61
|
+
requirement: &70174351639980 !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: *
|
69
|
+
version_requirements: *70174351639980
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: execjs
|
72
|
-
requirement: &
|
72
|
+
requirement: &70174351639500 !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: *
|
80
|
+
version_requirements: *70174351639500
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: sprockets
|
83
|
-
requirement: &
|
83
|
+
requirement: &70174351639020 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,32 @@ dependencies:
|
|
88
88
|
version: 2.0.0
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70174351639020
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: eventmachine
|
94
|
+
requirement: &70174351638520 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.0.0.beta.4
|
100
|
+
type: :runtime
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70174351638520
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: thin
|
105
|
+
requirement: &70174351638040 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.2'
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *70174351638040
|
92
114
|
- !ruby/object:Gem::Dependency
|
93
115
|
name: rspec
|
94
|
-
requirement: &
|
116
|
+
requirement: &70174351637660 !ruby/object:Gem::Requirement
|
95
117
|
none: false
|
96
118
|
requirements:
|
97
119
|
- - ! '>='
|
@@ -99,10 +121,10 @@ dependencies:
|
|
99
121
|
version: '0'
|
100
122
|
type: :development
|
101
123
|
prerelease: false
|
102
|
-
version_requirements: *
|
124
|
+
version_requirements: *70174351637660
|
103
125
|
- !ruby/object:Gem::Dependency
|
104
126
|
name: rack
|
105
|
-
requirement: &
|
127
|
+
requirement: &70174351637080 !ruby/object:Gem::Requirement
|
106
128
|
none: false
|
107
129
|
requirements:
|
108
130
|
- - ~>
|
@@ -110,7 +132,7 @@ dependencies:
|
|
110
132
|
version: 1.3.2
|
111
133
|
type: :development
|
112
134
|
prerelease: false
|
113
|
-
version_requirements: *
|
135
|
+
version_requirements: *70174351637080
|
114
136
|
description: Browser Package Manager
|
115
137
|
email:
|
116
138
|
- charles@sproutcore.com
|
@@ -156,6 +178,8 @@ files:
|
|
156
178
|
- lib/bpm/pipeline/source_url_processor.rb
|
157
179
|
- lib/bpm/project.rb
|
158
180
|
- lib/bpm/project_generator.rb
|
181
|
+
- lib/bpm/rack.rb
|
182
|
+
- lib/bpm/railtie.rb
|
159
183
|
- lib/bpm/remote.rb
|
160
184
|
- lib/bpm/repository.rb
|
161
185
|
- lib/bpm/server.rb
|