2018年11月17日土曜日

My first PR was merged into dev.to!

My first PR to an open source project was successfully merged. The repo it got merged into was dev.to!

Add GitLab URL field to user profile by sidemt · Pull Request #1121 · thepracticaldev/dev.to

Feature I added

I added a new field to put a link to GitLab profile on DEV profile.

@ben gave me a comment on GitHub so I wrote the changelog post for it too.

Changelog: Add GitLab link to your profile - DEV Community

My thoughts

As many of you may know dev.to uses Ruby on Rails. I have learned the basics of Rails and have made a few web apps as personal projects but had never worked on such a large project.
But there already were similar URL fields and one of them was added recently so I could easily find out what I needed to change by looking into the PRs and codes of the other fields.

The most difficult part for me was setting up the environment locally.

Ruby on Rails on Windows

I'm a Windows user.

As far as I know, I can't install rbenv on Windows. So I used WSL(Windows Subsystem for Linux).

  • The environment of Ruby (on Rails) is installed on WSL(Ubuntu)
  • PostgreSQL is installed on Windows
  • The code cloned from the dev.to repo is stored on Windows

There is a detailed guide in dev.to's documentation. It helped me a lot.

Where I got stuck

I'm thinking of writing detailed posts on how I resolved these troubles later.

  • Initial installation before I can launch dev.to locally
  • Couldn't sign-in on the local environment (Thanks @andy for the help on this!)
  • Sign-in started working, but instead, Rubocop had an error of Ruby version mismatch which prevented me from making a new commit (it's in the pre-commit hook)
  • It seemed something was wrong with the Ruby versions managed by rbenv but I couldn't resolve it. After investigating for a whole day I decided to reset the WSL and installed everything again (I could do this because dev.to was the only project I'm using WSL)

After going through these challenges, I finally submitted the PR.

What I learned

The code I added was 30 lines or so. 90% of my work was setting up the environment.

But as a code newbie who has no work experience as a developer, I learned a lot from this installation process.

When you create something by yourself you would use something you know or have heard of. Going through all the errors, I had many chances to deal with things I had no idea what they were.

Many "things I don't even know they exist" became "things I have heard of their name" and "things I kind of know what they do". I can now guess "I might be able to do this using this..." and search for it more easily.

If you are a beginner in programming, I recommend you trying to set up a development environment of a large open source project. Even if you can't eventually submit a PR, you can get an idea of what a real-world project looks like, you can practice reading the error message and searching for solutions, you can see the names of a huge number of modules which might help you in the (near) future.

Actually, I was considering to submit my first PR to freeCodeCamp at first (But I couldn't find "first timers welcome" issues available. I was lucky to find an entry-level issue here!) so I recently installed its environment too. These experience made me think that setting up a local environment of open source projects may be a good practice for beginners.

GitLab users!

I use GitLab for my private repositories. It's free!

If you are a GitLab user please try adding the link to GitLab on your DEV profile!

0 件のコメント:

コメントを投稿