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

After generator runs, print a helpful message #184

Closed
justin808 opened this issue Jan 6, 2016 · 12 comments
Closed

After generator runs, print a helpful message #184

justin808 opened this issue Jan 6, 2016 · 12 comments
Assignees

Comments

@justin808
Copy link
Member

This what I see after running the generator on the v2 branch (CC: @aaronvb)

➜  ~/scratch/test-react-on-rails-2 (master) bundle exec rails generate react_on_rails:install -R -S -H -L                                                                                                                                                          [15:05:37]
Running via Spring preloader in process 65235
       route  get 'hello_world', to: 'hello_world#index'
      create  client/assets
      create  client/assets/stylesheets
      create  client/assets/fonts
      create  client/assets/fonts/.keep
      create  client/assets/images
      create  client/assets/images/.keep
      append  .gitignore
     prepend  app/assets/javascripts/application.js
        gsub  app/assets/javascripts/application.js
        gsub  app/assets/javascripts/application.js
        gsub  app/assets/javascripts/application.js
        gsub  app/assets/javascripts/application.js
      create  client/app/bundles/HelloWorld/components
      create  client/app/bundles/HelloWorld/containers
      create  client/app/bundles/HelloWorld/startup
      create  app/controllers/hello_world_controller.rb
      create  config/initializers/react_on_rails.rb
      create  client/.babelrc
      create  client/index.jade
      create  client/server.js
      create  client/webpack.client.base.config.js
      create  client/webpack.client.rails.config.js
      create  REACT_ON_RAILS.md
      create  client/REACT_ON_RAILS_CLIENT_README.md
      create  package.json
      create  Procfile.dev
      create  Procfile.dev-hot
      create  app/views/hello_world/index.html.erb
      create  client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx
      create  client/webpack.client.hot.config.js
      create  client/package.json
      append  Gemfile
      create  client/app/bundles/HelloWorld/startup/clientRegistration.jsx
      create  client/webpack.server.rails.config.js
      create  client/app/bundles/HelloWorld/startup/serverRegistration.jsx
      create  lib/tasks/linters.rake
      create  lib/tasks/assets.rake
      append  config/initializers/assets.rb
      create  client/app/bundles/HelloWorld/actions
      create  client/app/bundles/HelloWorld/constants
      create  client/app/bundles/HelloWorld/reducers
      create  client/app/bundles/HelloWorld/store
      create  client/app/lib/middlewares
      create  client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
      create  client/app/bundles/HelloWorld/containers/HelloWorld.jsx
      create  client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx
      create  client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx
      create  client/app/bundles/HelloWorld/reducers/index.jsx
      create  client/app/bundles/HelloWorld/store/helloWorldStore.jsx
      create  client/app/lib/middlewares/loggerMiddleware.js
      create  client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx
      create  client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx
      create  client/.eslintrc
      create  client/.eslintignore
      create  client/.jscsrc
      append  Gemfile
      create  lib/tasks/brakeman.rake
      create  lib/tasks/ci.rake
      create  .rubocop.yml
      create  .scss-lint.yml
      create  ruby-lint.yml
      create  .buildpacks
      create  Procfile
      create  config/puma.rb
      append  Gemfile
      create  app/assets/stylesheets/_bootstrap-custom.scss
      create  client/assets/stylesheets/_post-bootstrap.scss
      create  client/assets/stylesheets/_pre-bootstrap.scss
      create  client/assets/stylesheets/_react-on-rails-sass-helper.scss
      create  client/bootstrap-sass.config.js
      append  app/assets/stylesheets/application.scss
        gsub  app/assets/stylesheets/application.scss
        gsub  app/assets/stylesheets/application.scss
      append  Gemfile
      append  app/assets/javascripts/application.js
@robwise
Copy link
Contributor

robwise commented Jan 8, 2016

I think whoever attempts this can leverage the work @aaronvb has done in this PR: #158 (comment)

Perhaps we just rename errors to messages

@aaronvb
Copy link
Member

aaronvb commented Jan 8, 2016

If the message is predefined we can create a file with the helpful message and output it with readme 'filename'.

http://guides.rubyonrails.org/generators.html#readme

That leads me to: what will the helpful message be?


Aaron Van Bokhoven
bokhoven@gmail.com
http://aaronvb.com

On Jan 7, 2016, at 5:05 PM, Rob Wise notifications@github.com wrote:

I think whoever attempts this can leverage the work @aaronvb has done in this PR: #158 (comment)

Perhaps we just rename errors to messages


Reply to this email directly or view it on GitHub.

@justin808
Copy link
Member Author

@aaronvb, can you try v2 (preferably the branch, or maybe rc1)?

after the generator runs, we need to:

  1. run cd client && npm i && npm shrinkwrap (bundle?)
  2. experiment with the start up scripts: cd <top level> && npm run will show the scripts
  3. Show the two URLs to visit: localhost:3000 and localhost:4000

There's probably more...

@aaronvb
Copy link
Member

aaronvb commented Jan 8, 2016

@justin808 @robwise if we go with a dynamic helpful message at the end, I think the best approach is another singleton like the errors, that we can populate based on what options were set.

If you think the message will be static and same for all generator options, a simple text file printed at the end could suffice.

@robwise
Copy link
Contributor

robwise commented Jan 11, 2016

@aaronvb sounds good to me

@aaronvb aaronvb self-assigned this Jan 11, 2016
@aaronvb
Copy link
Member

aaronvb commented Jan 11, 2016

@robwise @justin808 I'll work on this using @robwise suggestion to use another singleton like GeneratorErrors to create a helpful message at the end. That way we can tailor the helpful message based on the generator options selected.

@justin808
Copy link
Member Author

v2 is out. We need to do this. @aaronvb if you check out the tutorial in the /docs, you can see what we should print.

@aaronvb
Copy link
Member

aaronvb commented Jan 14, 2016

@justin808 @robwise Here are the two examples explained in my previous comment.

Using GeneratorMessages

This method uses GeneratorMessages.add_info to add helpful messages on specific generators.

Base Install

rails generate react_on_rails:install

screen shot 2016-01-14 at 1 35 21 pm

Base Install with Redux

rails generate react_on_rails:install -R

screen shot 2016-01-14 at 1 37 04 pm

Using a README file

http://guides.rubyonrails.org/generators.html#readme

This method is not dynamic as it uses a static README file to print the message at the end.

screen shot 2016-01-14 at 1 46 05 pm

Styling for the messages taken from https://github.com/plataformatec/devise/blob/master/lib/generators/templates/README

@justin808
Copy link
Member Author

@aaronvb Have you got this one. These suggestions look awesome.

@robwise
Copy link
Contributor

robwise commented Jan 15, 2016

Dynamic is definitely cooler! Good job Aaron!

@aaronvb
Copy link
Member

aaronvb commented Jan 15, 2016

Thanks for the feedback! I'll do a PR for the dynamic version Today.


Aaron Van Bokhoven
bokhoven@gmail.com
http://aaronvb.com

On Jan 14, 2016, at 11:45 PM, Rob Wise notifications@github.com wrote:

Dynamic is definitely cooler! Good job Aaron!


Reply to this email directly or view it on GitHub.

@aaronvb
Copy link
Member

aaronvb commented Jan 19, 2016

Closing this 👍

@aaronvb aaronvb closed this as completed Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants