Skip to content

Commit a71a7b9

Browse files
kazuhitoyokoiHiroyasuNishiyama
authored andcommitted
Fix bug in travis CI (#80)
1 parent d174103 commit a71a7b9

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

Gruntfile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ module.exports = function (grunt) {
103103
generateNode_lowerCase: {
104104
command: 'node bin/node-red-nodegen.js samples/lower-case.js -o ./nodegen'
105105
},
106+
getSwagger_swaggerPetstore: {
107+
command: 'node bin/getswagger.js'
108+
},
106109
generateNode_swaggerPetstore: {
107-
command: 'node bin/node-red-nodegen.js http://petstore.swagger.io/v2/swagger.json -o ./nodegen'
110+
command: 'node bin/node-red-nodegen.js samples/swagger.json -o ./nodegen'
108111
}
109112
},
110113
simplemocha: {

bin/getswagger.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Copyright JS Foundation and other contributors, http://js.foundation
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
**/
18+
19+
var fs = require('fs');
20+
var request = require('request');
21+
22+
request("http://petstore.swagger.io/v2/swagger.json", function (error, response, body) {
23+
if (!error) {
24+
try {
25+
var swagger = JSON.parse(body);
26+
swagger.schemes = ["http"];
27+
fs.writeFileSync(__dirname + "/../samples/swagger.json", JSON.stringify(swagger));
28+
} catch (error2) {
29+
console.error(error2);
30+
}
31+
} else {
32+
console.error(error);
33+
}
34+
});

0 commit comments

Comments
 (0)