Skip to content

Commit

Permalink
Windows compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGorbanev committed Jan 6, 2017
1 parent 13cff3f commit 779fa51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to this project's source code will be documented in this fil
Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version.

## [Unreleased]
*Please add entries here for your pull requests.*
##### Fixed
- Added checking of OS and fixed generator for Windows.

## [6.3.4] - 2016-12-25
##### Fixed
Expand Down
6 changes: 4 additions & 2 deletions lib/generators/react_on_rails/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ def installation_prerequisites_met?
end

def missing_npm?
return false unless `which npm`.blank?
return false unless
running_on_windows? ? `where npm`.blank? : `which npm`.blank?
error = "npm is required. Please install it before continuing. "
error << "https://www.npmjs.com/"
GeneratorMessages.add_error(error)
true
end

def missing_node?
return false unless `which node`.blank?
return false unless
running_on_windows? ? `where node`.blank? : `which node`.blank?
error = "** nodejs is required. Please install it before continuing. "
error << "https://nodejs.org/en/"
GeneratorMessages.add_error(error)
Expand Down
4 changes: 4 additions & 0 deletions lib/react_on_rails/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def self.default_server_bundle_js_file_path
ReactOnRails.configuration.server_bundle_js_file)
end

def self.running_on_windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end

module Required
def required(arg_name)
raise ArgumentError, "#{arg_name} is required"
Expand Down

0 comments on commit 779fa51

Please sign in to comment.