Open project in default browser

This commit is contained in:
brunosimon
2016-11-20 23:14:06 +01:00
parent b9f9aa98ff
commit 1993782e32
4 changed files with 19 additions and 10 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
'use strict' 'use strict'
let Keppler = require( './keppler.class.js' ), let Keppler = require( './keppler.class.js' ),
keppler = new Keppler(); keppler = new Keppler()
+1
View File
@@ -28,6 +28,7 @@
"ip": "^1.1.3", "ip": "^1.1.3",
"mime": "^1.3.4", "mime": "^1.3.4",
"minimatch": "^3.0.3", "minimatch": "^3.0.3",
"opener": "^1.4.2",
"pug": "^2.0.0-beta4", "pug": "^2.0.0-beta4",
"slug": "^0.9.1", "slug": "^0.9.1",
"socket.io": "^1.4.6", "socket.io": "^1.4.6",
+9 -1
View File
@@ -10,7 +10,8 @@ let express = require( 'express' ),
util = require( 'util' ), util = require( 'util' ),
path = require( 'path' ), path = require( 'path' ),
Projects = require( './models/projects.class.js' ), Projects = require( './models/projects.class.js' ),
fs = require( 'fs' ) fs = require( 'fs' ),
opener = require( 'opener' )
/** /**
* Site class * Site class
@@ -258,6 +259,13 @@ class Site
{ {
project = this.projects.create_project( data.name ) project = this.projects.create_project( data.name )
let url = this.options.domain + '/project/' + project.slug
console.log( 'server'.green.bold + ' - ' + url .cyan )
// Open in browser
opener( url )
// Debug // Debug
if( this.options.debug ) if( this.options.debug )
{ {
+8 -8
View File
@@ -96,13 +96,13 @@ class Watcher
mime_type = mime.lookup( relative_path ), mime_type = mime.lookup( relative_path ),
file = {} file = {}
file.path = relative_path; file.path = relative_path
file.can_read = true; file.can_read = true
// Test mime type // Test mime type
if( mime_type.match(/^(audio)|(video)|(image)/) ) if( mime_type.match(/^(audio)|(video)|(image)/) )
{ {
file.can_read = false; file.can_read = false
} }
// Test exclusion // Test exclusion
@@ -114,7 +114,7 @@ class Watcher
// Match excluded path // Match excluded path
if( minimatch( relative_path, _exclude ) ) if( minimatch( relative_path, _exclude ) )
return; return
} }
// Retrieve stats // Retrieve stats
@@ -150,13 +150,13 @@ class Watcher
mime_type = mime.lookup( relative_path ), mime_type = mime.lookup( relative_path ),
file = {} file = {}
file.path = relative_path; file.path = relative_path
file.can_read = true; file.can_read = true
// Test mime type // Test mime type
if( mime_type.match(/^(audio)|(video)|(image)/) ) if( mime_type.match(/^(audio)|(video)|(image)/) )
{ {
file.can_read = false; file.can_read = false
} }
// Test exclusion // Test exclusion
@@ -168,7 +168,7 @@ class Watcher
// Match excluded path // Match excluded path
if( minimatch( relative_path, _exclude ) ) if( minimatch( relative_path, _exclude ) )
return; return
} }
// Retrieve stats // Retrieve stats