Wanager




![GitHub pull requests](https://img.shields.io/github/issues-pr/Wmanage/wng?label=Pull%20requests&style=flat-square) ![GitHub issues](https://img.shields.io/github/issues/Wmanage/wng?label=Issues&style=flat-square) ![GitHub stars](https://img.shields.io/github/stars/Wmanage/wng?color=%23aa1111&label=Stars&style=flat-square) ![GitHub](https://img.shields.io/github/license/Wmanage/wng?color=%23ffaa00&label=License&style=flat-square) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/Wmanage/wng?color=%23888800&label=Latest%20release&style=flat-square) ![Github All Releases](https://img.shields.io/github/downloads/Wmanage/wng/total?color=%2300aa00&label=Downloads&style=flat-square)



| CI | [![Build Status](https://travis-ci.com/Wmanage/wng.svg?branch=dev)](https://travis-ci.com/Wmanage/wng) | |----|--------------------------------------------------------------------------------------------------------|





Wanager (aka wng) is a package manager & build tool (like cargo for Rustlang) for the C programming language written in Rust. It allow you to create projects, headers, to install libraries & to compile and run fast and easily. It is different from CMake by its hability to manage libraries, packages and projects. The objective of this tool is to definitely give up Makefiles.



How to use

Setup

Prerequisties

Make sure to have Git, tar & gcc installed on your computer.

Installation

To install wng you can either : - Download the latest binary in the releases - Download updater.sh (Nix only and needs cargo) - *Note : you can setup a cron to keep an up to date wng version 😉 - Run cargo install wng - In /bin/ if you are on *nix - In C:\Program Files\ if you are on Windows

Create a new project

Open the command prompt and run :

$ wng new <project_name> $ cd project_name/

Three folders have been created, tests/, src/ and build/

In src/, you'll find file main.c that contains a basic hello world program.


Compile and Run

``` $ wng build

$ wng run Hello World ```

NOTE : wng build will build a debug executable, with flags -W -Wall -Werror -Wextra. To disable this, build in release mode with : wng build --release

Custom build

To build with a custom build, you have to create a build.py or build.rb file with your code to build.

If you want to specify a special python / ruby interpreter path, add the section "pyinterpreter" : "path2python" or "rbinterpreter" : "path2ruby" to your project.json.

Minimal python version required : 3.5 Minimal ruby version required : 2.3

Then run your script with wng build --custom

Use WNG api !

Wng api provides some useful features to compile your project

It is available in Ruby and Python

Note : If both build.rb & build.py files exists, build.py will be used

```py from wngbuild import * # Import all from wngbuild module

build = BuildProfile(files="src/*.c",output="build/custom/prog.exe" ) # setup a build profile that will compile all files in src/ and place the binary in build/custom/prog.exe build.cc = "C:\MinGW\bin\gcc.exe" # Setup the compiler (optional, by default "gcc") build.flags = "-W -Wall -Werror -Wextra" # Setup the flags that the command will be run with (optional)

build.run() # Run the compilation command build.runOutput() # Run the binary produced by the compilation command (Will raise an error if the compilation command fails) ```

```rb require 'wngbuild'

build=BuildProfile.new("src/*.c", "build/custom/prog") * Setup a build profile builc.cc="C:\Program Files\clang\bin\clang.exe"

build.run() * Run compilation build.runOutput() * Run produced file (Will raise an error if compilation failed) ```


Checking

You can just check if there is any errors or warnings in your code without producing any binary with wng check

Features

Archive

To create a gunzip archive of your project files, just run wng archive and a file called project.tar.gz will be created

To reinitialize a project

$ wng reinit Really want to reinit ? Y/N : Y Project renitialized !

To create a header file

``` $ wng header foo $ cat foo.h

ifndef FOOH_

define FOOH_

endif /_FOO_H/

```

To run tests

Tests have to be in tests/tests.c

To use functions that are in src/ files, just include the header with #include "../src/<header>.h"

Then you can run them with wng test

Libraries

To install a library

$ cd yourproject/ $ wng install <source>:<username>/<repo_name>

Available sources are : github,gitlab & bitbucket NOTE : Repository has to have a lib/ folder inside or wng will refuse to install it

Publish your library

Create a repository on GitHub, BitBucket or GitLab with your project, library files have to be in a lib/ folder

Contributing

See our contribution guidelines.