File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
railties/lib/rails/generators/rails/app/templates/bin Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
- require 'pathname'
2
-
3
1
APP_ROOT = File.expand_path('..', __dir__)
4
2
Dir.chdir(APP_ROOT) do
5
- executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
6
- normalized_path = File.expand_path(path)
7
-
8
- normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn'))
9
- end
3
+ yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
4
+ select { |dir| File.expand_path(dir) != __dir__ }.
5
+ product(["yarn", "yarn.exe"]).
6
+ map { |dir, file| File.expand_path(file, dir) }.
7
+ find { |file| File.executable?(file) }
10
8
11
- if executable_path
12
- exec File.expand_path(Pathname.new(executable_path).join(' yarn')) , *ARGV
9
+ if yarn
10
+ exec yarn, *ARGV
13
11
else
14
12
$stderr.puts "Yarn executable was not detected in the system."
15
13
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
You can’t perform that action at this time.
0 commit comments