(repo_path, proc_name, cb)
| 299 | * @return |
| 300 | */ |
| 301 | var getPostUpdateCmds = function(repo_path, proc_name, cb) { |
| 302 | if (typeof repo_path !== 'string') |
| 303 | return cb([]); |
| 304 | if (repo_path[repo_path.length - 1] !== '/') |
| 305 | repo_path += '/'; |
| 306 | |
| 307 | var searchForCommands = function(file, callback) { |
| 308 | fs.access(repo_path+file, fs.constants.F_OK, function(err) { |
| 309 | var exists = !err; |
| 310 | if (exists) { |
| 311 | try { |
| 312 | var conf_string = fs.readFileSync(repo_path + file); |
| 313 | var data = Common.parseConfig(conf_string, repo_path + file); |
| 314 | } catch (e) { |
| 315 | console.error(e.message || e); |
| 316 | } |
| 317 | |
| 318 | if (data && data.apps) { |
| 319 | eachSeries(data.apps, function(item, callb) { |
| 320 | if (item.name && item.name === proc_name) { |
| 321 | if (item.post_update && typeof(item.post_update) === 'object') { |
| 322 | if (item.exec_timeout) |
| 323 | EXEC_TIMEOUT = parseInt(item.exec_timeout); |
| 324 | return callb(item.post_update); |
| 325 | } |
| 326 | else { |
| 327 | return callb(); |
| 328 | } |
| 329 | } |
| 330 | else |
| 331 | return callb(); |
| 332 | }, function(final) { |
| 333 | return callback(final); |
| 334 | }); |
| 335 | } |
| 336 | else { |
| 337 | return callback(); |
| 338 | } |
| 339 | } |
| 340 | else { |
| 341 | return callback(); |
| 342 | } |
| 343 | }); |
| 344 | }; |
| 345 | |
| 346 | eachSeries(['ecosystem.json', 'process.json', 'package.json'], searchForCommands, |
| 347 | function(final) { |
| 348 | return cb(final ? final : []); |
| 349 | }); |
| 350 | }; |
| 351 | |
| 352 | |
| 353 | /** |
no test coverage detected
searching dependent graphs…