Skip to content

Commit

Permalink
Fail if yarn is outdated (#363)
Browse files Browse the repository at this point in the history
* Fail if yarn is outdated

* Revert other changes
  • Loading branch information
gauravtiwari authored May 12, 2017
1 parent 7c6f2cf commit 2440970
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/tasks/webpacker/check_yarn.rake
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
namespace :webpacker do
desc "Verifies if yarn is installed"
task :check_yarn do
required_yarn_version = "0.20.1"

begin
version = `yarn --version`
raise Errno::ENOENT if version.blank?
yarn_version = `yarn --version`

raise Errno::ENOENT if yarn_version.blank? || Gem::Version.new(yarn_version) < Gem::Version.new(required_yarn_version)
rescue Errno::ENOENT
puts "Webpacker requires yarn. Please download and install Yarn https://yarnpkg.com/lang/en/docs/install/"
puts "Webpacker requires Yarn version >= #{required_yarn_version}. Please download latest version and install https://yarnpkg.com/lang/en/docs/install/"
puts "Exiting!" && exit!
end
end
Expand Down

0 comments on commit 2440970

Please sign in to comment.