-
-
Save smerrill/10941486 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
var OpenShift = require('node-openshift-client'); | |
var util = require('util'); | |
var qs = require('qs'); | |
// Connect to our OpenShift Origin! | |
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" | |
var openshift = new OpenShift({ | |
username : 'smerrill', | |
password : 'merrill', | |
base_url : 'https://broker.openshift.phase2technology.com/broker/rest/' | |
}); | |
util.puts('Calling createApplication.'); | |
function app_data(options, cartridges) { | |
var result = qs.stringify(options); | |
var querystring = require('querystring'); | |
for (var i in cartridges) { | |
var cart = cartridges[i]; | |
// This is a downloadable cartridge. | |
if (cart.indexOf('http') === 0) { | |
result += '&cartridge[][url]=' + cartridges[i]; | |
} | |
else { | |
result += '&cartridge[][name]=' + cartridges[i]; | |
} | |
} | |
return result; | |
} | |
var app_cartridges = [ | |
'php-5.3', | |
'mysql-5.5', | |
'cron', | |
'https://cartreflect-claytondev.rhcloud.com/reflect?github=smerrill/openshift-community-pressflow7' | |
]; | |
var app_options = { | |
name : 'apitestapp', | |
initial_git_url : 'https://github.com/smerrill/pressflow-7-quickstart.git' | |
}; | |
console.log(app_data(app_options, app_cartridges)); | |
openshift.createApplication('smerrill', | |
app_data(app_options, app_cartridges), | |
function (error, result) { | |
util.print(error); | |
util.print(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment