Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

The Secret to Side-by-Side Gem Development in Rails

DEV Community·Zil Norvilis·about 1 month ago
#fEeBzfwu
Reading 0:00
15s threshold

Stop Pushing to GitHub: How to Test Ruby Gems Locally Very often I find myself writing a piece of code in a Rails app and thinking: "I use this in all my projects. I should extract this into a Ruby Gem." Building a gem is a great way to clean up your codebase and contribute to open-source. But the first time you try to build one, the testing process feels awful. Most beginners write some code in their gem, push it to GitHub, go to their Rails app, run bundle update my_gem , restart the server, and see if it worked. If there is a typo, they have to do the whole 5-minute loop all over again. You do not need to do this. You can develop your gem and your Rails app side-by-side on your local machine, and see your changes instantly. Here is exactly how to set it up. STEP 1: The Folder Structure To keep things organized, both your gem and your Rails app should live in the same parent directory on your computer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More