Cookiecutter template for SuperCollider quarks
a simple cookiecutter template that will help you automatically create a basic SuperCollider package (quark).
The point of this is to be able to very easily generate a new quark from the command line like so:
cookiecutter path/to/this/cookiecutter-template. Cookiecutter will then ask you some questions and from your answers generate a quark file, a class and a help file containing that information.
This template will create a file/folder structure like so. The contents of the files are the bare minimum dependent on your answers to cookiecutter's questions:
README.md QuarkName.quark - Classes QuarkName.sc - Tests QuarkNameTest.sc - HelpSource - Classes QuarkName.schelp
- install cookiecutter if you haven't already.
- download this repo and save it somewhere you can easily find it again, for example in your user folder:
git clone https://github.com/madskjeldgaard/cookiecutter-quark. This will download this repo and put it in
- That's it
Open up a terminal and move to one of your SuperCollider class extensions folders. If you don't know where these are, you can easily find them by opening up SuperCollider and evaluating the code
Platform.userExtensionsDir. This will output a path to your class extensions folder in the post window of supercollider. In my case it's
Then, still in your terminal, move to the abovementioned path like so:
And start cookiecutter by typing:
After answering a few questions, cookiecutter will have created a new folder in your user extensions dir with the necessary files. By typing
ls to list all files and directories you should see it right there.
Doing the above 3-4 steps can get tedious in itself and sometimes be hard to remember. Let's make this easier by creating a shortcut of sorts.
Given that the path to your cookiecutter-quark folder is still
~/cookiecutter-quark you can add an alias to your .bashrc file (or similar for zsh and other systems) so that for example you only have to type the word
quark on the command line to start cookiecutter in your user extensions dir.
- Open up your .bashrc / .zshrc file using vi:
- Add the following line to the bottom of the file:
alias quark="cd path/to/scextensions; cookiecutter ~/cookiecutter-quark"(replace "path/to/scextensions" with whatever the path outputted by your Platform.userExtensionsDir was).
- Save the file (press wq)
- Reload your .bashrc file:
Now, you can type
quark in your terminal, hit enter and start the cookiecutter program to create your badass new quark.
If you get this error, it means that cookiecutter cannot find your config file (because you probably haven't made one). A config file is a way to store systems defaults for cookiecutter's variables.
This can be fixed either by making a config file or, more simply, by adding the
--default-config flag at the end of the cookiecutter command.