This repository has been archived by the owner on Apr 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
111 lines (102 loc) · 3.49 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-dotnet-assembly-info');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-nuget');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-umbraco-package');
// Load the package JSON file
var pkg = grunt.file.readJSON('package.json');
// get the root path of the project
var projectRoot = 'src/' + pkg.name + '/';
// Load information about the assembly
var assemblyinfo = {
options: {
// Can be solutions, projects or individual assembly info files
files: ['src/' + pkg.name + '/Properties/AssemblyInfo.cs'],
// Standard assembly info
info: {
title: pkg.name,
description: pkg.description,
configuration: 'Release',
company: "",
product: pkg.name,
copyright: pkg.license,
trademark: '',
culture: 'en-US',
version: function (value) {
// If no value is returned the assembly version will not be modified
},
fileVersion: pkg.version
}
}
}
// Get the version of the package
var version = pkg.version;
grunt.initConfig({
pkg: pkg,
clean: {
temp: ['temp/*']
},
copy: {
release: {
files: [
{
expand: true,
cwd: projectRoot + 'bin/Release/',
src: [
pkg.name + '.dll',
pkg.name + '.xml'
],
dest: 'temp/bin/'
},
{
expand: true,
cwd: projectRoot + 'bin/Release/',
src: [
'App_Plugins/**',
],
dest: 'temp/'
}
]
}
},
assemblyinfo: assemblyinfo,
nugetpack: {
release: {
src: 'src/' + pkg.name + '/' + pkg.name + '.csproj',
dest: 'dist/nuget/'
}
},
zip: {
github: {
cwd: 'temp/',
src: [
'temp/**/*.*'
],
dest: 'dist/github/' + pkg.name + '.' + version + '.zip'
}
},
umbracoPackage: {
release: {
src: 'temp/',
dest: 'dist/umbraco',
options: {
name: pkg.name,
version: version,
url: pkg.homepage,
license: pkg.license,
licenseUrl: pkg.licenseUrl,
author: pkg.author.name,
authorUrl: pkg.author.url,
readme: pkg.readme,
outputName: pkg.name + '.' + version + '.zip'
}
}
}
});
grunt.registerTask("nuget", ['assemblyinfo', 'copy', 'nugetpack']);
grunt.registerTask("github", ['clean', 'copy', 'zip:github']);
grunt.registerTask("umbraco", ['clean', 'copy', 'umbracoPackage']);
grunt.registerTask('default', ['nuget', 'github', 'umbraco']);
}