Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

How To Setup Exercism CLI To Use Your Own Github Repository

5/1/2020

0 Comments

 
This guide demonstrates one way to setup your locally computer for solving exercises on Exercism.io. When working on your solutions to exercism, why not version you code and save it to git just as you would any "real" project you plan to deploy? With Github, you can make a public repo for free that can contain all of your solutions, plus you'll be associating this nice code with your Github profile and be getting those green squares on Github! Excercism projects make excellent code to have on your Github account because every exercise itself is it's own little self-contained, fully unit tested and peer-reviewed bit of clean code that does something correctly! You can take a look at my Exercism-Solutions repo to see how awesome it is to have all of your Exercism solutions there in a Github repo. ?

Looking For A Coding Job? Then You Should Absolutely Follow This Guide!

Did you read the last sentence of the previous paragraph?? Every Exercism problem you attempt scaffolds out a nice little project with unit tests, and you get a real-life coach to give you ideas on how to improve your code which you may not have though of on your own. It is really a great way to improve coding skills quickly.
The best part is that Github is free, Exercism is free, the mentoring is free, the pre-written units tests are are free- it’s all free! All you have to do is put the time into writing the code for the solutions, making the unit tests pass, and then after a while you’ll have something that could impress even the best coders.
If you get stuck, don’t be ashamed to just google, “<problem name> solution <language> track”. Most likely the first hit will be Exercism’s public list of previous students’ solutions (who have chosen to make their accepted solution public, that is). Don’t just copy and paste someone else’s solution though! Instead, go through many of them and try to understand how each person chose to solve it and structure their code. Think about what pieces you like best from each solution and then write your own version. Then check it against the unit tests to make sure it works!
Anyone with a computer and a desire to program should be able to take at least a few a minutes each day to write something into the code editor and save it to git. It’s ok to commit your work to git even if it’s not finished. When doing this put “wip” (short for work in progress) or something similar in the git commit message, and in general try to write present tense commit messages that follow the naming conventions agreed upon for each project.

Install Exercism CLI

Installing the Exercism command line tool shouldn't be too painful regardless of the operating system. It's probably best to refer to the official exercism install guide, but just to summarize it here:

​- for macOs users:
brew install exercism
- for windows users:
Install and run the latest release application file.
- for linux users:
sudo snap install exercism

Configure Exercism CLI With Your Token

If you run exercism configure with no parameters it should should show an error like this and say you haven't yet entered you account token.
exercism configure
​Error: There is no token configured. Find your token on https://exercism.io/my/settings, and call this command again with --token=<your-token>.
This nice little error message is telling us that we need to go to https://exercism.io/my/settings, get the token for our account there, and run the configure command again passing that token as the value for the --token flag.
configure --token=11da1e11-1c1f-11b2-b111-c1e1ea11111b
This is annoying to have to do, but configuring this token is needed so that when Exercism receives your submissions it knows that they are from you and not a hacker pretending to be you!

Create A Repo On Github

Login to Github and look for the plus button in the upper right hand corner next you your profile icon. Click the button and choose "New repository".

You don't need to choose any template. Just enter a name for your repository (it can be anything, but I like to call it "Exercism-Solutions"). Leave it public, initialize it with a README, and add a license (any will do- I like to use GPL-3.0).

Then click the big green "Create repository" button.

This should send you to the Github page for this newly created repo. You can click the big green "Clone or download" button here to reveal the url for this repo. Copy the url to your clipboard and use it to clone the repo in your local shell terminal. Be sure to clone the repo in your ​home folder in order to properly sync with Exercism cli's "Exercism" folder! 
cd ~
git clone <github-repo-url>

Use The Git Repo As Your Exercism Folder

Since the connection to git is controlled by the .git folder within a project, you can safely rename the overall directory without messing up anything related to git. If the exercism cli tool created a folder named "Exercism", feel free to delete it.
rm Exercism
Then rename the folder of the Github repo you just cloned to "Exercism" (since the exercism looks for a directory in your user home specifically called Exercism as the place to download exercsies).
mv Exercism-Solutions Exercism

Give It A Try!

Renaming your git repo to "Exercism" and putting in in your current user's home folder is really all there is too it. After that, you should be able to both download Exercism problems and commit them to git. Let's test it out by trying the first problem of the javascript track (Note: you may need to "start" the javascript track in the exercism.io website before you are able to download the problem).
exercism download --exercise=hello-world --track=javascript
Congrats, you've scaffolded out your first exercism.io project. Feels great, doesn't it? :) 
​
Now, let's check that we have git configured properly.
git add .
git commit -m "download javascript hello world"
git push origin master
If this works then you're good to go!

Where To Go From Here

Now that you’re all set up with the exercism cli about to download the exercises right into your Github repo, it’s time to tackle some exercises! Each track should have a small guide for both “How to Install X” and “Running the tests”. I personally like that each track has you set up the idiomatic cli build too land package manager for working in that language, although it can be a small barrier to actually getting started coding.
Once you’re all set up command-line wise you’ll need some text editor in which to work. You could always go old-school and use some thing like vim, but I prefer to have a more mouse-friendly, easier on the eyes IDE. My personal favorite is Visual Studio Code because it is free, lightweight, and supports every language on Exercism via community-developed extensions.
Don’t forget to create a .gitignore file in the root of your project for ignoring dependency folders such as node_modules. Since these can easily be reinstalled from the package.json it’s recommended to not check them into git in order to keep the amount of storage needed down to a minimum.

If you're feeling really stuck on some problem, you can submit your unfinished solution and ask the mentor for help. You could report potential bugs on the language track on Github, and as always feel free to check out my youtube channel and reach out to me directly at @JimLynchCodes! Happy coding!  ?
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Picture
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blockchain
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Investing
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    March 2023
    August 2021
    February 2021
    January 2021
    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2023