Ver código fonte

refactor: update for Invercargill 1.x

- Update dependencies to versioned library names (libinvercargill-1.so, invercargill-1.pc)
- Split stringify method into stringify() and stringify_pretty() for cleaner API
- Fix interface ordering in JsonElementsPromotionImplementation
- Enable ninjaStyleProgress build flag
Billy Barrow 1 mês atrás
pai
commit
50a68510fc
4 arquivos alterados com 12 adições e 8 exclusões
  1. 3 3
      MANIFEST.usm
  2. 2 2
      src/lib/Elements.vala
  3. 6 2
      src/lib/Json.vala
  4. 1 1
      src/lib/Jsonl.vala

+ 3 - 3
MANIFEST.usm

@@ -3,7 +3,7 @@
   "version": "0.0.1",
   "summary": "Json support for Invercargill",
   "licences": [ {"name": "LGPLv3", "category": "libre", "text": "LICENSE"} ],
-  "flags": [],
+  "flags": ["ninjaStyleProgress"],
   "provides": {
     "lib:libinvercargill-json.so": "as-expected",
     "inc:invercargill-json.h": "as-expected",
@@ -14,7 +14,7 @@
   },
   "depends": {
     "runtime": [
-      "lib:libinvercargill.so",
+      "lib:libinvercargill-1.so",
       "lib:libglib-2.0.so.0",
       "lib:libgobject-2.0.so.0",
       "lib:libgee-0.8.so.2",
@@ -38,7 +38,7 @@
       "pc:gio-2.0.pc",
       "pc:gee-0.8.pc",
       "pc:json-glib-1.0.pc",
-      "pc:invercargill.pc"
+      "pc:invercargill-1.pc"
     ],
     "manage": [
       "bin:bash"

+ 2 - 2
src/lib/Elements.vala

@@ -40,7 +40,7 @@ namespace InvercargillJson {
 
     }
 
-    private class JsonElementsPromotionImplementation : StickyProxyPromotion<JsonElements, JsonElement>, JsonElements, Elements {
+    private class JsonElementsPromotionImplementation : StickyProxyPromotion<JsonElements, JsonElement>, Elements, JsonElements {
         public override bool can_wrap(GLib.Type element_type) {
             return element_type.is_a(typeof(JsonElement));
         }
@@ -55,4 +55,4 @@ namespace InvercargillJson {
 
 
 
-}
+}

+ 6 - 2
src/lib/Json.vala

@@ -311,8 +311,12 @@ namespace InvercargillJson {
             return typeof(Json.Node);
         }
 
-        public string stringify(bool pretty = false) {
-            return Json.to_string (node, pretty);
+        public string stringify() {
+            return Json.to_string (node, false);
+        }
+
+        public string stringify_pretty() {
+            return Json.to_string (node, true);
         }
 
         public void write_to_stream(OutputStream stream) throws Error {

+ 1 - 1
src/lib/Jsonl.vala

@@ -68,7 +68,7 @@ namespace InvercargillJson {
 
         public void write(Element element) throws Error {
             var json_element = (element is JsonElement) ? (JsonElement)element : new JsonElement.from_element(element);
-            base_stream.put_string(json_element.stringify(false) + "\n");
+            base_stream.put_string(json_element.stringify() + "\n");
         }
 
         public void write_all(Enumerable<Element> elements) throws Error {