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

Commit ac678ee

Browse files
committed
Ensure that the parent directory a/b for modules with names like a/b/c exist
Credit @jezstephens; fixes #168.
1 parent d6faff8 commit ac678ee

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/tasks/requirejs-rails_tasks.rake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ OS X Homebrew users can use 'brew install node'.
9090
task :prepare_source => ["requirejs:setup",
9191
"requirejs:clean"] do
9292
requirejs.config.source_dir.mkpath
93-
requirejs.config.build_dir.mkpath
94-
requirejs.config.driver_path.parent.mkpath
9593

9694
requirejs.env.each_logical_path do |logical_path|
9795
next unless requirejs.config.asset_allowed?(logical_path)
@@ -109,7 +107,9 @@ OS X Homebrew users can use 'brew install node'.
109107

110108
task :run_rjs => ["requirejs:setup",
111109
"requirejs:test_node"] do
110+
requirejs.config.build_dir.mkpath
112111
requirejs.config.target_dir.mkpath
112+
requirejs.config.driver_path.dirname.mkpath
113113

114114
result = `node "#{requirejs.config.driver_path}"`
115115
unless $?.success?
@@ -125,6 +125,10 @@ OS X Homebrew users can use 'brew install node'.
125125
built_asset_path = requirejs.config.build_dir.join(asset_name)
126126
digest_name = asset_name.sub(/\.(\w+)$/) { |ext| "-#{requirejs.builder.digest_for(built_asset_path)}#{ext}" }
127127
digest_asset_path = requirejs.config.target_dir + digest_name
128+
129+
# Ensure that the parent directory `a/b` for modules with names like `a/b/c` exist.
130+
digest_asset_path.dirname.mkpath
131+
128132
requirejs.manifest[asset_name] = digest_name
129133
FileUtils.cp built_asset_path, digest_asset_path
130134

0 commit comments

Comments
 (0)