src/doc/commands: clean commands modules importation
[nit.git] / src / catalog / catalog_json.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Translate catalog entities to JSON
16 module catalog_json
17
18 import catalog
19
20 redef class MPackageMetadata
21 serialize
22
23 redef fun core_serialize_to(v) do
24 super
25 v.serialize_attribute("license", license)
26 v.serialize_attribute("maintainers", maintainers)
27 v.serialize_attribute("contributors", contributors)
28 v.serialize_attribute("tags", tags)
29 v.serialize_attribute("tryit", tryit)
30 v.serialize_attribute("apk", apk)
31 v.serialize_attribute("homepage", homepage)
32 v.serialize_attribute("browse", browse)
33 v.serialize_attribute("git", git)
34 v.serialize_attribute("issues", issues)
35 v.serialize_attribute("first_date", first_date)
36 v.serialize_attribute("last_date", last_date)
37 end
38 end
39
40 # Catalog statistics
41 redef class CatalogStats
42 serialize
43
44 redef fun core_serialize_to(v) do
45 super
46 v.serialize_attribute("packages", packages)
47 v.serialize_attribute("maintainers", maintainers)
48 v.serialize_attribute("contributors", contributors)
49 v.serialize_attribute("tags", tags)
50 v.serialize_attribute("modules", modules)
51 v.serialize_attribute("classes", classes)
52 v.serialize_attribute("methods", methods)
53 v.serialize_attribute("loc", loc)
54 end
55 end
56
57 # MPackage statistics for the catalog
58 redef class MPackageStats
59 serialize
60
61 redef fun core_serialize_to(v) do
62 super
63 v.serialize_attribute("mmodules", mmodules)
64 v.serialize_attribute("mclasses", mclasses)
65 v.serialize_attribute("mmethods", mmethods)
66 v.serialize_attribute("loc", loc)
67 v.serialize_attribute("errors", errors)
68 v.serialize_attribute("warnings", warnings)
69 v.serialize_attribute("warnings_per_kloc", warnings_per_kloc)
70 v.serialize_attribute("documentation_score", documentation_score)
71 v.serialize_attribute("commits", commits)
72 v.serialize_attribute("score", score)
73 end
74 end
75
76 redef class Person
77 serialize
78
79 redef fun core_serialize_to(v) do
80 super
81 v.serialize_attribute("name", name)
82 v.serialize_attribute("email", email)
83 v.serialize_attribute("gravatar", gravatar)
84 end
85 end