Sha256: d056d29bf7d9b81acb790a2b18098960e1c341cebabab707dbbbadf4433b8224
Contents?: true
Size: 1.65 KB
Versions: 27
Compression:
Stored size: 1.65 KB
Contents
require 'tempfile' module Spider; module AppServer class AppServerController < Spider::PageController layout 'app_server' __.html :template => 'app_list' __.json :call => :list_json def list(name=nil) @scene.apps = AppServer.apps end __.text def list_json(names=nil) if names apps = names.split('+') $out << (apps.map{ |name| AppServer.apps_by_id[name] }).to_json else $out << AppServer.apps.to_json end end __.action def pack(name=nil) app = AppServer.apps_by_id[name] raise NotFound.new("App #{name}") unless app tmp = Tempfile.new("spider-app-archive") if app.is_a?(GitApp) repo = app.repo repo.archive_to_file('master', nil, tmp.path, nil, 'cat') else # TODO end output_static(tmp.path) tmp.close end __.json def deps(names) names = names.split('+') new_apps = names specs = {} while !new_apps.empty? && curr = new_apps.pop raise NotFound.new("App #{curr}") unless AppServer.apps_by_id[curr] spec = AppServer.apps_by_id[curr].spec specs[curr] = spec new_apps += spec.depends.reject{ |app| specs[app] } new_apps += spec.depends_optional.reject{ |app| specs[app] } unless @request.params['no_optional'] end $out << specs.values.to_json end end end; end
Version data entries
27 entries across 27 versions & 1 rubygems