From af36f4c418de39bbbca2fcadcb9cd8690c9b8894 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.silence@gmail.com> Date: Thu, 27 Aug 2015 07:55:50 +0300 Subject: [PATCH] Deployment changes -- remove gulp global install (need sudo) -- add drop\create database -- fix folder creation problem --- Makefile | 2 +- db/Makefile | 13 ++++++++++--- gulpfile.js | 23 +++++++++++++++-------- package.json | 17 +++++------------ 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 1cf5c979d..0953bd185 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ deploy: DB_deploy Tasker_deploy Tasker_run Tasker_install: Tasker_deploy - npm install -g gulp + @ Tasker_deploy: npm install diff --git a/db/Makefile b/db/Makefile index c3dec2ace..28e2f4596 100644 --- a/db/Makefile +++ b/db/Makefile @@ -3,13 +3,16 @@ $(subst .sql, , $(wildcard $1/*.sql)) endef -USER := $(shell bash -c 'read -p "Username: " pwd; echo $$username') +USER := $(shell bash -c 'read -p "Username: " username; echo $$username') PASS := $(shell bash -c 'read -s -p "Password: " pwd; echo $$pwd') DB := mmcs_rating +default: deploy + @ - -install: $(call GET_NAMES, structure) \ +install: \ +clear \ +$(call GET_NAMES, structure) \ $(call GET_NAMES, data) \ $(call GET_NAMES, constraints) \ deploy @@ -18,6 +21,10 @@ deploy deploy: $(call GET_NAMES, stored) @ +clear: + yes | mysqladmin -u $(USER) $(PASS) drop $(DB) || true + mysqladmin -u $(USER) $(PASS) create $(DB); + %: mysql -u $(USER) $(PASS) $(DB) < $@.sql diff --git a/gulpfile.js b/gulpfile.js index 791550e45..6cc35efac 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -144,7 +144,7 @@ var constructTask = function (config) { lazypipe().pipe(changed, config.dst, ext) : empty; - gulp.src(config.src) + return gulp.src(config.src) .pipe(chgPipe()) .pipe(midPipe()) .on('error', errorHandler) @@ -165,19 +165,19 @@ var constructWatch = function (config) { gulp.task('less:compile', function () { - constructTask(getConfig('less')); + return constructTask(getConfig('less')); }); gulp.task('css:copy', function () { - constructTask(getConfig('css')); + return constructTask(getConfig('css')); }); gulp.task('js:copy', function () { - constructTask(getConfig('js')); + return constructTask(getConfig('js')); }); gulp.task('config:copy', function () { - constructTask({ + return constructTask({ src: paths.src.config, dst: paths.dst.config }); @@ -185,7 +185,7 @@ gulp.task('config:copy', function () { gulp.task('components:copy', function () { constructTask(getConfig('css_components')); - constructTask(getConfig('js_components')); + return constructTask(getConfig('js_components')); }); @@ -196,11 +196,18 @@ gulp.task('folders:create', function () { var dirs = [ app + '/logs/', + app + '/static/', app + '/static/components/' ]; - dirs.forEach(function (i) { - fs.mkdir(dirs[i]); + dirs.forEach(function (dir) { + try { + fs.mkdirSync(dir); + } catch (err) { + if (err.code !== 'EEXIST') { + throw err; + } + } }); }); diff --git a/package.json b/package.json index cb880ac7c..c405bdd27 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { - "name": "gulp", - "version": "1.0.0", - "description": "", - "main": "gulpfile.js", - "dependencies": { + "name": "GradeRatingSystem", + "version": "0.0.0", + "dependencies": {}, + "devDependencies": { "gulp": "^3.9.0", "gulp-changed": "^1.2.1", "gulp-autoprefixer": "^2.3.1", @@ -15,11 +14,5 @@ "lazypipe": "^1.0.1", "gulp-uglify": "^1.2.0", "minimist": "^1.1.1" - }, - "devDependencies": {}, - "scripts": { - "test": "gulp" - }, - "author": "", - "license": "ISC" + } } -- GitLab