From ed698ad94367a9223aeb8c538e63b1768e8c18bb Mon Sep 17 00:00:00 2001 From: Aaron Van Bokhoven Date: Mon, 15 Feb 2016 21:37:34 -1000 Subject: [PATCH] Update Base Generator Helpful Message - Add info for hot reloading server npm cmd. - Remove duplicate code from redux generator helpful msg because base now prints the same msg. - Update tests to reflect changes. --- .../react_on_rails/base_generator.rb | 6 +++++ .../react_with_redux_generator.rb | 11 -------- .../generators/install_generator_spec.rb | 27 ++++++++++++++++--- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index 1bb7078157..30d5568292 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -207,6 +207,12 @@ def print_helpful_message npm run rails-server - Visit http://localhost:3000/hello_world and see your React On Rails app running! + + - Run the npm express-server command to load the node server with hot reloading support. + + npm run express-server + + - Visit http://localhost:4000 and see your React On Rails app running using the Webpack Dev server. MSG GeneratorMessages.add_info(message) end diff --git a/lib/generators/react_on_rails/react_with_redux_generator.rb b/lib/generators/react_on_rails/react_with_redux_generator.rb index 32511bfa11..8843359909 100644 --- a/lib/generators/react_on_rails/react_with_redux_generator.rb +++ b/lib/generators/react_on_rails/react_with_redux_generator.rb @@ -45,17 +45,6 @@ def template_appropriate_version_of_hello_world_app_client location = "client/app/bundles/HelloWorld/startup" template("redux/base/#{location}/HelloWorldAppClient.jsx.tt", "#{location}/#{filename}") end - - def print_helpful_message - message = <<-MSG - - Run the npm express-server command to load the node server with hot reloading support. - - npm run express-server - - - Visit http://localhost:4000 and see your React On Rails app running using the Webpack Dev server. - MSG - GeneratorMessages.add_info(message) - end end end end diff --git a/spec/react_on_rails/generators/install_generator_spec.rb b/spec/react_on_rails/generators/install_generator_spec.rb index c92de51142..8c1874e58e 100644 --- a/spec/react_on_rails/generators/install_generator_spec.rb +++ b/spec/react_on_rails/generators/install_generator_spec.rb @@ -245,6 +245,12 @@ npm run rails-server - Visit http://localhost:3000/hello_world and see your React On Rails app running! + + - Run the npm express-server command to load the node server with hot reloading support. + + npm run express-server + + - Visit http://localhost:4000 and see your React On Rails app running using the Webpack Dev server. MSG expect(GeneratorMessages.output) .to include(GeneratorMessages.format_info(expected)) @@ -252,12 +258,25 @@ specify "react with redux generator contains a helpful message" do run_generator_test_with_args(%w(--redux)) - expected = <<-MSG - - Run the npm express-server command to load the node server with hot reloading support. + expected = <<-MSG.strip_heredoc + + What to do next: + + - Ensure your bundle and npm are up to date. + + bundle && npm i + + - Run the npm rails-server command to load the rails server. + + npm run rails-server + + - Visit http://localhost:3000/hello_world and see your React On Rails app running! + + - Run the npm express-server command to load the node server with hot reloading support. - npm run express-server + npm run express-server - - Visit http://localhost:4000 and see your React On Rails app running using the Webpack Dev server. + - Visit http://localhost:4000 and see your React On Rails app running using the Webpack Dev server. MSG expect(GeneratorMessages.output) .to include(GeneratorMessages.format_info(expected))