nit.git
7 years agoios: redirect prints to NSLog (printf is no longer an output of the simulator)
Alexis Laferrière [Fri, 23 Sep 2016 01:09:38 +0000 (21:09 -0400)]
ios: redirect prints to NSLog (printf is no longer an output of the simulator)

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoios: duplicate full implementation of `size= & align=` in TextInput
Alexis Laferrière [Fri, 9 Sep 2016 14:39:42 +0000 (10:39 -0400)]
ios: duplicate full implementation of `size= & align=` in TextInput

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoios: Button relay `size= & align=` to its `title_label`
Alexis Laferrière [Fri, 9 Sep 2016 14:39:00 +0000 (10:39 -0400)]
ios: Button relay `size= & align=` to its `title_label`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoios: refactor `Label::size= & align=` services implementation
Alexis Laferrière [Fri, 9 Sep 2016 14:37:55 +0000 (10:37 -0400)]
ios: refactor `Label::size= & align=` services implementation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotests: iOS app have one more file
Alexis Laferrière [Thu, 22 Sep 2016 13:06:22 +0000 (09:06 -0400)]
tests: iOS app have one more file

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agobenitlux: fix ios-release rule and keep the compiled files for XCode GUI
Alexis Laferrière [Fri, 9 Sep 2016 12:39:55 +0000 (08:39 -0400)]
benitlux: fix ios-release rule and keep the compiled files for XCode GUI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agolib: fix clang warnings in md5 and pthreads
Alexis Laferrière [Wed, 21 Sep 2016 16:45:34 +0000 (12:45 -0400)]
lib: fix clang warnings in md5 and pthreads

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agosrc: `exec_and_check` print to stderr
Alexis Laferrière [Fri, 9 Sep 2016 14:35:19 +0000 (10:35 -0400)]
src: `exec_and_check` print to stderr

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agonitc iOS: quiet output of `xcodebuild`
Alexis Laferrière [Wed, 21 Sep 2016 16:45:54 +0000 (12:45 -0400)]
nitc iOS: quiet output of `xcodebuild`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agonitc iOS: fix moving binary in release compilation mode
Alexis Laferrière [Fri, 9 Sep 2016 14:34:37 +0000 (10:34 -0400)]
nitc iOS: fix moving binary in release compilation mode

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agonitc iOS: report rmdir errors and quit
Alexis Laferrière [Fri, 9 Sep 2016 14:32:42 +0000 (10:32 -0400)]
nitc iOS: report rmdir errors and quit

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: StatementRow::map
Jean Privat [Wed, 7 Sep 2016 01:25:27 +0000 (21:25 -0400)]
Merge: StatementRow::map

I thought this was lacking from the API, so now when dealing with a StatementRow, one can get a map from column name to column value.

NOTE: This is not lazy since Sqlite re-uses the StatementRow for each row returned when a select statement is sent to the database.

Pull-Request: #2308
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotests: Update `test_sqlite3_nity` to include `StatementRow::map`
Lucas Bajolet [Tue, 6 Sep 2016 15:54:25 +0000 (11:54 -0400)]
tests: Update `test_sqlite3_nity` to include `StatementRow::map`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/sqlite: Added `map` method to `StatementRow`
Lucas Bajolet [Tue, 6 Sep 2016 15:53:56 +0000 (11:53 -0400)]
lib/sqlite: Added `map` method to `StatementRow`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: gamnit: fix field of view issues
Jean Privat [Tue, 6 Sep 2016 19:16:12 +0000 (15:16 -0400)]
Merge: gamnit: fix field of view issues

Erroneous code at creation of the perspective matrix caused a wider than requested frustum and field of view. This caused issues in other gamnit code:

* The service `camera_to_world` had to multiply the result by 1.72 to correct the deformation.
* In `asteronits`, the world was not filling the screen, only part of it.
* In general, it created a cool but not desired wide angle lens / fisheye effect.

After the fix, some clients might have to widen the requested visible area, usually set with `reset_height`. We may have to lower the default `field_of_view_y` as it is a bit high.

