MyNixOS website logo
Description

Simple projects generator.

rob logo

Simple projects generator written in Haskell


Call on me in the day of trouble, and I will deliver, and thou shalt glorify me.

Daniel Defoe, Robinson Crusoe

Installation

$ cabal install rob

Usage

Before using Rob you need to create your projects templates. If for example you work often with nodejs you can create your nodejs template from scratch. Let's see then how to create a new Rob template.

New Project Template Creation

Create a folder anywhere on your machine. Put in this folder all the files/folders you want to use anytime you will chose this template. For example for the nodejs template you may have a folder structure that might look like this:

nodejs
│--package.json
│--README.md
│--travis.yml
│--.gitignore
└───src
│   │--index.js
└───test
    │--runner.js
    │--expect.js

The project.yml file

Rob relies on a single file that you must include in the root of your templates folders. This file is called project.yml

For example, the nodejs template must also contain an additional project.yml file:

nodejs
│--project.yml
│--package.json
│--README.md
...

The project.yml file will contain all the questions needed to copy and render your template files when you will chose that specific template. Depending on your answers to these questions Rob will be able to generate a (key, value) data map that will be used to shape your project files via its template engine

A typical project.yml might look like this:

questions:
  name:
    question: What's the name of the project?
    type: input
    default: foo

  description:
    question: Project description?

  test_framework:
    question: Which test framework do you want to use?
    type: select
    default: mocha
    answers:
      - mocha
      - jasmine
      - tap

  babel_preset:
    question: Which babel preset do you want to use?
    type: multiselect
    default:
      - babel-preset-env
    answers:
      - babel-preset-env
      - babel-preset-es2015
      - babel-preset-es2016
      - babel-preset-es2017

  is_public:
    question: Is it public?
    type: confirm

  password:
    question: What's your password?
    type: password

The kind of answers types supported are only input, confirm, select, multiselect and password. The questionnaire prompt are powered by fortytwo

Template engine

Rob uses EDE as template engine. Any time you will create a new project with Rob, all the files of the template selected will be parsed rendered via EDE using the answers provided with the project.yml. For example the package.json in your nodejs template might be:

{
  "name": "{{name}}",
  {% if is_public %}
    "public": true,
  {% endif %}
  ...
}

Please check the EDE to see all the available expression. However if you have already used Liquid or Jinja it shouldn't be such a big deal

Add the template to rob

Once you have set up your new template you can link it to Rob via rob add template-name path/to/the/template Pay attention: the path to your template should be absolute! For example:

rob add simple-node-js `/Users/WhoAmI/Projects/rob-templates/nodejs`

The command above will store the template in a file called .rob in your home directory.

Create a new project

Run rob new from any folder on your machine and if you have Rob templates available, it will create your project running the questionnaire and copying the files of the template chosen in the current directory

Autoignore files

Rob will automatically parse any .gitignore recursively in your selected template folders to ignore specific files that you don't want to copy over when you create a new project

Todo

  • [ ] Unit test!
  • [ ] Improve performance
  • [ ] Improve the documentation
  • [x] Write Documentation
  • [ ] Refactor the code and cleanup.
Metadata

Version

0.0.5

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows