Skip to content

vimcolorschemes/worker

Repository files navigation

vimcolorschemes worker

I search for vim color schemes, and store them. That's about it.

Getting started

The worker is a CLI used to import and manage the data for vimcolorschemes.

Requirements:

Note: The MongoDB database can also be ran from the app docker setup.

Set up the environment variables

Update the values in .env to your needs.

TIP: Read the comments on the dotenv file.

The .env is automatically picked up by CLI when it runs.

GitHub queries

Since GitHub's API has a quite short rate limit for unauthenticated calls (60 for core API calls). I highly recommend setting up authentication (5000 calls for core API calls) to avoid wait times when you reach the limit.

To do that, you first need to create your personal access token with permissions to read public repositories. Follow instructions on how to do that here.

Run a job

To run a job, use the bin/start script:

bin/start <job>

Read about on the jobs

import

Import repositories into the database

bin/start import

Import only a specific repository using the --repo option.

bin/start import --repo morhetz/gruvbox

update

Fetch the necessary data for the repositories

bin/start update

Force a full update of all the repositories by using the --force option.

bin/start update --force

Update only a specific repository using the --repo option.

bin/start update --repo morhetz/gruvbox

generate

Generate color data for the vim color scheme previews

bin/start generate

Force a full generation of all the repositories by using the --force option.

bin/start generate --force

Generate preview data for only a specific repository using the --repo option.

bin/start generate --repo morhetz/gruvbox

Run tests

bin/test

go test flags can be used:

bin/test --cover

Lint

golint is configured to run using bin/lint.

Format code

go fmt can be easily used on all code using bin/format.