Skip to content

Commit 15afbcf

Browse files
committed
added emitting version into swagger-ui.js file
1 parent 34ab47e commit 15afbcf

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Cakefile

+12-9
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,27 @@ task 'dist', 'Build a distribution', ->
6565
throw err if err
6666
fs.unlink 'dist/_swagger-ui.coffee'
6767
console.log ' : Combining with javascript...'
68-
exec 'cat src/main/javascript/doc.js dist/_swagger-ui-templates.js dist/_swagger-ui.js > dist/swagger-ui.js', (err, stdout, stderr) ->
69-
throw err if err
70-
fs.unlink 'dist/_swagger-ui.js'
71-
fs.unlink 'dist/_swagger-ui-templates.js'
72-
console.log ' : Minifying all...'
73-
exec 'java -jar "./bin/yuicompressor-2.4.7.jar" --type js -o ' + 'dist/swagger-ui.min.js ' + 'dist/swagger-ui.js', (err, stdout, stderr) ->
68+
69+
fs.readFile 'package.json', 'utf8', (err, fileContents) ->
70+
obj = JSON.parse(fileContents)
71+
exec 'echo "// swagger-ui.js" > dist/swagger-ui.js'
72+
exec 'echo "// version ' + obj.version + '" >> dist/swagger-ui.js'
73+
exec 'cat src/main/javascript/doc.js dist/_swagger-ui-templates.js dist/_swagger-ui.js >> dist/swagger-ui.js', (err, stdout, stderr) ->
7474
throw err if err
75-
lessc()
75+
fs.unlink 'dist/_swagger-ui.js'
76+
fs.unlink 'dist/_swagger-ui-templates.js'
77+
console.log ' : Minifying all...'
78+
exec 'java -jar "./bin/yuicompressor-2.4.7.jar" --type js -o ' + 'dist/swagger-ui.min.js ' + 'dist/swagger-ui.js', (err, stdout, stderr) ->
79+
throw err if err
80+
lessc()
7681

7782
lessc = ->
7883
# Someone who knows CoffeeScript should make this more Coffee-licious
7984
console.log ' : Compiling LESS...'
8085

8186
less.render fs.readFileSync("src/main/less/screen.less", 'utf8'), (err, css) ->
82-
console.log err
8387
fs.writeFileSync("src/main/html/css/screen.css", css)
8488
less.render fs.readFileSync("src/main/less/reset.less", 'utf8'), (err, css) ->
85-
console.log err
8689
fs.writeFileSync("src/main/html/css/reset.css", css)
8790
pack()
8891

0 commit comments

Comments
 (0)