DEV Community

Cover image for Rails 6: the missing developer setup guide

Rails 6: the missing developer setup guide

Vincent Voyer on November 19, 2019

👋 Welcome! This post contains everything I learned and did that was not documented as part of my Ruby and Ruby on Rails 6 learning. I am new to the...
Collapse
 
ivanshamatov profile image
Ivan Shamatov • Edited

Nice article, thanks. In my notes I also have:

  • circleci/travisci/gitlabci files,
  • docker&compose,
  • github/lab templates for PRs, issues,
  • rubocop, simplecov and
  • a list of prefered gems for
    • decorators,
    • serializers,
    • operations,
    • dry-package
Collapse
 
ivanshamatov profile image
Ivan Shamatov

lefthook or any other precommit config would be nice to have

Collapse
 
hachi8833 profile image
hachi8833

I'd like to translate the article dev.to/vvo/a-rails-6-setup-guide-f... into Japanese and publish on our tech blog techracho.bpsinc.jp/ for sharing it. Is it OK for you?

I make sure to indicate the link to original, title, author name in the case.

Best regards,

Collapse
 
vvo profile image
Vincent Voyer

Yes, no problem

Collapse
 
hachi8833 profile image
hachi8833

Published the JP translation techracho.bpsinc.jp/hachi8833/2019...
Thank you very much for your kindness! 😂

Thread Thread
 
vvo profile image
Vincent Voyer

Awesome! 🙏

Collapse
 
pandelis profile image
Pandelis

My solution for notifications in my scripts is to use the bell sound and apple script.

# Notify that user input is needed
   tput bel
   osascript -e 'display notification "Please fill in your CA information" with title "Infrastructure Setup"'
Collapse
 
wdiechmann profile image
Walther Diechmann

Ohh do we need this kind of best practices build-ups! Thx for sharing!

You might consider overmind as a sort of "icing on the cake" though ;)

Read about it here: evilmartians.com/chronicles/introd...

Collapse
 
vvo profile image
Vincent Voyer

Indeed I saw overmind but since I yet did not know why I would need it vs the simpler version of hivemind then I went for the simpler version. Maybe later of if you already have killer features we would need maybe? Thanks!

Collapse
 
rpruizc profile image
Rodolfo Ruiz

Nice article. The renovate tip along with hivemind and the pointer to learn more about what webpack can do with rails are huge.
A very small typo in the "Reproducible environments: Node.js and Yarn" section. Step 1 says "12.13.1" while 3 is "12.13.0" I know it doesn't break anything but just to avoid minor confusions to the reader.

Collapse
 
vvo profile image
Vincent Voyer

Thanks a lot, updated!

Collapse
 
ryanwjackson profile image
Ryan

I found in order to get jQuery $ to be defined properly, I had to follow step (3) here: botreetechnologies.com/blog/introd...

Otherwise, everything here worked.

Collapse
 
vvo profile image
Vincent Voyer

I found in order to get jQuery $ to be defined properly
Do you mean for window.$ to be available globally? If so yes that's the way to do it as seen here: webpack.js.org/plugins/provide-plu...

But I prefer to require it whenever I need it rather than relying on a global variable. Still, thanks for heads up!

Collapse
 
mpressen profile image
Maximilien Pressensé

Hey, super interesting stuff.
Thanks a lot, especially for the webpack and overmind part.

I had an extra issue with webpack handling stylesheets :
delivering images from the asset pipeline in [s]css needs a tiny bit of extra configuration : stackoverflow.com/a/57175231/8131629

Cheers from Vigneux de Bretagne :)

Collapse
 
vvo profile image
Vincent Voyer

Nice, I yet have to use that but once I do Ill make sure to edit this post or create a new one focused on webpacker + Rails.

Thanks for reading and adding your comment! Cheers from Rezé, France :D

Collapse
 
vvo profile image
Vincent Voyer

Updated on Nov 26, 2019:

  • switch from Growl to terminal-notifier
  • switch from hivemind to overmind (to allow debugging rails server)
  • add notes about dependencies pinning and link to article thoughtbot.com/blog/a-healthy-bundle
  • add note about rubocop and rufo
Collapse
 
robcarruthers profile image
robcarruthers

Great work Vincent, really helpful.

Thanks for your encouragement towards the Webpacker docs too... I'm pleasantly surprised.

Collapse
 
ben profile image
Ben Halpern

Fabulous guide

Collapse
 
vvo profile image
Vincent Voyer • Edited

Thanks! I made some minor edits right now.

First experience contributing to dev.to. It was 11am today and I thought "I really really need to publish/write about Rails setup I have". Two seconds later I was on dev.to, congrats :)

Collapse
 
mipmip profile image
Pim Snel

Shouldn't the overmind command be: overmind start -D?

Collapse
 
vvo profile image
Vincent Voyer

Indeed I fixed it now in the article, but I do not use -D myself, I like to have the process attached to my session but usage depends I guess. What's you preference and why? Thanks!

Collapse
 
schneems profile image
Schneems

Hi! Heroku Ruby buildpack maintainer, you shouldn’t need the extra nodejs buildpack, the Ruby buildpack installs yarn and node for you, then you don’t also need the extra code clearing the rake tasks.

Collapse
 
vvo profile image
Vincent Voyer • Edited

Hi there! Thanks for jumping in, I tested again and here's the result:

  • used official rails 6 getting started here: devcenter.heroku.com/articles/gett... (if you follow it, you'll also see there are some minors issues like: rails new already creates a GIT repo, ruby version is already specified)
  • when building, the output from Heroku website is not the one I am getting: screenshot

As you can see, there are two yarn installs being done somehow vs one in your tutorial. But again, I just used the exact same commands (Rails 6.0.1). It seems others are also wondering what's happening: github.com/harvard-lil/h2o/issues/744 and github.com/rails/webpacker/issues/405

I bet this is not an issue of the Ruby buildpack but more an issue of Rails. There's also maybe no issue but if so then I would love for you to explain to me what's going on maybe.

From my point of view it's easier for Rails to leave the whole "package.json dependencies installation" to the users rather than trying to be smart about it.

Collapse
 
mipmip profile image
Pim Snel

Nice article. I think: app/views/layout/application.erb.html should be app/views/layout/application.html.erb

Collapse
 
vvo profile image
Vincent Voyer

Thanks, just updated a bunch of places in the article that contained this typo.

Collapse
 
superails profile image
Yaroslav Shmarov
Collapse
 
functionalstoic profile image
JasonSooter

Nice work! Created just enough curiosity to actually try out rails!