diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-18 02:32:44 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-20 22:35:22 +0300 |
commit | 03d2001cf2ee0bc93d5e413b30387382ec13e1e9 (patch) | |
tree | 06a1c32091262e3828ab919cdb642d05cefb40bd /bin | |
parent | e7e34a8c24ad6527660e308592117e0a6bd03176 (diff) |
Update yarn files for rails 6
Also allow `yarnpkg` binary for `bin/yarn`
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/setup | 3 | ||||
-rwxr-xr-x | bin/yarn | 12 |
2 files changed, 12 insertions, 3 deletions
@@ -17,6 +17,9 @@ FileUtils.chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies + system! 'bin/yarn' + # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' @@ -1,9 +1,15 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT + yarn = ENV["PATH"].split(File::PATH_SEPARATOR). + select { |dir| File.expand_path(dir) != __dir__ }. + product(["yarn", "yarn.cmd", "yarn.ps1", "yarnpkg"]). + map { |dir, file| File.expand_path(file, dir) }. + find { |file| File.executable?(file) } + + if yarn + exec yarn, *ARGV + else $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 |