Commit 5ddf6fd4 authored by Bat's avatar Bat

Initial commit

parents
# How to contribute
Because poulp is libre software, everybody can help. But before coding anything, you have to know how do we work, to keep everything clean and organized.
## Before starting
- Make sure you have a Framagit account (if you don't want to create a new account, you can just login with GitHUb or GitLab.com) ;
- You have your own fork of poulp, and it's up-to-date ;
- You have an issue on which to work. If the issue doesn't exist yet, you can create it. Clearly says that you are working on it, so someone else will not start working on it too ;
## Making changes
For each issue you are solving, follow those instruction.
- Create a new branch named `issue-X` with `X` the ID of your issue (e.g. run `git checkout -b issue-42`). Most of the time, this new branch is based on master ;
- Start coding. Every time you finish something, even if it's small, commit it. You can push it to your fork if you want ;
- Be sure that you also updated the docs (`SPEC.md`) ;
- When you are ready, and if the build passes, create a merge request. It should have a title like that: `Fix #X : Description`. In merge request message, explain how to test what you have done ;
- Your merge request will be reviewed, and merged in `develop` !
Your commit messages should start with a (very) short description of what you have done. If you need more precision you should use a new line.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
# poulp
poulp is like npm, but for Vala.
It is a little programm that'll help you generating files or projects, compiling your app, or installing librairies.
# Usage
First, create a `poulp.json` file. You can also use `poulp init` to do it.
```json
{
"name": "my-app",
"version": "1.4.6",
"dependencies": {
"gtk+-3.0": "*",
"gio-2.0": "*",
"libsoup-2.4": "*",
"semver": "^0.2.0"
}
}
```
Then, open a terminal and just run the following command.
```
poulp build
```
It will run this command for you.
```
valac *.vala -o build/my-app --pkg gtk+-3.0 --pkg gio-2.0 --pkg libsoup-2.4 --pkg semver
```
If you need some libraries that are not installed, run `poulp install`. With the manifest above, it will probably install a matching version of [`semver`](https://framagit.org/Bat/semver).
When installing a library, it will search for it in remote repositories, clone the matching git repository, compile it for your system and install it.
# Complete manifest
Here is a complete manifest, to let you see all available properties.
```json
{
"name": "my-app",
"version": "0.1.0",
"description": "A cool application",
"keywords": [
"website", "valse", "cool"
],
"homepage": "https://jean.dupont.fr/myapp.html",
"bugs": {
"url": "git.dupont.fr/jean/my-app/issues",
"email": "jean@dupont.fr"
},
"license": "LGPLv4",
"author": "Jean Dupont",
"contributors": [
"Jean Dupont", "Jeanne Dupont"
],
"maintainers": [
"The MyApp maintainment team"
],
"files": [
"*.vala", "*.wala", "models/*.vala", "static/*", "*.gs", "*.c"
],
"repository": "https://git.dupont.fr/my-app.git",
"vapi-dir": "src/vapis/",
"output": "custom-build-path/my-app",
"scripts": {
"test": [
"poulp build",
"./$(POULP_BUILD_OUPUT)"
]
},
"dependencies": {
"gio-2.0": "*",
"valse": "^0.1.2",
},
"dev-dependencies": [
"valadate-0.1"
],
"vala-version": ">=0.20.1",
"compilerParams": [
"-o", "$(POULP_NAME)-$(POULP_VERSION)"
]
}
```
# Available commands
- help - display help messages about poulp and commands
- init - init a new project
- install - install librairies in `poulp.json` or the specified ones
- build - build the project
- lint - lint your code
- repo - manage distant repositories
- run - run a script definde in `poulp.json`
# Hosting libraries
You can see an exemple repo here : https://gitlab.com/Bat41/poulp-repo-test/tree/master/.
You can use it with poulp by doing `poulp repo add https://gitlab.com/Bat41/poulp-repo-test/raw/master/dist`.
# poulp's specification
*This document aims to provide a description of how poulp will work when it will be prouction-ready.*
## poulp.json
The `poulp.json` file contains some [JSON](http://json.org) defining the properties of a project. It is located at the root of the project.
It can contains the following keys.
### name
The name of the project. It should only contain (small) letters, numbers or hyphens, and it must start with a letter.
```ruby
"my-project" # correct
"my-project-123" # correct
"GTK+ App" # Incorrect : capitals, + and space
"42-the-meaning-of-life-etc" # Incorrect : begins with a number
```
*This key is mandatory.*
### version
This is the version of your package. It should be a valid [semantic version](http://semver.org).
*This key is mandatory.*
### description
This is just a short description of your package.
### keywords
An array containing strings, which are the keywords of your package. It help people finding them when doing `poulp search`, and on the repositories websites using [poulp server](https://framagit.org/valse/poulp-server).
### homepage
This is a string containing the URL of the projects website.
### bugs
Specifies where to report bugs. It is an object, which can contain this fields.
- `url`, the bug tracker URL ;
- `email`, an email adress where we can send bug reports.
### license
The name of the license of your project.
### author
The name of the author of the project. It could contain an email adress after the name, between `<` `>`.
### contributors
A list of the peoples (string looking like the `author` field) who contributed to this project.
### maintainers
A list of the peoples (string looking like the `author` field) who maintains this project.
### files
The files to include at compilation.
### repository
The URL of the projects repository, where we can find the source code.
### vapi-dir
The path to a directory containing personal VAPIs.
### output
Where to put the result of the compilation. Defaults to `build/name-version` (where `name` is the name of the project and `version` the version).
### library
A boolean that tells us if this project is a library or not. If it is, it will be compiled in a special way, to make it reusable by everyone.
### scripts
Some custom scripts, that can be run whit `poulp run`. It's an object containing the fields you want (their name will be used as the argument of `poulp run`). Each of those fields are arrays with the list of the command to run.
### dependencies
The projects dependencies. It is an object where the keys are the name of the dependencies, and the value a range of versions. The name should be the same as the VAPI file name.
To see examples of version ranges, go to [semver](https://framagit.org/Bat/semver).
### dev-dependencies
Same as `dependencies`, but will only be installed by people developing the project. For instance, it could a testing framework.
### vala-version
The minimal Vala version to use with this project.
### compiler-params
Some other arguments to gives to `valac` when building.
## Commands
Each command listed here can be run with `poulp command`, where `command` is the command followed by its arguments.
`[arg]` is an optional argument.
### search package
Search the package named `package` in the known repositories. It will display something like that.
```
package 0.1.0 Short description of the package.
other 0.2.3 Yet another package.
```
### info package
Gives infos about `package`.
```
✓ Installed
Name package
Version 0.1.0 (latest is 0.2.0, update with `poulp update package`)
Description This is a package.
Author John Doe
Contributors Jane Doe, Foo Bar
Files package.vapi, package.h, package.so, package.pc
Dependencies other (0.2.3), foo (<2.1.0), bar (*)
Website https://john.doe.eu/projects/package
Source code https://john.doe.eu/git/package.git
```
### pack [--zip|--gz]
Creates a .zip or .tar.gz file containing all the binaries of the project (.h, .vapi, .so, .dll, etc)
### publish major|minor|patch --repo url [--no-changelog]
Pack the project (see `pack` above), creates a new version (update it in the manifest, `git tag` if the project uses `git`),
and update the changelog with `git log`, if it was not manually done (this last behavior can be disabled with `--no-changelog`).
Then it post the new version on the repository at `url`.
**Warning** `--repo` and `--no-changelog` are not implemented yet.
### build [--release]
Compiles your project using the options specified in the manifest.
### gen output --template template
Creates a new file (`output`) from the template named `template`. `output` doesn't need to include any extension.
### help [command]
Gives you help about poulp, or a specific command if `command` is specified.
### init
An interactive tool to create a new project.
### install [lib] [lib] [lib]...
Install all the specified libraries, or those present in `libs` in the manifest if none.
It clones the libraries, checkout to the most recent matching version, builds it and installs the result.
### lint [--elementary|--gnome|--both]
Lints your code, following the specified convention (defautl is elementary).
### repo [add|remove] [url]
Manages your remote repositories. If there is no argument, it just lists them.
If you do [add url], it registers the repo at `url`. And `remove url` unregisters the repository at `url`.
### run script
It runs the script named `script`, previousy defined in the manifest.
### update [lib] [lib] [lib]...
Updates your packages to the latest version.
# Variables
poulp defines some environment varaibles when spawning a command. You can use them in `output`, `compiler-params` and your scripts.
- `$PROJECT_NAME`, the name of your project;
- `$PROJECT_VERSION`, the version of your project;
- `$PROJECT_DESCRIPTION`, the description of your project;
- `$PROJECT_LICENSE`, the license of your project;
- `$PROJECT_HOMEPAGE`, the homepage of your project;
- `$PROJECT_OUTPUT`, the path to the output of your project;
# Remote repositories organization
*You can find a sample repository [here](https://gitlab.com/Bat41/poulp-repo-test/tree/master/dist).*
The remote repositories just contains one file, named `packages.json`. It contains a list of all the packages available in this repository. It also contains another field, `name`, which is the name of the repository.
This file has an object, named `packages` which contains key-value pairs of packages (the name is the key, and the git repository the value).
*Example `package.json` file*
```
{
"name": "A little poulp repository",
"packages": {
"foo": "https://git.foo.org/foo.git",
"bar": "https://github.com/baz/bar",
"hello": "https://gitlab.com/hey/hello"
}
}
```
It is planed to make it possible for package to install templates, but not available yet.
----
Because it could be a little bit hard to manually manage a repository, we are [working on a web interface](https://framagit.org/valse/poulp-server) to do it easily. But yet, you can just use a git repository.
# Local organization
poulp stores local files in `$POULP_DATA_DIR`, which defaults to `C:\ProgramData\poulp\` on Windows and `/etc/poulp/` on other systems.
This directory contains a file named `repos`, which contains a list of all known repos (their URL to be exact), one per line.
Then, you have the `projects` and `files` folders, similar to those in a distant repository, but only with installed templates.
{
"index": {
"title": "Poulp, the Vala project and packages manager"
}
}
doctype
html
head
title #{title}
link(rel="stylesheet" href="css/main.css")
link(rel="stylesheet" href="css/xcode.css")
link(rel="icon" href="img/poulp.svg")
body
!= yield
script(src="js/highlight.pack.js")
script hljs.initHighlightingOnLoad();
@light-background: rgb(245, 245, 245);
@light-gray: rgb(200, 200, 200);
html, body {
margin: 0px;
padding: 0px;
font-family: 'Roboto';
}
.lobster {
font-family: 'Lobster 1.4';
font-size: 1.5em;
}
h1, h2, h3, h4 {
font-family: 'Source Sans Pro';
font-weight: 400;
}
p.hint {
@blue: rgb(0, 140, 255);
border-left: 5px solid @blue;
background: lighten(@blue, 30%);
padding: 15px;
}
div.presenter {
text-align: center;
background: linear-gradient(to top left, #1A2980 , #26D0CE);
padding: 10%;
color: white;
img {
max-width: 30%;
max-height: 30%;
}
}
.links {
list-style: none;
text-align: center;
padding: 20px;
margin: 0px;
background: @light-background;
li {
display: inline;
padding: 10px;
margin: 10px;
transition: 0.3s all ease-in;
border-radius: 5px;
&:hover {
background: rgb(227, 227, 227);
}
a {
text-decoration: none;
color: rgb(92, 92, 92);
}
}
}
main {
padding: 50px 20%;
}
pre code {
box-shadow: 0px 0px 5px @light-gray;
}
/*
XCode style (c) Angel Garcia <angelgarcia.mail@gmail.com>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #fff;
color: black;
}
.hljs-comment,
.hljs-quote {
color: #006a00;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal {
color: #aa0d91;
}
.hljs-name {
color: #008;
}
.hljs-variable,
.hljs-template-variable {
color: #660;
}
.hljs-string {
color: #c41a16;
}
.hljs-regexp,
.hljs-link {
color: #080;
}
.hljs-title,
.hljs-tag,
.hljs-symbol,
.hljs-bullet,
.hljs-number,
.hljs-meta {
color: #1c00cf;
}