Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 25e620e

Browse files
committed
Exclude fallback paths when compiling with r.js, as they don't make sense for compilation purposes and cause r.js to choke
1 parent 19b7829 commit 25e620e

File tree

3 files changed

+80
-80
lines changed

3 files changed

+80
-80
lines changed

Gemfile.lock

Lines changed: 64 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,82 @@ PATH
77
GEM
88
remote: http://rubygems.org/
99
specs:
10-
actionmailer (3.2.8)
11-
actionpack (= 3.2.8)
12-
mail (~> 2.4.4)
13-
actionpack (3.2.8)
14-
activemodel (= 3.2.8)
15-
activesupport (= 3.2.8)
16-
builder (~> 3.0.0)
10+
actionmailer (4.0.3)
11+
actionpack (= 4.0.3)
12+
mail (~> 2.5.4)
13+
actionpack (4.0.3)
14+
activesupport (= 4.0.3)
15+
builder (~> 3.1.0)
1716
erubis (~> 2.7.0)
18-
journey (~> 1.0.4)
19-
rack (~> 1.4.0)
20-
rack-cache (~> 1.2)
21-
rack-test (~> 0.6.1)
22-
sprockets (~> 2.1.3)
23-
activemodel (3.2.8)
24-
activesupport (= 3.2.8)
25-
builder (~> 3.0.0)
26-
activerecord (3.2.8)
27-
activemodel (= 3.2.8)
28-
activesupport (= 3.2.8)
29-
arel (~> 3.0.2)
30-
tzinfo (~> 0.3.29)
31-
activeresource (3.2.8)
32-
activemodel (= 3.2.8)
33-
activesupport (= 3.2.8)
34-
activesupport (3.2.8)
35-
i18n (~> 0.6)
36-
multi_json (~> 1.0)
37-
arel (3.0.2)
38-
builder (3.0.4)
17+
rack (~> 1.5.2)
18+
rack-test (~> 0.6.2)
19+
activemodel (4.0.3)
20+
activesupport (= 4.0.3)
21+
builder (~> 3.1.0)
22+
activerecord (4.0.3)
23+
activemodel (= 4.0.3)
24+
activerecord-deprecated_finders (~> 1.0.2)
25+
activesupport (= 4.0.3)
26+
arel (~> 4.0.0)
27+
activerecord-deprecated_finders (1.0.3)
28+
activesupport (4.0.3)
29+
i18n (~> 0.6, >= 0.6.4)
30+
minitest (~> 4.2)
31+
multi_json (~> 1.3)
32+
thread_safe (~> 0.1)
33+
tzinfo (~> 0.3.37)
34+
arel (4.0.2)
35+
atomic (1.1.15)
36+
builder (3.1.4)
3937
erubis (2.7.0)
40-
execjs (1.4.0)
41-
multi_json (~> 1.0)
42-
hike (1.2.1)
43-
i18n (0.6.1)
44-
journey (1.0.4)
45-
jquery-rails (2.1.3)
46-
railties (>= 3.1.0, < 5.0)
47-
thor (~> 0.14)
48-
json (1.7.5)
49-
mail (2.4.4)
50-
i18n (>= 0.4.0)
38+
execjs (2.0.2)
39+
hike (1.2.3)
40+
i18n (0.6.9)
41+
jquery-rails (3.1.0)
42+
railties (>= 3.0, < 5.0)
43+
thor (>= 0.14, < 2.0)
44+
mail (2.5.4)
5145
mime-types (~> 1.16)
5246
treetop (~> 1.4.8)
53-
mime-types (1.19)
54-
multi_json (1.3.7)
55-
polyglot (0.3.3)
56-
rack (1.4.1)
57-
rack-cache (1.2)
58-
rack (>= 0.4)
59-
rack-ssl (1.3.2)
60-
rack
47+
mime-types (1.25.1)
48+
minitest (4.7.5)
49+
multi_json (1.9.0)
50+
polyglot (0.3.4)
51+
rack (1.5.2)
6152
rack-test (0.6.2)
6253
rack (>= 1.0)
63-
rails (3.2.8)
64-
actionmailer (= 3.2.8)
65-
actionpack (= 3.2.8)
66-
activerecord (= 3.2.8)
67-
activeresource (= 3.2.8)
68-
activesupport (= 3.2.8)
69-
bundler (~> 1.0)
70-
railties (= 3.2.8)
71-
railties (3.2.8)
72-
actionpack (= 3.2.8)
73-
activesupport (= 3.2.8)
74-
rack-ssl (~> 1.3.2)
54+
rails (4.0.3)
55+
actionmailer (= 4.0.3)
56+
actionpack (= 4.0.3)
57+
activerecord (= 4.0.3)
58+
activesupport (= 4.0.3)
59+
bundler (>= 1.3.0, < 2.0)
60+
railties (= 4.0.3)
61+
sprockets-rails (~> 2.0.0)
62+
railties (4.0.3)
63+
actionpack (= 4.0.3)
64+
activesupport (= 4.0.3)
7565
rake (>= 0.8.7)
76-
rdoc (~> 3.4)
77-
thor (>= 0.14.6, < 2.0)
78-
rake (0.9.2.2)
79-
rdoc (3.12)
80-
json (~> 1.4)
81-
sprockets (2.1.3)
66+
thor (>= 0.18.1, < 2.0)
67+
rake (10.1.1)
68+
sprockets (2.11.0)
8269
hike (~> 1.2)
70+
multi_json (~> 1.0)
8371
rack (~> 1.0)
8472
tilt (~> 1.1, != 1.3.0)
85-
sqlite3 (1.3.6)
86-
thor (0.16.0)
87-
tilt (1.3.3)
88-
treetop (1.4.12)
73+
sprockets-rails (2.0.1)
74+
actionpack (>= 3.0)
75+
activesupport (>= 3.0)
76+
sprockets (~> 2.8)
77+
sqlite3 (1.3.9)
78+
thor (0.18.1)
79+
thread_safe (0.2.0)
80+
atomic (>= 1.1.7, < 2)
81+
tilt (1.4.1)
82+
treetop (1.4.15)
8983
polyglot
9084
polyglot (>= 0.3.1)
91-
tzinfo (0.3.35)
85+
tzinfo (0.3.38)
9286

