Skip to content

Add support for windows. #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source "https://rubygems.org"
ruby "2.3.0"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is required for the heroku deployment, AFIK

#
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
Expand Down Expand Up @@ -44,7 +43,7 @@ gem "rails-html-sanitizer"
gem "react_on_rails", "~> 5.1.1"

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem "therubyracer"
gem "therubyracer", platform: :ruby

gem "autoprefixer-rails"

Expand All @@ -67,7 +66,7 @@ group :development, :test do

################################################################################
# Manage application processes
gem "foreman"
gem "foreman", platform: :ruby
gem "factory_girl_rails"

################################################################################
Expand Down Expand Up @@ -97,7 +96,7 @@ group :test do
gem "coveralls", require: false
gem "capybara"
gem "capybara-screenshot"
gem "capybara-webkit"
gem "capybara-webkit", platform: :ruby
gem "chromedriver-helper", require: ["selenium_chrome"].include?(ENV["DRIVER"])
gem "database_cleaner"
gem "generator_spec"
Expand All @@ -107,3 +106,7 @@ group :test do
gem "rspec-retry"
gem "selenium-webdriver", require: !["poltergeist", "poltergeist_errors_ok", "webkit"].include?(ENV["DRIVER"])
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'wdm', '>= 0.1.0' if Gem.win_platform? # for listen
23 changes: 17 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GEM
bundler-audit (0.5.0)
bundler (~> 1.2)
thor (~> 0.18)
byebug (8.2.3)
byebug (8.2.4)
capybara (2.7.0)
addressable
mime-types (>= 1.16)
Expand All @@ -73,7 +73,7 @@ GEM
capybara-screenshot (1.0.12)
capybara (>= 1.0, < 3)
launchy
capybara-webkit (1.10.0)
capybara-webkit (1.10.1)
capybara (>= 2.3.0, < 2.8.0)
json
childprocess (0.5.9)
Expand Down Expand Up @@ -104,12 +104,13 @@ GEM
docile (1.1.5)
erubis (2.7.0)
execjs (2.6.0)
factory_girl (4.5.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.6.0)
factory_girl (~> 4.5.0)
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
ffi (1.9.10)
ffi (1.9.10-x86-mingw32)
foreman (0.78.0)
thor (~> 0.19.1)
generator_spec (0.9.3)
Expand Down Expand Up @@ -147,9 +148,12 @@ GEM
nio4r (1.2.1)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7.2-x86-mingw32)
mini_portile2 (~> 2.0.0.rc2)
parser (2.3.0.7)
ast (~> 2.2)
pg (0.18.4)
pg (0.18.4-x86-mingw32)
poltergeist (1.9.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
Expand Down Expand Up @@ -287,7 +291,7 @@ GEM
temple (~> 0.7.3)
tilt (>= 1.3.3, < 2.1)
slop (3.6.0)
spring (1.6.4)
spring (1.7.0)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.6.0)
Expand All @@ -298,6 +302,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sqlite3 (1.3.11-x86-mingw32)
temple (0.7.6)
term-ansicolor (1.3.2)
tins (~> 1.0)
Expand All @@ -311,9 +316,12 @@ GEM
tins (1.6.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.3)
tzinfo (>= 1.0.0)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.0.3)
wdm (0.1.1)
web-console (3.1.1)
activemodel (>= 4.2)
debug_inspector
Expand All @@ -328,6 +336,7 @@ GEM

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
autoprefixer-rails
Expand Down Expand Up @@ -373,7 +382,9 @@ DEPENDENCIES
spring-commands-rspec
sqlite3
therubyracer
tzinfo-data
uglifier
wdm (>= 0.1.0)
web-console

BUNDLED WITH
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ See package.json and Gemfile for versions
1. Be sure that you have Node installed! We suggest [nvm](https://github.com/creationix/nvm), with node version `v5.0` or above. See this article [Updating and using nvm](http://forum.shakacode.com/t/updating-and-using-nvm/293).
1. `git clone git@github.com:shakacode/react-webpack-rails-tutorial.git`
1. `cd react-webpack-rails-tutorial`
1. Check that you have Ruby 2.3.0 or greater
1. Check that you have Ruby 2.2.4 or greater
1. Check that you're using the right version of node. Run `nvm list` to check. Use 5.5 or greater.
1. Check that you have Postgres installed. Run `which postgres` to check. Use 9.4 or greater.
1. Check that you have `qmake` installed. Run `which qmake` to check. If missing, follow these instructions: [Installing Qt and compiling capybara-webkit](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit)
Expand All @@ -86,6 +86,18 @@ See package.json and Gemfile for versions
1. Open a browser tab to http://localhost:3000 for the Rails app example.
2. When you make changes, you have to refresh the browser page.

# Notes running in Windows

Due to foreman not support windows, running below command in 4 different cmd prompt.

```bat
npm run hot-assets
npm run build:dev:client
npm run build:dev:server
set REACT_ON_RAILS_ENV=HOT
rails s -b 0.0.0.0
```

## Hot Reloading Example: applies to both `Procfile.hot` and `Procfile.express`
1. With the browser open to any JSX file, such as [client/app/bundles/comments/components/CommentBox/CommentBox.jsx](client/app/bundles/comments/components/CommentBox/CommentBox.jsx) and you can change the JSX code, hit save, and you will see the screen update without refreshing the window. This applies to port 3000 and port 4000.
1. Try changing a `.scss` file, such as a color in [client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.scss](client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.scss). You can see port 3000 or 4000 update automatically.
Expand Down
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
workers ENV.fetch("WEB_CONCURRENCY") { 2 } unless Gem.win_platform?

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand Down