Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Commit

Permalink
Improve yarn detection
Browse files Browse the repository at this point in the history
  • Loading branch information
johansmitsnl committed Aug 10, 2018
1 parent 57d30ff commit f56d1ac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/generators/hyperloop/install_bootstrap_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ class InstallBootstrapGenerator < Rails::Generators::Base
class_option 'no-build', type: :boolean

def insure_yarn_loaded
raise Thor::Error.new("please insure the yarn command is available") if `command -v yarn`.blank?
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
raise Thor::Error.new("please insure the yarn command is available if using webpacker")
end
end

def add_to_manifests
Expand Down
7 changes: 6 additions & 1 deletion lib/generators/hyperloop/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ class InstallGenerator < Rails::Generators::Base

def insure_yarn_loaded
return if skip_webpack?
raise Thor::Error.new("please insure the yarn command is available if using webpacker") if `command -v yarn`.blank?
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
raise Thor::Error.new("please insure the yarn command is available if using webpacker")
end
end

def inject_react_file_js
Expand Down
7 changes: 6 additions & 1 deletion lib/generators/hyperloop/install_mui_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ class InstallMuiGenerator < Rails::Generators::Base
class_option 'no-build', type: :boolean

def insure_yarn_loaded
raise Thor::Error.new("please insure the yarn command is available") if `command -v yarn`.blank?
begin
yarn_version = `yarn --version`
raise Errno::ENOENT if yarn_version.blank?
rescue Errno::ENOENT
raise Thor::Error.new("please insure the yarn command is available if using webpacker")
end
end

def add_to_manifests
Expand Down

0 comments on commit f56d1ac

Please sign in to comment.