Giter Club home page Giter Club logo

ohai's Introduction

Ohai - easy setup for ocaml/reason native projects

Think of it as the npm init or the cargo new for jbuilder + opam.

~$ ohai --bin example
Creating new executable project "example" in example/
~$ cd example
~$ tree
.
├── Makefile
├── bin
│   ├── jbuild
│   └── example.re
├── jbuild-workspace.dev
├── lib
│   ├── Main.re
│   └── jbuild
├── test
│   ├── jbuild
│   └── test.re
└── example.opam

3 directories, 9 files
~$ make run
jbuilder build @install
       refmt bin/example.re.ml
    ocamldep bin/example.depends.ocamldep-output
      ocamlc lib/lib.{cmi,cmo,cmt}
       refmt lib/Main.re.ml
    ocamldep lib/lib.depends.ocamldep-output
      ocamlc lib/lib__Main.{cmi,cmo,cmt}
      ocamlc bin/example.{cmi,cmo,cmt}
    ocamlopt lib/lib.{cmx,o}
    ocamlopt lib/lib__Main.{cmx,o}
    ocamlopt lib/lib.{a,cmxa}
    ocamlopt bin/example.{cmx,o}
    ocamlopt bin/example.exe
jbuilder exec example
Hello world

Then take a look at the generated Makefile and source files for more info on how to get started!

Why do we need this?

If you haven't done it before, setting up all the jbuild and opam files can be a bit confusing. If you have done it before, it can be tedious!

ohai gets the boilerplate out of the way so you can start building your thing.

Installation

Make sure you have ocaml installed (brew install opam on osx).

Then go ahead and pin to this repository.

opam pin add ohai git+https://github.com/jaredly/ohai

Usage

~$ ohai
Usage: ohai [cmd] [opts]

Options:
  -h --help         show this info

Commands:

> help

show this help

> init [?name] [opts]

If you provide a package name, a directory of that name
will be created with the generated files. If you do not,
the current directory (if empty) will be used.

  -i --interactive  ask for information interactively (coming soon)
  --overwrite       write files even if directory is not empty
  --bin             use template for an executable
  --lib             use template for a library [default]
  --ml              don't use reason syntax

Roadmap

  • make a ppx for inlining static files (see Templates.re)
  • have a template for ppxs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.