Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need a less repetitve way to start Rails on Mac for noob

I've been on a Mac just over a month and before that I've been using Windows and wrote a .bat file to run a few other little .bat files to fire up MongoDB, guard start for livereload, rails server, and a rails console. And it lastly launches e-texteditor which opens that rails dir as a project.

I hope this is the right place to ask and not superuser. So what is one way I can automate these things on Mac? -- Currently, I launch 1 terminal window with 4 tabs. tab 1 runs 'mongod', tab 2 runs 'rails s', tab 3 runs 'guard start', tab 4 runs 'rails c'. then I open one more tab and do 'mate .'

like image 892
Nik So Avatar asked Nov 28 '11 09:11

Nik So


People also ask

Is Ruby on Rails for beginners?

This guide is designed for beginners who want to get started with creating a Rails application from scratch. It does not assume that you have any prior experience with Rails. Rails is a web application framework running on the Ruby programming language.

Is Ruby on Rails still relevant 2022?

Ruby's and Ruby on Rails' Overall Popularity Although way behind main contenders, such as PHP or Python, Ruby still makes the cut for the 20 most popular programming languages list in 2022. The 2022 edition of Stack Overflow Annual Developer Survey also places RoR in a similar spot.

How long does it take to learn Ruby on Rails?

With our Learn Ruby and Learn Ruby on Rails courses, it will take about 10 hours to get through the material. However, once you're done, you'll want to spend time practicing on your own and building projects to really master the language.


1 Answers

Foreman is your best friend.

Step 1: Install foreman

gem i foreman

Step 2: Create a file named Procfile

rails: rails server
mongo: mongod
guard: guard start

Step 3: Run foreman start. It will automatically start all 3 servers. If you press Ctrl-C, all servers will be terminated.

Step 4: Run rails c in another terminal.

like image 194
miaout17 Avatar answered Nov 09 '22 13:11

miaout17