9387
PLATFORMS
9488
ruby

lib/requirejs/rails/rjs_driver.js.erb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
var requirejs = require('<%= rjs_path %>'),
33
//Set up basic config, include config that is
44
//common to all the optimize() calls.
5-
basConfig = <%= JSON.pretty_generate(build_config.reject {|k,v| k == 'modules'}) %>;
5+
baseConfig = <%=
6+
modifiedHash = build_config.select {|k, _| k != "modules"}
7+
pathsHash = modifiedHash["paths"]
8+
modifiedHash["paths"] = pathsHash.select {|_, v| !v.is_a?(Array)} if !pathsHash.nil?
9+
10+
JSON.pretty_generate(modifiedHash)
11+
%>;
612

713
// Function used to mix in baseConfig to a new config target
814
function mix(target) {
9-
for (var prop in basConfig) {
10-
if (basConfig.hasOwnProperty(prop)) {
11-
target[prop] = basConfig[prop];
15+
for (var prop in baseConfig) {
16+
if (baseConfig.hasOwnProperty(prop)) {
17+
target[prop] = baseConfig[prop];
1218
}
1319
}
1420
return target;
@@ -32,7 +38,7 @@ var errback = function(error) {
3238
// r.js will eventually need a nested call idiom to handle async
3339
// builds. Anticipating that need.
3440
var async_runner = module_specs.reduceRight(function(prev, curr) {
35-
return function (buildReportText) {
41+
return function (buildReportText) {
3642
requirejs.optimize(mix(curr), prev);
3743
requirejs.optimize(mix(curr), prev, errback);
3844
};

lib/tasks/requirejs-rails_tasks.rake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace :requirejs do
6666
Unable to find 'node' on the current path, required for precompilation
6767
using the requirejs-ruby gem. To install node.js, see http://nodejs.org/
6868
OS X Homebrew users can use 'brew install node'.
69-
EOM
69+
EOM
7070
exit 1
7171
end
7272
end
@@ -115,9 +115,9 @@ EOM
115115
"requirejs:test_node"] do
116116
requirejs.config.target_dir.mkpath
117117

118-
`node "#{requirejs.config.driver_path}"`
118+
result = `node "#{requirejs.config.driver_path}"`
119119
unless $?.success?
120-
raise RuntimeError, "Asset compilation with node failed."
120+
raise RuntimeError, "Asset compilation with node failed with error:\n\n#{result}\n"
121121
end
122122
end
123123

@@ -133,15 +133,15 @@ EOM
133133
FileUtils.cp built_asset_path, digest_asset_path
134134

135135
# Create the compressed versions
136-
File.open("#{built_asset_path}.gz",'wb') do |f|
136+
File.open("#{built_asset_path}.gz", 'wb') do |f|
137137
zgw = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
138138
zgw.write built_asset_path.read
139139
zgw.close
140140
end
141141
FileUtils.cp "#{built_asset_path}.gz", "#{digest_asset_path}.gz"
142142

143143
requirejs.config.manifest_path.open('wb') do |f|
144-
YAML.dump(requirejs.manifest,f)
144+
YAML.dump(requirejs.manifest, f)
145145
end
146146
end
147147
end

0 commit comments

Comments
 (0)