Skip to content

Instantly share code, notes, and snippets.

View mccrory's full-sized avatar

Dave McCrory mccrory

View GitHub Profile
oot@ip-10-73-19-131:/tmp/bosh/release/template/instance# /var/vcap/bosh/bin/gem install chef --version 0.9.12
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
@mccrory
mccrory / Hello
Created July 31, 2011 18:16
Hello From Cloud Foundry
require 'rubygems'
require 'sinatra'
get '/' do
"Hello from Cloud Foundry"
end
@mccrory
mccrory / AppCloudComment.rb
Created November 20, 2010 20:56
Open PaaS / VMforce appears to be called AppCloud
# This class captures the common interactions with AppCloud that can be shared by different
# clients. Clients that use this class are the vmc CLI and the integration test automation.
# TBD - ABS: This is currently a minimal extraction of methods to tease out
# the interactive aspects of the vmc CLI from the AppCloud API calls.
#-----------------
# Send resource fingerprints to the cloud controller
response = HTTPClient.post resources_uri, fingerprints.to_json, auth_hdr
@mccrory
mccrory / OpenPaaS Service Tier Price Model.rb
Created November 20, 2010 20:48
OpenPaaS Code (Alpha) for implementing Service Pricing
def format_price(amount, type, *rest)
case type
when 'flat'
return "$#{amount}/#{rest[0]}"
when 'metered'
raise "Not Implemented"
end
end
@mccrory
mccrory / VMC-Framework-Needs-DB
Created November 13, 2010 22:31
Detects if the Detected framework needs a DB and offers to create one
# Provision database here if needed.
if framework_needs_db?(framework)
proceed = ask("This framework usually needs a database, would you like to provision it? [Yn]: ")
if proceed != 'n' && proceed != 'N'
app_add_service_helper(appname, 'database', '')
provisioned_db = true
end
end
@mccrory
mccrory / VMC-Framework-Detects
Created November 13, 2010 22:26
Code that detects frameworks for VMware Cloud OS / OpenPaaS
Dir.chdir(path) do
# Detect the appropriate framework.
framework = "http://b20nine.com/unknown"
mem = '256M'
unless ignore_framework
if File.exist?('config/environment.rb')
display "Rails application detected."
framework = "rails/1.0"
elsif Dir.glob('*.war').first
opt_war_file = Dir.glob('*.war').first