From bbe7ae9ca6ac3f608652a95d107a9a63c2f66cd1 Mon Sep 17 00:00:00 2001 From: Petherson Moreno Date: Mon, 20 Nov 2017 08:23:25 -0200 Subject: [PATCH] Added command php-server:start-public to start server in folder public It's usefull to use in frameworks like Laravel --- README.md | 1 + lib/php-server.coffee | 5 +++++ menus/php-server.cson | 1 + package.json | 5 ++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14effdc..5b6ceb1 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ If `php` is not in your system PATH you will need to put in the full path to you ## Commands * `php-server:start` — Start / Restart PHP server from project path +* `php-server:start-public` — Start / Restart PHP server from folder public in project path * `php-server:start-tree` — Start / Restart PHP server from folder/file selected in tree * `php-server:start-document` — Start / Restart PHP server from currently open file * `php-server:stop` — Stop running PHP server diff --git a/lib/php-server.coffee b/lib/php-server.coffee index e851a62..6819156 100644 --- a/lib/php-server.coffee +++ b/lib/php-server.coffee @@ -48,6 +48,7 @@ module.exports = activate: -> atom.commands.add 'atom-workspace', "php-server:start", => @start() + atom.commands.add 'atom-workspace', "php-server:start-public", => @startPublic() atom.commands.add 'atom-workspace', "php-server:start-tree", => @startTree() atom.commands.add 'atom-workspace', "php-server:start-tree-route", => @startTreeRoute() atom.commands.add 'atom-workspace', "php-server:start-document", => @startDocument() @@ -59,6 +60,10 @@ module.exports = @stop() + startPublic: -> + documentroot = atom.project.getPaths()[0]+"/public" + @start documentroot + startTree: -> @start atom.packages.getLoadedPackage('tree-view').mainModule.treeView.selectedPath diff --git a/menus/php-server.cson b/menus/php-server.cson index f35a3e0..5b7d467 100644 --- a/menus/php-server.cson +++ b/menus/php-server.cson @@ -17,6 +17,7 @@ label: 'PHP Server', submenu: [ { label: 'Start in project root', command: 'php-server:start' } + { label: 'Start in folder public in project root', command: 'php-server:start-public' } { label: 'Start in folder selected in tree', command: 'php-server:start-tree' } { label: 'Start in folder of current file', command: 'php-server:start-document' } ] diff --git a/package.json b/package.json index 8fa3231..028e612 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "version": "0.8.0", "description": "Run a local PHP server from within Atom, displaying the log in a bottom panel", "activationCommands": { - "atom-workspace": "php-server:start", + "atom-workspace": [ + "php-server:start", + "php-server:start-public" + ], ".tree-view": [ "php-server:start-tree", "php-server:start-tree-route"