Since your very first lab at Learn, you've likely become fast friends with the learn
command. There's much more to this term than meets the eye!
The learn
command originates from the learn-co gem, which drives the command line interface for Learn.co. Found within the heart of the Learn IDE or installed with gem install learn-co
, there are quite a few handy commands which you may find helpful in your time at Flatiron School.
To run these commands, navigate to the top level directory of any Learn.co lesson and run:
$ learn [command] [options]
A summary of commands and their options is below:
version, -v, --version
- Display the current version of the Learn gem
submit [ -m |--message "message" ] [ -t |--team @username1 @username2 ]
- Submit your completed lesson
- Add your changes, commit them, push to GitHub, and issue a pull request
- The -m|--message
option allows you to specify a commit message in a string format
- If you provide the -t|--team
option in a string format and specify team members (people you collaborated with on the lab) by their usernames, you and they will get credit for completing a lesson
open [ lesson-name ] [ --editor "editor name" ]
- Open your current lesson locally
- If given no lesson name, it will open your current lesson.
- You can specify a different lesson to open if you provide an argument (i.e. the lesson repository name on GitHub)
- You can specify a specific text editor (Atom, Sublime, etc.) after the --editor
option flag
next [ --editor "editor name" ]
- Open your next lesson, optionally specifying an editor (Atom, Sublime, etc.)
whoami
- Display your Learn gem configuration information.
Note: If you are having issues connecting to Learn, this is the first command you should try to make sure it displays accurate information. See below for an example.
reset
- Reset your Learn gem configuration, which includes your current Learn account username and email.
- This command clears the OAuth token copied from your Learn profile and you'll be prompted to re-enter it. You can expect to see something like the prompts below:
- If you run learn whoami
after completing the above, you'll see your updated Learn gem configuration!
status
- Get the status of your current lesson
hello
- Verify your connection to Learn.co
- It should return Hello, < your first name >
save
- Save your work and push it to GitHub
Testing with the Learn Gem
Testing commands and options run in a slightly different format. Since the learn
command runs tests for you, it is included as one of the "tests." For example, if a Javascript Learn lesson utilizes Jasmine tests and you want to run it in the browser, you would run learn -b
.
[ test ] [ options ]
- Run a lesson test suite with options
- "test" can be learn
, rspec
(used for testing Ruby), jasmine
(used for testing JavaScript), or other test as specified by your lesson
- Rspec tests have the following options:
- --f-f, --fail-fast
# Stop running rspec test suite on first failed test
- Jasmine tests have the following options:
- --no-color
# Turn off color output
- -l, --local
# Don't push results to Learn
- -b, --browser
# Run tests in browser
- -o, --out FILE
# Specify an output file
- -s, --skip
# Don't run dependency checks