From 851be237b3784929183811c31d3367a504800649 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Wed, 10 Feb 2016 10:45:24 +0100 Subject: [PATCH] New build system and release --- .gitignore | 1 + FlickrGallery.csproj | 3 +- Properties/AssemblyInfo.cs | 14 +-- gulpfile.js | 189 +++++++++++++++++++++++++++++++++++++ module.css | 44 +-------- package.json | 72 ++++++++++++++ 6 files changed, 272 insertions(+), 51 deletions(-) create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 7d89b37..a4a357c 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,4 @@ _References _Development _BuildSupport _Packages +node_modules diff --git a/FlickrGallery.csproj b/FlickrGallery.csproj index 7d22d6f..594a891 100644 --- a/FlickrGallery.csproj +++ b/FlickrGallery.csproj @@ -76,9 +76,10 @@ - + False _References\System.Net.Http.dll + False False diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 2b3a194..c731b84 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -4,12 +4,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("FlickrGallery")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyTitle("Flickr Gallery")] +[assembly: AssemblyDescription("Flickr Gallery module for DNN Platform")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("DNN Connect Association")] +[assembly: AssemblyCompany("DNN Connect")] [assembly: AssemblyProduct("FlickrGallery")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyCopyright("Copyright 2016 by DNN Connect")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -30,7 +30,7 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("02.00.00")] -[assembly: AssemblyFileVersion("02.00.00")] +[assembly: AssemblyVersion("2.1.0")] +[assembly: AssemblyFileVersion("2.1.0")] -[assembly: AssemblyInformationalVersion("02.00.00")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("02.01.00")] \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..dfd8464 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,189 @@ +var gulp = require('gulp'), + msbuild = require('gulp-msbuild'), + browserify = require('gulp-browserify'), + minifyCss = require('gulp-minify-css'), + uglify = require('gulp-uglify'), + assemblyInfo = require('gulp-dotnet-assembly-info'), + plumber = require('gulp-plumber'), + config = require('./package.json'), + zip = require('gulp-zip'), + filter = require('gulp-filter'), + merge = require('merge2'), + gutil = require('gulp-util'), + markdown = require('gulp-markdown'), + rename = require('gulp-rename'), + manifest = require('gulp-dnn-manifest'), + path = require('path'), + concat = require('gulp-concat'), + less = require('gulp-less'), + lessPluginCleanCSS = require('less-plugin-clean-css'), + cleancss = new lessPluginCleanCSS({ + advanced: true + }); + +gulp.task('less', function() { + return gulp.src('css/src/less/module.less') + .pipe(less({ + paths: [path.join(__dirname, 'less', 'includes')], + plugins: [cleancss] + })) + .pipe(gulp.dest('.')); +}); + +gulp.task('css', ['less'], function() { + return gulp.src('css/src/module.css') + .pipe(gulp.dest('.')); +}); + +gulp.task('watch', function() { + gulp.watch('css/src/**/*.less', ['css']); +}); + +gulp.task('assemblyInfo', function() { + return gulp + .src('**/AssemblyInfo.cs') + .pipe(assemblyInfo({ + title: config.dnnModule.friendlyName, + description: config.description, + version: config.version, + fileVersion: config.version, + company: config.dnnModule.owner.organization, + copyright: function(value) { + return 'Copyright ' + new Date().getFullYear() + ' by ' + config.dnnModule.owner.organization; + } + })) + .pipe(gulp.dest('.')); +}); + +gulp.task('build', ['assemblyInfo'], function() { + return gulp.src('./FlickrGallery.csproj') + .pipe(msbuild({ + toolsVersion: 14.0, + targets: ['Clean', 'Build'], + errorOnFail: true, + stdout: true, + properties: { + Configuration: 'Release', + OutputPath: config.dnnModule.pathToAssemblies + } + })); +}); + +gulp.task('packageInstall', ['build'], function() { + var packageName = config.dnnModule.fullName + '_' + config.version; + var dirFilter = filter(fileTest); + return merge( + merge( + gulp.src([ + 'App_LocalResources/*.resx', + '*.ascx', + 'Views/**/*.cshtml', + 'fonts/*.*' + ], { + base: '.' + }), + gulp.src([ + '**/*.html' + ], { + base: '.' + }) + .pipe(dirFilter), + gulp.src([ + 'css/*.png', + 'css/*.gif', + 'css/*.svg' + ], { + base: '.' + }), + gulp.src([ + '*.png' + ], { + base: '.' + }), + gulp.src([ + '**/*.txt' + ], { + base: '.' + }) + .pipe(dirFilter), + gulp.src(['*.css', 'css/*.css'], { + base: '.' + }) + .pipe(minifyCss()) + .pipe(dirFilter), + gulp.src(['js/*.js', '!js/*.min.js'], { + base: '.' + }) + .pipe(uglify().on('error', gutil.log)), + gulp.src(['js/*.min.js'], { + base: '.' + }) + ) + .pipe(zip('Resources.zip')), + gulp.src(config.dnnModule.pathToSupplementaryFiles + '/*.dnn') + .pipe(manifest(config)), + gulp.src([config.dnnModule.pathToAssemblies + '/*.dll', + config.dnnModule.pathToScripts + '/*.SqlDataProvider', + config.dnnModule.pathToSupplementaryFiles + '/License.txt', + config.dnnModule.pathToSupplementaryFiles + '/ReleaseNotes.txt' + ]), + gulp.src(config.dnnModule.pathToSupplementaryFiles + '/ReleaseNotes.md') + .pipe(markdown()) + .pipe(rename('ReleaseNotes.txt')) + ) + .pipe(zip(packageName + '_Install.zip')) + .pipe(gulp.dest(config.dnnModule.packagesPath)); +}); + +gulp.task('packageSource', ['build'], function() { + var packageName = config.dnnModule.fullName + '_' + config.version; + var dirFilter = filter(fileTest); + return merge( + gulp.src(['**/*.html', + '**/*.png', + '**/*.gif', + '**/*.css', + 'js/**/*.js', + '**/*.??proj', + '**/*.sln', + '**/*.json', + '**/*.cs', + '**/*.vb', + '**/*.resx', + '**/*.ascx', + '**/*.cshtml', + '**/*.less', + 'fonts/*.*', + config.dnnModule.pathToSupplementaryFiles + '**/*.*' + ], { + base: '.' + }) + .pipe(dirFilter) + .pipe(zip('Resources.zip')), + gulp.src(config.dnnModule.pathToSupplementaryFiles + '/*.dnn') + .pipe(manifest(config)), + gulp.src([config.dnnModule.pathToAssemblies + '/*.dll', + config.dnnModule.pathToScripts + '/*.SqlDataProvider', + config.dnnModule.pathToSupplementaryFiles + '/License.txt', + config.dnnModule.pathToSupplementaryFiles + '/ReleaseNotes.txt' + ]) + ) + .pipe(zip(packageName + '_Source.zip')) + .pipe(gulp.dest(config.dnnModule.packagesPath)); +}) + +gulp.task('package', ['packageInstall', 'packageSource'], function() { + return null; +}) + +function fileTest(file) { + var res = false; + for (var i = config.dnnModule.excludeFilter.length - 1; i >= 0; i--) { + res = res | file.relative.startsWith(config.dnnModule.excludeFilter[i]) | file.relative.indexOf('/obj/') > -1; + }; + return !res; +} + +function startsWith(str, strToSearch) { + return str.indexOf(strToSearch) === 0; +} \ No newline at end of file diff --git a/module.css b/module.css index 0aac96c..d4b1956 100644 --- a/module.css +++ b/module.css @@ -1,43 +1 @@ -.cfg-gallery figure { - display: inline-block; - padding: 15px; -} -.cfg-gallery figure a img { - border-radius: 10px; -} - -.cfg-albums { - width: 100%; -} - -.cfg-album-title { - padding-left: 15px; - border-bottom: 1px dotted #808080; -} -.cfg-album-title a, .cfg-album-title a:hover { - text-decoration: none; -} -.cfg-album-title a:hover { - color: #000; -} -.cfg-album { - display: inline-block; - padding: 15px; - width: 180px; - height: 240px; - overflow: hidden; -} - - .cfg-album a { - display: block; - } - - .cfg-album a img { - border-radius: 10px; - } - - .cfg-album span { - font-size: small; - display: block; - margin-top: 5px; - } +.cfg-album,.cfg-gallery figure{display:inline-block;padding:15px}.cfg-album a img,.cfg-gallery figure a img{border-radius:10px}.cfg-albums{width:100%}.cfg-album-title{padding-left:15px;border-bottom:1px dotted grey}.cfg-album-title a,.cfg-album-title a:hover{text-decoration:none}.cfg-album-title a:hover{color:#000}.cfg-album{width:180px;height:240px;overflow:hidden}.cfg-album a{display:block}.cfg-album span{font-size:small;display:block;margin-top:5px} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..6a92518 --- /dev/null +++ b/package.json @@ -0,0 +1,72 @@ +{ + "name": "flickrgallery", + "version": "2.1.0", + "description": "Flickr Gallery module for DNN Platform", + "dnnModule": { + "fullName": "Connect_FlickrGallery", + "friendlyName": "Flickr Gallery", + "packageName": "FlickrGallery", + "owner": { + "name": "Peter Donker", + "organization": "DNN Connect", + "url": "http://dnn-connect.org", + "email": "peter@bring2mind.net" + }, + "module": { + "packageName": "Connect_FlickrGallery", + "folderName": "Connect/FlickrGallery", + "azureCompatible": "true", + "iconFile": "DesktopModules\\Connect\\FlickrGallery\\FlickrGallery.png" + }, + "tempPath": "./package", + "packagesPath": "./_Packages", + "pathToAssemblies": "./bin", + "pathToScripts": "./_Installation/SQL2005", + "pathToSupplementaryFiles": "./_Installation", + "excludeFilter": [ + "_Development", + "bower_components", + "node_modules", + "bin", + "obj", + "_Packages", + "_Installation" + ] + }, + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/DNN-Connect/FlickrGallery.git" + }, + "author": "Peter Donker (http://www.bring2mind.net)", + "license": "MIT", + "bugs": { + "url": "https://github.com/DNN-Connect/FlickrGallery/issues" + }, + "homepage": "https://github.com/DNN-Connect/FlickrGallery#readme", + "devDependencies": { + "browserify": "^12.0.1", + "gulp": "^3.9.0", + "gulp-browserify": "^0.5.1", + "gulp-concat": "^2.6.0", + "gulp-dnn-manifest": "^0.1.0", + "gulp-dotnet-assembly-info": "^0.1.11", + "gulp-filter": "^3.0.1", + "gulp-less": "^3.0.4", + "gulp-markdown": "^1.1.0", + "gulp-minify-css": "^1.2.1", + "gulp-msbuild": "^0.2.13", + "gulp-plumber": "^1.0.1", + "gulp-react": "^3.0.1", + "gulp-rename": "^1.2.2", + "gulp-uglify": "^1.5.1", + "gulp-util": "^3.0.6", + "gulp-zip": "^3.0.2", + "less-plugin-clean-css": "^1.5.1", + "merge2": "^0.3.6", + "path": "^0.12.7" + } +}