Skip to content

Instantly share code, notes, and snippets.

@mrunalp
mrunalp / cartgen.rb
Created May 23, 2013 04:09
Cartridge generator
#!/usr/bin/env ruby
# Usage ./cartgen.rb <cart_name>
require 'fileutils'
require 'logger'
$log = Logger.new(STDERR)
cart_name = ARGV[0]
cart_short_name = cart_name.upcase
#!/usr/bin/env ruby
require '/var/www/openshift/broker/config/environment'
CloudUser.find_all(nil).each { |u|
u.applications.each { |a|
if a.scalable
puts a.name
a.elaborate_descriptor
carts = a.embedded.keys.dup
carts << a.framework
@mrunalp
mrunalp / util
Created September 14, 2012 17:16
Get list of framework carts
diff --git a/stickshift/abstract/abstract/info/lib/util b/stickshift/abstract/abstract/info/lib/util
index 86fae75..1e8dcad 100755
--- a/stickshift/abstract/abstract/info/lib/util
+++ b/stickshift/abstract/abstract/info/lib/util
@@ -33,6 +33,9 @@ function get_stop_order {
echo $(get_component_order "tac")
}
+function get_installed_framework_carts {
+ (cd $OPENSHIFT_HOMEDIR; ls -d {diy-0.1,jbossas-7,jbosseap-6.0,jenkins-1.4,nodejs-0.6,perl-5.10,php-5.3,python-2.6,ruby-1.8,ruby-1.9,zend-5.6} 2>/dev/null)
@mrunalp
mrunalp / ldetect
Created September 12, 2012 00:13
Detect env vars to rid of under the current cart directory
#!/bin/bash
# Arguments
whitelist=$@
# Constants
repo_root=/opt/myrepos
# Stolen from util
function convert_cart_name_to_namespace_id {
(define (fast-mult a b)
(cond ((= b 0) 0)
((even? b) (fast-mult (+ a a) (/ b 2)))
(else (+ a (fast-mult a (- b 1))))))