Pull-Request: #2307
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoaction_nitro: see more world units on screen
Alexis Laferrière [Mon, 5 Sep 2016 17:34:42 +0000 (13:34 -0400)]
action_nitro: see more world units on screen

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agogamnit: the magic number has been fixed by the fovy
Alexis Laferrière [Mon, 5 Sep 2016 14:13:22 +0000 (10:13 -0400)]
gamnit: the magic number has been fixed by the fovy

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agogamnit: fix setting camera field of view
Alexis Laferrière [Mon, 5 Sep 2016 14:12:47 +0000 (10:12 -0400)]
gamnit: fix setting camera field of view

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: nitweb: render wikilinks
Jean Privat [Sat, 3 Sep 2016 02:04:14 +0000 (22:04 -0400)]
Merge: nitweb: render wikilinks

This PR allows nitweb to render wikilinks from README.md files.

Here the demo with the lib/core/README.md file: http://nitweb.moz-code.org/doc/core

Pull-Request: #2306
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agonitweb: replace default md_processor so nitweb can render README files
Alexandre Terrasa [Thu, 25 Aug 2016 19:46:38 +0000 (15:46 -0400)]
nitweb: replace default md_processor so nitweb can render README files

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: move md_processor to config
Alexandre Terrasa [Thu, 25 Aug 2016 19:45:40 +0000 (15:45 -0400)]
nitweb: move md_processor to config

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agosrc/doc_down: does not pre escape nit source code
Alexandre Terrasa [Thu, 25 Aug 2016 19:45:05 +0000 (15:45 -0400)]
src/doc_down: does not pre escape nit source code

Fixes a problem of rendering when the nitunit contains `"`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agosrc/doc_down: make md processors writable
Alexandre Terrasa [Thu, 25 Aug 2016 19:44:28 +0000 (15:44 -0400)]
src/doc_down: make md processors writable

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: nitweb: use index for quick search
Jean Privat [Thu, 1 Sep 2016 22:41:52 +0000 (18:41 -0400)]
Merge: nitweb: use index for quick search

This PR use the `model_index` API to provide better quicksearch in nitweb.

Demo: http://nitweb.moz-code.org/

Will maybe close a shitstorm of quicksearch related issues but I'm to lazy to check the numbers...

Pull-Request: #2305
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: nitweb: better namespaces
Jean Privat [Thu, 1 Sep 2016 18:50:21 +0000 (14:50 -0400)]
Merge: nitweb: better namespaces

Before this PR, the namespace composition (adding html things to the MEntity::full_name) was handled by Angular. Namespaces are a pain in the nit to generate, even more when you don't have access to the model... So the solution was to delegate that work to the API.

With this PR, nitweb attach a Namespace object to each MEntity so Angular knows how to render it.
The idea is pretty simple, a namespace is an array of either:

* a string for "::", "$" ...
* an mentity reference like `Array`
* another namespace for recursive definitions

Demo is here: http://nitweb.moz-code.org/

Some examples:

* `core`: http://nitweb.moz-code.org/doc/core
* `core>`: http://nitweb.moz-code.org/doc/core>
* `core::core`: http://nitweb.moz-code.org/doc/core::core
* `core::Array`: http://nitweb.moz-code.org/doc/core::Array
* `core::Array::from`: http://nitweb.moz-code.org/doc/core::Array::from

Pull-Request: #2304
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: frontend: make the warning on unavailable glslangValidator an advice
Jean Privat [Thu, 1 Sep 2016 01:53:17 +0000 (21:53 -0400)]
Merge: frontend: make the warning on unavailable glslangValidator an advice

Changes the following warning to an advice and raise it at each use of the annotations (instead of only once).

