Skip to content
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

Helpful Message After Generator Install #210

Merged
merged 1 commit into from
Jan 19, 2016
Merged
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
2 changes: 1 addition & 1 deletion docs/tutorial-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ npm run rails-server
Visit http://localhost:3000/hello_world and see your React On Rails app running!

```
npm run node-server-hot
npm run express-server
```

<img src="http://forum.shakacode.com/uploads/default/original/1X/5bd396a7f9c0764929b693fb79eb6685ec6f62cf.png" width="470" height="499">
Expand Down
18 changes: 18 additions & 0 deletions lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ def force_application_scss_naming_if_necessary
new_name = File.join(destination_root, "#{base_path}application.scss")
File.rename(bad_name, new_name)
end

def print_helpful_message
message = <<-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!
MSG
GeneratorMessages.add_info(message)
end
end
end
end
11 changes: 11 additions & 0 deletions lib/generators/react_on_rails/react_with_redux_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"postinstall": "cd client && npm install",
"test": "rspec && (cd client && npm run lint)",
"node-server-hot": "echo 'visit http://localhost:4000' && cd client && npm start",
"express-server": "echo 'visit http://localhost:4000' && cd client && npm start",
Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the npm run command node-server-hot to express-server.

"rails-server": "echo 'visit http://localhost:3000/hello_world' && foreman start -f Procfile.dev"
},
"repository": {
Expand Down
35 changes: 35 additions & 0 deletions spec/react_on_rails/generators/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,39 @@
.to include(GeneratorMessages.format_error(expected))
end
end

context "with helpful message" do
specify "base generator contains a helpful message" do
run_generator_test_with_args(%w())
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!
MSG
expect(GeneratorMessages.output)
.to include(GeneratorMessages.format_info(expected))
end

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.

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))
end
end
end