Get your coding project off the ground
Liftoff tries to resemble and is inspired by Rusts cargo new foo --<some_option>
command and aims to get you up and running with coding as fast as possible, in any language.
#
Simple python project in folder my_python_project
:
bash
$ liftoff new my_python_project --config file/to/template.sane
generates this file tree
```bash
.
├── mypythonproject
│ ├── init.py
│ ├── core.py
│ └── helpers.py
├── README.md
├── requirements.txt
├── LICENSE.txt
└── setup.py
from this config file:
yaml
language = "python"
git = true
license = "Unlicense"
directories = [ { name = "$(project)", files = [ { name = "helpers.py" }, { name = "core.py" }, { name = "init.py" } ] }, ]
files = [ { name = "setup.py", template = "http://www.alink.com/a_file.py" }, { name = "README.md", content = "# $(project)" }, { name = "requirements.txt" }, ] ```
```bash liftoff - get your coding project off the ground
USAGE: liftoff [SUBCOMMAND]
FLAGS: -h, --help Prints help information -V, --version Prints version information
SUBCOMMANDS: help Prints this message or the help of the given subcommand(s) install Installs liftoff files new Create new project uninstall Uninstalls liftoff files
```
```bash
USAGE:
liftoff new [FLAGS] [OPTIONS] --config
FLAGS: -h, --help Prints help information --nogit Git will not be initialized in project -V, --version Prints version information
OPTIONS:
-a, --author
ARGS:
```
All OPTIONS can optionally be explicitly set in the config file itself. See Working with Files.
The following Licenses can be chosen from the command line --license <Identifier>
or set in the config file license = <Identifier>
|Name| Identifier |Name|Identifier
|--|--|--|--|
|Unlicense |unlicense
(Default) |Apache 2.0|apache-2.0
|
|MIT|mit
|EPL 2.0|epl-2.0
|
|GPL 3.0|gpl-3.0
|GPL 2.0|gpl-2.0
|
|BSD 3.0|bsd-3.0
|BSD 2.0|bsd-2.0
|
|LGPL 2.1|lgpl-2.1
|LGPL 3.0|lgpl-3.0
|
|AGPL 3.0|agpl-3.0
|MPL 2.0|mpl-2.0
|
Disclaimer: I am not responsible for legal damages due to license issues. Double check the generated license
The following Ci Services can be chosen from the command line --ci <Identifier>
or set in the config file ci = <Identifier>
.
|Name| Identifier |
|--|--|
|Travis CI|travisci
|
|Circle CI|circleci
|
|AppVeyor|appveyor
|
These Templates are available after installation.
If you want to use a default template, just choose the base name of the config file (without the file extenstion) as the --config <NAME>
parameter. E.g.
bash
$ liftoff new myproject --config cpp
for cpp.sane
If you are not happy with the templates given, you can do two things:
a) quickly adapt a template
bash
$ liftoff prep <config_id> --name my_<config_id>.sane
with e.g. template cpp copies base template cpp.sane to $PWD/my_cpp.sane
, edit it to your taste!. Now simply run liftoff
with the adapted template
bash
$ liftoff new a_project --config my_cpp.sane
Want to save the adjusted config?
bash
$ liftoff save my_cpp.sane
The adjusted template will be placed to $HOME/.liftoff/configs/
and can be used with --config my_cpp
(without the file extension)
b) see next section
The config files follow the sane specification by Bloom. Here's a quick overview of the format.
All OPTIONS in liftoff new -h
can be manually set in a file OR manually set with command line options (although command line options always overwrite file defaults)
The only top level variables, that have to exist are
* language
: language identifier matching the gitignore.io api names
Individual files are described by
* name
: a file name
* template
(optional): a file template: web link or file path
* content
(optional): a string that will be echoed into the file. If template
AND content
is set, the file will be overwritten by content
!
but must be wrapped into a Files list:
yaml
files = [
{
name = "a_file_name",
template = "some_file", # optional, web link or file path
content = "Hi there" # optional
},
... # more files
]
name
: a directory namename
: a file nametemplate
(optional): a file template: web link or file pathcontent
(optional): a string that will be echoed into the file. If template
AND content
is set, the file will be overwritten by content
!files in directory must be wrapped into a directories list:
yaml
directories = [
{
name = "$(project)",
files = [ # multiple files
{
name = "helper.py",
template = "/a/path/to/file.py"
},
{
name = "another_helper.py",
content = "import numpy as np"
},
]
},
{
{
name = "$(project)_copy",
file = { # single file
name = "helper_copy.py",
template = "http://somewebsite.com"
}
},
}
]
You can set variables, enclosed in $(<variable>)
in the config file. Supported substitutable variables are
* project
* author
(if set)
* language
* license
* date
* year
* month
* day
E.g. config file
yaml
language = "c++"
git = false
...
files = [
{
name = "README_$(project).md", # just an example
content = "# $(project)\n* in $(language)\n* with [liftoff](www.github.com/juliangaal/liftoff)"
},
...
]
with liftoff command liftoff new test_project --config /path/to/config.sane
will be evaluated into README_test_project.md
(Note: Markdown not rendered here)
```markdown
Supported Services
|Name| Identifier |
|--|--|
|Travis CI|travisci
|
|Circle CI|circleci
|
|AppVeyor|appveyor
|
A service is described by
* name
: see Identifier above
* template
(optional): web link or file path
yaml
ci = {
name = "circleci", # see support CI Services in section Options
template = "some_file" # optional: web link or file path!
}
Requirements:
* rust >= 1.26.0 (fs::read_to_string())
* libssl-dev