~~~
/nit/lib/gamnit/flat.nit:355,9--26: Warning: program `glslangValidator` not in PATH, cannot validate this shader. (glslvalidator)
""" @ glsl_vertex_shader
~~~

Pull-Request: #2299
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agoMerge: app::audio: remove deprecated services and other minor improvements
Jean Privat [Thu, 1 Sep 2016 01:53:16 +0000 (21:53 -0400)]
Merge: app::audio: remove deprecated services and other minor improvements

This PR removes the old `load_sound` and `load_music` services, they were replaced by lazy loading services a while back. The new services are more in line with the other asset loading services from `gamnit`.

There are also other general but minor improvements: doc updates, better names for a param and an attribute, less warnings, less casts, more consistent error messages and easier debugging.

Pull-Request: #2300
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: typing: Fix minor mistakes in documentation
Jean Privat [Thu, 1 Sep 2016 01:53:15 +0000 (21:53 -0400)]
Merge: typing: Fix minor mistakes in documentation

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2301

7 years agoMerge: json::serialization: don't raise errors on missing attributes with default...
Jean Privat [Thu, 1 Sep 2016 01:53:15 +0000 (21:53 -0400)]
Merge: json::serialization: don't raise errors on missing attributes with default values

This PR fits in the ongoing work to improve deserializing from plain JSON objects.

The JSON deserialization engine no longer raises errors on missing attributes when a default value is available. Attributes may be missing because the JSON object come from a third-party API or
when loading serialized data from a previous version of the software. Default values include simple default values (`var x = 4`), lazy attributes and nullable types (which are set to `null`). This does not yet include `optional` attributes, more work would be needed.

The test/example can be activated when #2296 is fixed.

Pull-Request: #2302
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: nitweb: light responses
Jean Privat [Thu, 1 Sep 2016 01:53:14 +0000 (21:53 -0400)]
Merge: nitweb: light responses

Nitweb was returning insane amount of data (~2mo of json by request). The new version (http://nitweb.moz-code.org/) is a little more perf.

Pull-Request: #2303
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agonitweb/ng: enhance search results display
Alexandre Terrasa [Thu, 25 Aug 2016 19:36:00 +0000 (15:36 -0400)]
nitweb/ng: enhance search results display

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb/ng: clean card css
Alexandre Terrasa [Fri, 19 Aug 2016 09:40:12 +0000 (05:40 -0400)]
nitweb/ng: clean card css

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: use model index
Alexandre Terrasa [Thu, 25 Aug 2016 07:14:14 +0000 (03:14 -0400)]
nitweb: use model index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: move view to config
Alexandre Terrasa [Thu, 25 Aug 2016 07:13:48 +0000 (03:13 -0400)]
nitweb: move view to config

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: autoload focused linearization code
Alexandre Terrasa [Thu, 25 Aug 2016 19:02:42 +0000 (15:02 -0400)]
nitweb: autoload focused linearization code

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: show namespace in frontend
Alexandre Terrasa [Thu, 25 Aug 2016 19:02:28 +0000 (15:02 -0400)]
nitweb: show namespace in frontend

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: add `namespace` key to all mentities json
Alexandre Terrasa [Thu, 25 Aug 2016 19:01:39 +0000 (15:01 -0400)]
nitweb: add `namespace` key to all mentities json

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agomodel: fix some warnings
Alexandre Terrasa [Thu, 25 Aug 2016 19:01:06 +0000 (15:01 -0400)]
model: fix some warnings

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: fix linearization responses
Alexandre Terrasa [Thu, 25 Aug 2016 05:54:30 +0000 (01:54 -0400)]
nitweb: fix linearization responses

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: use model_json `full_json`
Alexandre Terrasa [Thu, 25 Aug 2016 05:46:05 +0000 (01:46 -0400)]
nitweb: use model_json `full_json`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agosrc/model: split model json into short and full json
Alexandre Terrasa [Thu, 25 Aug 2016 05:45:50 +0000 (01:45 -0400)]
src/model: split model json into short and full json

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agotests: udate JSON tests
Alexis Laferrière [Tue, 30 Aug 2016 14:00:44 +0000 (10:00 -0400)]
tests: udate JSON tests

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agojson::serialization: document reading from JSON with missing attributes
Alexis Laferrière [Tue, 30 Aug 2016 13:04:05 +0000 (09:04 -0400)]
json::serialization: document reading from JSON with missing attributes

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend/serialization: missing nullable attribute are set to null
Alexis Laferrière [Tue, 30 Aug 2016 13:14:19 +0000 (09:14 -0400)]
frontend/serialization: missing nullable attribute are set to null

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoserialization: don't throw missing attribute error if there is a default value
Alexis Laferrière [Tue, 30 Aug 2016 02:32:44 +0000 (22:32 -0400)]
serialization: don't throw missing attribute error if there is a default value

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend/serialization: leave missing attributes to their default value
Alexis Laferrière [Tue, 30 Aug 2016 13:37:25 +0000 (09:37 -0400)]
frontend/serialization: leave missing attributes to their default value

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agojson::serialization: engines report when an attributes is missing
Alexis Laferrière [Tue, 30 Aug 2016 02:29:30 +0000 (22:29 -0400)]
json::serialization: engines report when an attributes is missing

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend/serialization: remove generated documentation
Alexis Laferrière [Tue, 30 Aug 2016 02:30:12 +0000 (22:30 -0400)]
frontend/serialization: remove generated documentation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agomodelize: precise in `has_value` doc the link with `is_lazy`
Alexis Laferrière [Fri, 26 Aug 2016 17:02:47 +0000 (13:02 -0400)]
modelize: precise in `has_value` doc the link with `is_lazy`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agotyping: Fix minor mistakes in documentation
Jean-Christophe Beaupré [Mon, 29 Aug 2016 15:33:21 +0000 (11:33 -0400)]
typing: Fix minor mistakes in documentation

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

7 years agoandroid::audio: remove indirection to sounds.add
Alexis Laferrière [Sun, 28 Aug 2016 13:55:46 +0000 (09:55 -0400)]
android::audio: remove indirection to sounds.add

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoandroid::audio: revamp param and doc of `load_name`
Alexis Laferrière [Sun, 28 Aug 2016 13:11:46 +0000 (09:11 -0400)]
android::audio: revamp param and doc of `load_name`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoapp::audio: rename `name` to `path`
Alexis Laferrière [Sun, 28 Aug 2016 13:11:04 +0000 (09:11 -0400)]
app::audio: rename `name` to `path`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoapp::audio: update doc
Alexis Laferrière [Sun, 28 Aug 2016 13:05:58 +0000 (09:05 -0400)]
app::audio: update doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoandroid::audio: print errors at loading sounds
Alexis Laferrière [Sun, 28 Aug 2016 13:02:37 +0000 (09:02 -0400)]
android::audio: print errors at loading sounds

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend: always raise advice about missing glslangValidator
Alexis Laferrière [Sun, 28 Aug 2016 15:38:29 +0000 (11:38 -0400)]
frontend: always raise advice about missing glslangValidator

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend: make the warning on missing `glslangValidator` an advice
Alexis Laferrière [Sun, 28 Aug 2016 15:12:58 +0000 (11:12 -0400)]
frontend: make the warning on missing `glslangValidator` an advice

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoapp::audio: drop the old load_sound and load_music
Alexis Laferrière [Sun, 28 Aug 2016 13:01:17 +0000 (09:01 -0400)]
app::audio: drop the old load_sound and load_music

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: serialization: fix a bug, improve doc and clean weird condition
Jean Privat [Fri, 26 Aug 2016 21:09:29 +0000 (17:09 -0400)]
Merge: serialization: fix a bug, improve doc and clean weird condition

Pull-Request: #2297
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: Mkdir fix
Jean Privat [Fri, 26 Aug 2016 21:09:28 +0000 (17:09 -0400)]
Merge: Mkdir fix

Calling `String::mkdir` on a path might produce errors when part of the path already existed.

This PR fixes this behaviour.

Pull-Request: #2298
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agolib/core: `String::mkdir` will only produce an error when the complete path already...
Lucas Bajolet [Fri, 26 Aug 2016 20:13:42 +0000 (16:13 -0400)]
lib/core: `String::mkdir` will only produce an error when the complete path already exists

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/core: Make `file_exists` a `Text` function instead of `String`
Lucas Bajolet [Fri, 26 Aug 2016 20:07:55 +0000 (16:07 -0400)]
lib/core: Make `file_exists` a `Text` function instead of `String`

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agolib/serialization: better doc for `AttributeTypeError`
Alexis Laferrière [Fri, 26 Aug 2016 17:03:17 +0000 (13:03 -0400)]
lib/serialization: better doc for `AttributeTypeError`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agobinary::serialization: fix if condition
Alexis Laferrière [Fri, 26 Aug 2016 17:10:41 +0000 (13:10 -0400)]
binary::serialization: fix if condition

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agofrontend/serialization: fix skipping type check for `nullable Object` attr
Alexis Laferrière [Fri, 26 Aug 2016 17:06:10 +0000 (13:06 -0400)]
frontend/serialization: fix skipping type check for `nullable Object` attr

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: modelize_property: Promote `refine-type` to an error
Jean Privat [Fri, 26 Aug 2016 16:42:24 +0000 (12:42 -0400)]
Merge: modelize_property: Promote `refine-type` to an error

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2287
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: Beef up github merge
Jean Privat [Fri, 26 Aug 2016 16:42:23 +0000 (12:42 -0400)]
Merge: Beef up github merge

The tool was fragile, crappy, and very limited.
Now it is still fragile, crappy but less limited.

A lot of new features:

* can work on other repositories than nitlang/nit
* can choose what query to list (eg label)
* fixed status info, and we can filter on it also
* can merge automatically
* and ~~much~~ some more.

All these improvement are used to enable the automatic construction of a `next` branch based on PR with some characteristics.

Pull-Request: #2293
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: json::serialization: fix reading attributes from non-objects
Jean Privat [Fri, 26 Aug 2016 16:42:23 +0000 (12:42 -0400)]
Merge: json::serialization: fix reading attributes from non-objects

This error could arise when parsing invalid JSON strings (or non-object JSON values) and skipping the call to `deserialize`.

See @privat comment in #2291.

Pull-Request: #2295
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

7 years agogithub_merge: add --status to filter out PR without success
Jean Privat [Fri, 26 Aug 2016 01:38:10 +0000 (21:38 -0400)]
github_merge: add --status to filter out PR without success

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agogithub_merge: use combined status (and be more useful)
Jean Privat [Fri, 26 Aug 2016 01:33:05 +0000 (21:33 -0400)]
github_merge: use combined status (and be more useful)

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agogithub_merge: add option --all to merge all PR
Jean Privat [Fri, 26 Aug 2016 01:12:43 +0000 (21:12 -0400)]
github_merge: add option --all to merge all PR

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agogithub_merge: skip issues (not PR)
Jean Privat [Fri, 26 Aug 2016 01:04:21 +0000 (21:04 -0400)]
github_merge: skip issues (not PR)

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agogithub_merge: add options
Jean Privat [Fri, 26 Aug 2016 01:02:59 +0000 (21:02 -0400)]
github_merge: add options

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agojson::serialization: fix reading attributes from non-objects
Alexis Laferrière [Fri, 26 Aug 2016 14:51:51 +0000 (10:51 -0400)]
json::serialization: fix reading attributes from non-objects

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

7 years agoMerge: Tools use model index
Jean Privat [Fri, 26 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Merge: Tools use model index

Add `model_index` inside `model_view` so importing `model_index` automatically provide an index within the view. Also migrate documentation tools to model index.

### nitx

Model index is used to search mentities in commands (like `Array`, or `doc: Array`)
Improvement: nitx can no suggest entities if nothing was found.

### nitdoc

Model index is used to render doc commands in README files (like `[[list: Array]]`, or `[[graph: Array]]`)

Improvements:
* user can use `name` or `full_name` to locate entities
* nitdoc check and suggest errors
* nitdoc check and display short name conflicts

### nitweb

Model index is used to render doc down inputs and benefits now from the same improvements than nitdoc (but with a different implementation).

Futur PR will migrate the quick search engine.

Pull-Request: #2290
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: pipeline: Introduce `Iterator2`
Jean Privat [Fri, 26 Aug 2016 14:07:45 +0000 (10:07 -0400)]
Merge: pipeline: Introduce `Iterator2`

Add a generalization of `PipeJoin`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2292
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agogithumerge: skip if already merged
Jean Privat [Fri, 26 Aug 2016 00:20:52 +0000 (20:20 -0400)]
githumerge: skip if already merged

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agogithub_merge: accept more than one argument
Jean Privat [Fri, 26 Aug 2016 00:20:29 +0000 (20:20 -0400)]
github_merge: accept more than one argument

Signed-off-by: Jean Privat <jean@pryen.org>

7 years agopipeline: Introduce `Iterator2`
Jean-Christophe Beaupré [Thu, 25 Aug 2016 20:59:34 +0000 (16:59 -0400)]
pipeline: Introduce `Iterator2`

Add a generalization of `PipeJoin`.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

7 years agonitweb: doc_down use model_index
Alexandre Terrasa [Thu, 25 Aug 2016 19:14:04 +0000 (15:14 -0400)]
nitweb: doc_down use model_index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agosrc/model: remove useless services from model_view
Alexandre Terrasa [Thu, 25 Aug 2016 06:53:24 +0000 (02:53 -0400)]
src/model: remove useless services from model_view

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitdoc: use model index
Alexandre Terrasa [Thu, 25 Aug 2016 06:53:05 +0000 (02:53 -0400)]
nitdoc: use model index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitx: use model index
Alexandre Terrasa [Thu, 25 Aug 2016 06:52:42 +0000 (02:52 -0400)]
nitx: use model index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agosrc/model: associate model index and model view
Alexandre Terrasa [Thu, 25 Aug 2016 06:52:17 +0000 (02:52 -0400)]
src/model: associate model index and model view

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: Nitweb errors
Jean Privat [Thu, 25 Aug 2016 17:16:53 +0000 (13:16 -0400)]
Merge: Nitweb errors

Better error handling for the nitweb API:

* the API catches all unmatched `/api/*` requests and display a JSON error. Example here: http://nitweb.moz-code.org/api/foo
* better error messages (in JSON) for all API handlers. One example here: http://nitweb.moz-code.org/api/entity/foo

Also one change in the frontend that displays 404 not found pages: http://nitweb.moz-code.org/foo

Pull-Request: #2289
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: lib/github: make `PullRef::repo` nullable.
Jean Privat [Thu, 25 Aug 2016 17:16:50 +0000 (13:16 -0400)]
Merge: lib/github: make `PullRef::repo` nullable.

Since repos can be deleted, the reference can be null.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2288
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: lib/popcorn: introduce PopTracker
Jean Privat [Thu, 25 Aug 2016 13:21:21 +0000 (09:21 -0400)]
Merge: lib/popcorn: introduce PopTracker

## Popcorn web tracker

Easy and ready to use web tracker you can apply to your popcorn application.

The only thing you have to do is to use the tracker in your app routes:

~~~nit
var config = new AppConfig
var app = new App
app.use("/", new HomeHandler)
app.use("/products", new ProductsHandler)
app.use("customers/", new CustomersHandler)

app.use_after("/*", new PopTracker(config)) # tracker listens to /*
~~~

You can also use multiple tracker at once on different route.
All the data will be aggregated for you.

~~~nit
app.use_after("/api/*", new PopTracker(config))
app.use_after("/admin/*", new PopTracker(config))
~~~

To retrieve your tracker data use the `PopTrackerAPI` which serves the tracker
data in JSON format.

~~~nit
app.use("/api/tracker_data", new PopTrackerAPI(config))
~~~

Here some demo of what can be done when using the data:

![image](https://cloud.githubusercontent.com/assets/583144/17920422/67024ec2-69a2-11e6-912d-d3627a888fff.png)
![image](https://cloud.githubusercontent.com/assets/583144/17920427/702ef518-69a2-11e6-8e42-6461eeb405e5.png)
![image](https://cloud.githubusercontent.com/assets/583144/17920448/9219ee44-69a2-11e6-8b47-d7cd6929ce39.png)
![image](https://cloud.githubusercontent.com/assets/583144/17920464/aca53cdc-69a2-11e6-9118-5f7e8e205b3b.png)

More here: http://nitweb.moz-code.org/traffic

Pull-Request: #2286
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agonitweb: front end display 404 error
Alexandre Terrasa [Thu, 25 Aug 2016 04:48:31 +0000 (00:48 -0400)]
nitweb: front end display 404 error

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: catch 404 errors from /api/*
Alexandre Terrasa [Thu, 25 Aug 2016 04:45:03 +0000 (00:45 -0400)]
nitweb: catch 404 errors from /api/*

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: better error responses from API
Alexandre Terrasa [Thu, 25 Aug 2016 04:44:43 +0000 (00:44 -0400)]
nitweb: better error responses from API

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: merge ModelHandler and APIHandler
Alexandre Terrasa [Thu, 25 Aug 2016 04:43:15 +0000 (00:43 -0400)]
nitweb: merge ModelHandler and APIHandler

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: split APIRouter in modules
Alexandre Terrasa [Thu, 25 Aug 2016 04:36:22 +0000 (00:36 -0400)]
nitweb: split APIRouter in modules

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitweb: move catalog to config
Alexandre Terrasa [Thu, 25 Aug 2016 04:23:43 +0000 (00:23 -0400)]
nitweb: move catalog to config

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agolib/github: make `PullRef::repo` nullable.
Alexandre Terrasa [Thu, 25 Aug 2016 00:59:59 +0000 (20:59 -0400)]
lib/github: make `PullRef::repo` nullable.

Since repos can be deleted, the reference can be null.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: Model index
Jean Privat [Wed, 24 Aug 2016 18:02:48 +0000 (14:02 -0400)]
Merge: Model index

## Search things from the Model

ModelIndex allows you to index mentities then retrieve them by their `name`
or `full_name`.
It offers a set of `find_*` methods that can be used to match queries
against entities name.

Because each use is different, ModelIndex only provide base raw search services.
All of them return IndexMatches that can be ordered and filtered by the client.

## Indexing mentities

Before searching something from the ModelIndex, you have to index it.
Use the `ModelIndex::index` method to do that:

~~~nit
var index = new ModelIndex

for mentity in model.private_view.mentities do
index.index(mentity)
end
~~~

## Search mentities

You can then run queries on the ModelIndex:

~~~nit
for res in index.find("Array").limit(10) do
   print res
end
~~~

## Examples

Here some examples of how you can use the ModelIndex.

### Smart type prediction

Use ModelIndex to implement a smart prediction system based on the typed prefix:

~~~nit
var index = new ModelIndex

for mentity in model.private_view.mentities do
# We don't really care about definitions
if mentity isa MClassDef or mentity isa MPropDef then continue
index.index(mentity)
end

var typed_prefix = "Arr"
for res in index.find_by_name_prefix(typed_prefix).
uniq. # keep only the best ranked mentity
limit(5). # limit to ten results
sort(new VisibilityComparator, new NameComparator) do # order by visibility then name
   print res
end
~~~

Will output something like:

~~~raw
Array (1)
ArraySet (2)
ArrayMap (3)
ArrayCmp (4)
ArrayMapKeys (5)
~~~

### Method autocompletion

Find methods from a class full_name:

~~~nit
var class_full_name = "core::Array"
for res in index.find_by_full_name_prefix("{class_full_name}::").
uniq. # keep only the best ranked mentity
sort(new VisibilityComparator). # put private in the bottom of the list
limit(5). # limit to ten results
sort(new FullNameComparator) do # order by lexicographic order
   print res
end
~~~

Will output something like:

~~~raw
* (2)
+ (1)
filled_with (5)
from (3)
with_items (4)
~~~

### Name typo detection and suggestion

Detect unknown names and suggest corrections:

~~~nit
var name = "Zrray"

if index.find_by_name_prefix(name).is_empty then
printn "`{name}` not found, did you mean: "
printn index.find_by_name_similarity(name).sort(new ScoreComparator).limit(2).join(" or ")
print "?"
end
~~~

Will output something like:

~~~raw
`Zrray` not found, did you mean: Array (1) or array (1)?
~~~

The next version of Nitweb will use ModelIndex for the search field. Demo here: http://nitweb.moz-code.org/

Pull-Request: #2280
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agolib/popcorn: introduce PopTracker
Alexandre Terrasa [Thu, 18 Aug 2016 02:04:44 +0000 (22:04 -0400)]
lib/popcorn: introduce PopTracker

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agoMerge: modelize_property: Remove a unnecessary pre-condition
Jean Privat [Tue, 23 Aug 2016 13:37:46 +0000 (09:37 -0400)]
Merge: modelize_property: Remove a unnecessary pre-condition

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

Pull-Request: #2285
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agoMerge: nitunit: import frontend
Jean Privat [Tue, 23 Aug 2016 13:37:44 +0000 (09:37 -0400)]
Merge: nitunit: import frontend

So the tests can use annotations and other things introduced in compiler phases.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2283
Reviewed-by: Jean Privat <jean@pryen.org>

7 years agotests: test ModelIndex
Alexandre Terrasa [Mon, 22 Aug 2016 23:26:58 +0000 (19:26 -0400)]
tests: test ModelIndex

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

7 years agonitunit: import frontend
Alexandre Terrasa [Mon, 22 Aug 2016 18:20:57 +0000 (14:20 -0400)]
nitunit: import frontend

So the tests can use annotations and other things introduced in compiler phases.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>