Commit f9896e22915dca0f7edf096391b452ad682b72c2

Authored by Carlos Coêlho
1 parent dce2b87d

Refactoring build task

Signed-off-by: Carlos Coêlho <carlospecter@gmail.com>
Signed-off-by: Arthur Jahn <stutrzbecher@gmail.com>
@@ -3,10 +3,13 @@ @@ -3,10 +3,13 @@
3 var path = require('path'); 3 var path = require('path');
4 var gulp = require('gulp'); 4 var gulp = require('gulp');
5 var rename = require('gulp-rename'); 5 var rename = require('gulp-rename');
  6 +var insert = require('gulp-insert');
6 var merge = require('merge-stream'); 7 var merge = require('merge-stream');
7 var conf = require('./conf'); 8 var conf = require('./conf');
8 9
9 -var noosferoThemePrefix = path.join("/designs/themes/angular-theme", conf.paths.dist, '/'); 10 +var themeName = conf.paths.theme.replace('-', ' ');
  11 +themeName = themeName.charAt(0).toUpperCase() + themeName.slice(1);
  12 +var noosferoThemePrefix = path.join("/designs/themes/", conf.paths.theme, '/');
10 13
11 var $ = require('gulp-load-plugins')({ 14 var $ = require('gulp-load-plugins')({
12 pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del'] 15 pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
@@ -114,17 +117,18 @@ gulp.task(&#39;other&#39;, function () { @@ -114,17 +117,18 @@ gulp.task(&#39;other&#39;, function () {
114 }); 117 });
115 118
116 gulp.task('clean', function () { 119 gulp.task('clean', function () {
117 - return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]); 120 + return $.del(["dist", path.join(conf.paths.tmp, '/')]);
118 }); 121 });
119 122
120 gulp.task('clean-docs', [], function() { 123 gulp.task('clean-docs', [], function() {
121 - return $.del([path.join(conf.paths.docs, '/')]); 124 + return $.del([path.join(conf.paths.docs, '/')]);
122 }); 125 });
123 126
124 gulp.task('noosfero', ['html'], function () { 127 gulp.task('noosfero', ['html'], function () {
125 var layouts = gulp.src('layouts/**/*') 128 var layouts = gulp.src('layouts/**/*')
126 .pipe(gulp.dest(path.join(conf.paths.dist, "layouts"))); 129 .pipe(gulp.dest(path.join(conf.paths.dist, "layouts")));
127 var theme = gulp.src('theme.yml') 130 var theme = gulp.src('theme.yml')
  131 + .pipe(insert.prepend('name: "' + themeName + '"\n'))
128 .pipe(gulp.dest(conf.paths.dist)); 132 .pipe(gulp.dest(conf.paths.dist));
129 var index = gulp.src(path.join(conf.paths.dist, 'index.html')) 133 var index = gulp.src(path.join(conf.paths.dist, 'index.html'))
130 .pipe(rename('index.html.erb')) 134 .pipe(rename('index.html.erb'))
@@ -22,7 +22,7 @@ exports.paths = { @@ -22,7 +22,7 @@ exports.paths = {
22 themes: 'themes' 22 themes: 'themes'
23 }; 23 };
24 exports.configTheme = function(theme) { 24 exports.configTheme = function(theme) {
25 - exports.paths.theme = path.join(exports.paths.themes, theme || "default"); 25 + exports.paths.theme = theme || "angular-default";
26 exports.paths.allSources = [exports.paths.src, exports.paths.theme]; 26 exports.paths.allSources = [exports.paths.src, exports.paths.theme];
27 exports.paths.dist = path.join("dist", exports.paths.theme); 27 exports.paths.dist = path.join("dist", exports.paths.theme);
28 } 28 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 "ng-forward": "0.0.1-alpha.12" 8 "ng-forward": "0.0.1-alpha.12"
9 }, 9 },
10 "config": { 10 "config": {
11 - "theme": "default" 11 + "theme": "angular-default"
12 }, 12 },
13 "scripts": { 13 "scripts": {
14 "build": "webpack; gulp clean && gulp --theme=$npm_package_config_theme build", 14 "build": "webpack; gulp clean && gulp --theme=$npm_package_config_theme build",
@@ -46,6 +46,7 @@ @@ -46,6 +46,7 @@
46 "gulp-eslint": "~1.0.0", 46 "gulp-eslint": "~1.0.0",
47 "gulp-filter": "~3.0.1", 47 "gulp-filter": "~3.0.1",
48 "gulp-flatten": "~0.2.0", 48 "gulp-flatten": "~0.2.0",
  49 + "gulp-insert": "^0.5.0",
49 "gulp-inject": "~3.0.0", 50 "gulp-inject": "~3.0.0",
50 "gulp-load-plugins": "~0.10.0", 51 "gulp-load-plugins": "~0.10.0",
51 "gulp-minify-css": "~1.2.1", 52 "gulp-minify-css": "~1.2.1",
1 -name: "Angular theme"  
2 layout: "angular-layout" 1 layout: "angular-layout"
3 icon_theme: [default, pidgin] 2 icon_theme: [default, pidgin]
themes/angular-default/.keep 0 → 100644
themes/default/.keep