Last active
August 23, 2016 12:39
-
-
Save ransico/8cfecda95c6b4a28a854d2b6d780c5ec to your computer and use it in GitHub Desktop.
API Blueprint to SpringMVC Sample Gruntfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyMavenModule/ | |
api-docs/ | |
dist/ | |
lib/ | |
node_modules/ | |
src/ | |
tst/ | |
Gruntfile.js | |
package.json | |
src/main/java/com/mycompany/integration/rest/ | |
model/ | |
controller/ | |
service/ | |
pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
'use strict'; | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
aglio: { | |
'all': { | |
'files': { 'dist/index.html': ['src/index.apib'] }, | |
'options': { | |
'theme': 'default', | |
'themeVariables': 'slate', | |
'separator': '\\n', | |
'includePath': 'src' | |
} | |
} | |
}, | |
watch: { | |
'aglio': { | |
'files': [ | |
'src/**/*.apib', | |
'src/**/*.md', | |
'src/**/*.json' | |
], | |
'tasks': ['aglio'], | |
'options': { 'livereload': '<%= connect.options.livereload %>' } | |
} | |
}, | |
connect: { | |
options: { | |
port: 9000, | |
hostname: 'localhost', | |
livereload: 35729 | |
}, | |
livereload: { | |
options: { | |
open: false, | |
base: 'dist' | |
} | |
} | |
}, | |
apibspringmvc: { | |
index: { | |
options: { | |
// includePath is used by the special 'include' syntax within an apib file. | |
// This option specifies where to look for includable the apib files, relative to Gruntfile | |
includePath: 'src', | |
packagePrefix: 'com.mycompany.integration.rest', | |
extraImports: ['com.mycompany.integration.rest.model.response.*','com.mycompany.integration.rest.model.request.*', 'java.util.List', 'java.util.Collection'], | |
skipModelNames: ['ReadSingleResponse', 'ReadListResponse', 'OperationResponse', 'FilterableRequest', 'Long', 'ProvidedObject', 'Collection'], | |
flattenParentClasses: false | |
}, | |
files: { | |
// A map of destination directory -> source APIB files. Both are relative to the Gruntfile location. | |
'../src/main/java/com/mycompany/integration/rest': ['src/*.apib'] | |
} | |
} | |
} | |
}); | |
grunt.registerTask('build', ['aglio', 'apibspringmvc']); | |
grunt.registerTask('serve', [ | |
'build', | |
'connect:livereload', | |
'watch' | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment