From 038d1f6fb9f206eb2d5f0f98dd827f049e64e0cd Mon Sep 17 00:00:00 2001 From: default0 Date: Thu, 28 Jan 2016 17:03:42 +0100 Subject: [PATCH] Add vibe.d project template --- src/dlangide/ui/newproject.d | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/dlangide/ui/newproject.d b/src/dlangide/ui/newproject.d index e843e31..e42b0c9 100644 --- a/src/dlangide/ui/newproject.d +++ b/src/dlangide/ui/newproject.d @@ -392,6 +392,8 @@ class NewProjectDlg : Dialog { SOURCE_CODE_HELLOWORLD, false); _templates ~= new ProjectTemplate("DlangUI: hello world app"d, "Hello world application\nbased on DlangUI library"d, "app.d", SOURCE_CODE_DLANGUI_HELLOWORLD, false, DUB_JSON_DLANGUI_HELLOWORLD); + _templates ~= new ProjectTemplate("vibe.d: Hello world app"d, "Hello world application\nbased on vibe.d framework"d, "app.d", + SOURCE_CODE_VIBED_HELLOWORLD, false, DUB_JSON_VIBED_HELLOWORLD); _templates ~= new ProjectTemplate("Empty app project"d, "Empty application project.\nNo source files."d, null, null, false); _templates ~= new ProjectTemplate("Empty library project"d, "Empty library project.\nNo Source files."d, null, null, true); } @@ -406,6 +408,34 @@ void main(string[] args) { } }; +immutable string SOURCE_CODE_VIBED_HELLOWORLD = q{ +import vibe.d; + +shared static this() +{ + auto settings = new HTTPServerSettings; + settings.port = 8080; + + listenHTTP(settings, &handleRequest); +} + +void handleRequest(HTTPServerRequest req, + HTTPServerResponse res) +{ + if (req.path == "/") + res.writeBody("Hello, World!", "text/plain"); +} +}; + +immutable string DUB_JSON_VIBED_HELLOWORLD = q{ +{ + "dependencies": { + "vibe-d": "~>0.7.26" + }, + "versions": ["VibeDefaultMain"] +} +}; + immutable string SOURCE_CODE_DLANGUI_HELLOWORLD = q{ import dlangui;