SPEC.md 9.01 KB
Newer Older
Bat's avatar
Bat committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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-live-and-co" # 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.

Bat's avatar
Bat committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
### 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.

### vapiDir

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).

Bat's avatar
Bat committed
82
83
84
85
### 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.

Bat's avatar
Bat committed
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
### 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.

### libs

The projects dependencies. The name should be the same as the VAPI file name.

### devLibs

Same as `libs`, but will only be installed by people developing the project. For instance, it could a testing framework.

### valaVersion

The Vala version to use with this project.

### compilerParams

Some other arguments to gives to `valac` when building.

Bat's avatar
Bat committed
106
107
108



Bat's avatar
Bat committed
109
110
111
112
113
114
## 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.

Bat's avatar
Bat committed
115
### search package
Bat's avatar
Bat committed
116
117
118
119
120
121
122
123

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.
```

Bat's avatar
Bat committed
124
### info package
Bat's avatar
Bat committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

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)

Bat's avatar
Bat committed
147
### publish major|minor|patch --repo url [--no-changelog]
Bat's avatar
Bat committed
148

Bat's avatar
Bat committed
149
Pack the project (see `pack` above), creates a new version (update it in the manifest, `git tag` if the project uses `git`),
Bat's avatar
Bat committed
150
151
152
153
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`.

Bat's avatar
Bat committed
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
### 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.

### 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.




Bat's avatar
Bat committed
195
196
# Variables

Bat's avatar
Bat committed
197
198
199
200
201
202
203
204
205
poulp defines some environment varaibles when spawning a command. You can use them in `output`, `compilerParams` 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;

Bat's avatar
Bat committed
206
207
# Remote repositories organization

Bat's avatar
Bat committed
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
*You can find a sample repository [here](https://gitlab.com/Bat41/poulp-repo-test/tree/master/dist).*

The remote repositories are organized as follow.

- /
    - packages.json
    - my-package/
        - poulp.json
        - my-package.vapi
        - my-package.h
        - my-package.so
        - ...
        - projects/
            - projects.json
            - my-template/
                - main.vala
                - poulp.json
                - ...
        - files/
            - files.json
            - foo.vala
            - bar.gs
            - ...

`packages.json` contains a list of all the packages available in this repository. It also contains two other fields `name` (the name of the repository) and `owner`, the name (and optionally email) of the administrator.

Every package is an object in the `libs` array, with those properties.

- name, the name/ID of the package, used by `poulp install name`. Normally, it is the same as the name in the `poulp.json` ;
- files, an object with at least one of this key :
    - `all`, an array containing files for any platform (.pc, .vapi, .h, etc). The path are relative to the packages folder (see below) ;
    - `windows`, windows specific files (`.dll` and Co.) ;
    - `linux`, GNU/Linux specific files ;
    - `osx`, Mac OS X specific files ;
    - `bsd`, BSD specific files ;
    - `unix`, an alias for `linux`, `osx` and `bsd`.

The repository should contain a folder named with the ID of the package at its root (`my-package` in the example above).

This folder should contains all the files specified in `packages.json`. It could also contain two special folders : projects and files. Those two folders respectively contains projects and files templates.

The `projects` directory should contain a `projects.json` file, that looks like this.

```json
[
  {
    "id": "my-project-template",
    "name": "My project template",
    "description": "An example template",
    "files": [ "foo.vala", "poulp.json" ]
  },
  ...
]
```

Then, you should create a new subfolder in `projects`, that contains the files of the templates. If a `poulp.json` file is here, some of its property will be used when a new project is initialized with this template (actually, only `libs` and `keywords`).

The `files` folders is quite similar to the `projects` one. It also contains a file, named `files.json`, containing a list of available file templates. This file looks like this.

```json
[
  {
    "id": "my-file-template",
    "name": "My file template",
    "description": "A super cool file template",
    "files": [ "bar.vala" ]
  },
  ...
]
```

The files should be in the `files` folder, not in a subdirectory like for `projects`. You can specify many files, because it could be useful. For instance, you can have a GTK+ window template, with a `window.vala` file and `window.ui` file.

----

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.
Bat's avatar
Bat committed
284
285
286



Bat's avatar
Bat committed
287
# Local organization
Bat's avatar
Bat committed
288
289
290
291
292
293

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.