Sha256: 48f216e87354513d701e0d732785bb922b05af00d2f05347319060f496679acb
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
require 'http.rb' class AdminApp<HTTPApp provides :adminApp requires :localWebServer AppDef=Struct.new(:klass,:name,:appId) def startup log "STARTUP" startConfiguredApps begin getApp(:localWebServer).mount("/admin",createInstance("default")) #self,getControllers[0],"/") rescue end super end def run provides :admin super end def quit saveRunningApps super end def instancesFor(provider,appName) if provider.class.ancestors.map{|a|a.to_s}.member?("LocalWebServerApp") [["defaultInstance","/"+appName+"/"]] else [] end end private def startConfiguredApps log "startConfiguredApps" config=retrieveConfig log "config got" capps=config["configuredApps"] apps=capps.content log "APPS to load ",apps apps||=[] apps.each{|appDef| begin if cluster.getLocalApplications.select{|app|app.getAppId==appDef.appId}.length==0 log "RUN #{appDef.klass}" cluster.run(appDef.klass.gsub(/App$/,''),{:appId=>appDef.appId,:appName=>appDef.name}) else log "RUN #{appDef.klass} - is already running" end rescue Object=>e log e,e.backtrace end } unless getApp("Home") cluster.run("Home") end end def saveRunningApps log "SAVE" config=retrieveConfig apps=cluster.getLocalApplications.map{|app|app} apps=apps.select{|app|!Appswarm::BASIC_APPS.member?(app.class)} as=apps.map{|app|AppDef.new(app.class.to_s,app.getAppName,app.getAppId)} config["configuredApps"]=as end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appswarm-0.0.1 | apps/admin/admin.rb |