Giter Site home page Giter Site logo

nake's Introduction

Nake readme

Describe your Nim builds as tasks. Example nakefile.nim:

import nake

const
  ExeName = "my_app"
  BleedingEdgeFeatures = "-d:testFeature1 -d:testFeature2"

task "debug-build", "Build with unproven features":
  if shell(nimExe, "c", BleedingEdgeFeatures, "-d:debug", ExeName):
    ## zip up files or do something useful here?

task "run-tests":
  # ...

Now you can run tasks from the nakefile.nim:

$ nake debug-build

License

MIT license.

Installation

Stable version

Use Nim's Nimble package manager to install the package and nake binary:

$ nimble update
$ nimble install nake

If a new version of nake is released, you can update to it by running those commands again. You can figure out the version you have installed by running nimble path nake.

Development version

Use Nim's Nimble package manager to install locally the GitHub checkout:

$ git clone https://github.com/fowlmouth/nake
$ cd nake
$ nimble install

If you don't mind downloading the Git repository every time, you can also tell Nimble to install the latest development version directly from Git:

$ nimble update
$ nimble install -y nake@#head

Usage

Nake has its own nakefile, it will build nake as a binary. The nake binary is just a shortcut for nim c -r nakefile $ARGS:

$ cd ~/.nimble/libs/nake
$ nim c -r nakefile install
## boring ^
$ cd ~/my-project
$ nake debug-build
## wow look at the convenience (!!)

Once the nakefile is built, you can run it manually with ./nakefile, but you can also run nake again. If nake detects that the source file is newer than the binary, the nakefile will be rebuilt again, otherwise it just runs the nakefile binary directly. Running nake in such case has an advantage of the nakefile being looked up in parent directories recirsively. You can always remove the nakefile and the nimcache directories if you need to force a rebuild.

Most nakefiles will involve running some commands in a shell. To verify what the shell invocations do you can pass the -c or --careful switch to a nake binary and then it will ask you to confirm each command being run:

$ nake --careful install
Run? `nim c nake` [N/y]

Note that this parameter only applies to nake's convenience shell() and direShell() procs, malicious nakefile authors will likely implement their own shell spawning process.

If you run the nakefile without parameters or with the -t or --tasks switch it will report the available tasks. But if you run a nakefile with a specific task and this task doesn't exist, nake will report an error, list the available tasks and exit with a non zero status.

In your nakefiles you can define the defaultTask task. This is a task which will be executed if the user runs nake without specifying a task. Example:

task defaultTask, "Compiles binary":
  if binaryRequiresRebuilding():
    doStuffToCompileProgram()
  else:
    echo "Binary is fresh, anything else?"
    listTasks()

Documentation

The documentation of nake can be found online at http://fowlmouth.github.io/nake/, but you can run the docs task of the included nakefile.nim to generate the user API HTML documentation into a nake.html file. This documentation explains what symbols you can use other than the obvious task() template to define tasks. If you installed using Nimble, you first need to go to your local Nimble directory. UNIX example:

$ cd `nimble path nake`
$ nim c -r nake docs
$ open nake.html

The docs task will also generate HTML versions of all local RST files, which are indexed from the generated theindex.html.

Changes

The changes are listed on the releases page.

nake's People

Contributors

apense avatar calinou avatar forlan-ua avatar fowlmouth avatar gradha avatar marcomq avatar mrjohz avatar narimiran avatar yglukhov avatar

Watchers

 avatar

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.