Project

learn-tool

0.0
No commit activity in last 3 years
No release in over 3 years
learn-tool is a tool for creating, duplicating and repairing learn.co lessons on GitHub
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.15
 Project Readme

Learn Tool

This gem is designed to aid in the creation, duplication and repair of Learn lessons.

Installation and Setup

Before using learn-tool, you must install hub, GitHub's extended CLI API.

brew install hub

Once hub is installed, you'll need to get it configured before running learn-tool. The best way to do this is to use hub once to create a repository on learn-co-curriculum. In the shell:

  • Navigate to an existing local git repo
    • Run hub browse
    • You should be prompted to sign in to GitHub
    • Note: If you have set up two-factor identification on GitHub, when prompted for your password, you have two options:
      • If Github SMS' you a one-time password, use it!
      • Otherwise, instead of using your normal password, you need to enter a Personal Access Token. You can create a token in your GitHub settings page.
  • If everything works as expected you should see the remote GitHub repo open in browser

Install the learn-tool gem:

gem install learn-tool

Lesson Creation

To create a new repository, navigate to the folder where you'd like your repo to be duplicated locally and type:

learn-tool --create

Follow the prompts to create a blank readme, code-along or lab repository. The repo will be created locally and pushed to GitHub. When finished, you can cd into the local folder or open it on github to start working. This command draws from a number of existing templates.

For other lesson types, start with a Readme.

Lesson Duplication

To duplicate an existing repository, type:

learn-tool --duplicate

This command will make an exact copy of another repository. For example, you could use this if you want to create a new Active Record lab and want to borrow the configuration of an existing lab.

Note: if you have an idea on how improvement to an existing lesson, please consider creating a fork and submit a pull request on the original lesson rather than creating an altered duplicate.

Lesson Linting and Repair

If you already have a repository or created one manually, it is important that certain files are present:

  • .learn - this file is required. In addition, this file must contain a languages attribute. Not including this file or the required attributet will cause deploy issues.
  • LICENSE.md - All educational materials used through the Learn platform should include this file.
  • CONTRIBUTING.md - This file contains information on how to contribute to our content.

To check if these files are present and correct, from the lesson directory type:

learn-tool --lint

Alternatively, you can provide an absolute path to the directory you would like to lint:

learn-tool --lint /Users/johnboy/lessons/jukebox-cli

To quickly add or fix these files, type:

learn-tool --repair

This command will replace or add the required files to the current repository. You can pass an absolute path of another directory you would like to repair:

learn-tool --repair /Users/johnboy/lessons/jukebox-cli

Warning: Repairing will overwrite any existing support files.

Resources