Sha256: fa55158f500efde10e4ddf4d4808a2560ec82a542b6ed741d929d6a6c5d3c0dc
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
module Trinidad module Sandbox module Helpers module Context def sandbox_context @sandbox_context ||= $servlet_context.getAttribute('sandbox_context') end def enable_default? !!$servlet_context.getAttribute('enable_default') end def git_ssh? !!$servlet_context.getAttribute('git_ssh') end def readonly? !!$servlet_context.get_attribute('readonly') end def render_readonly warning "The console has been started as READONLY, you can access to that resource" redirect_to_home 401 end def context_not_found(name) warning "It seems the application #{name} is not running on Trinidad" redirect_to_home 404 end def repo_not_found warning "The repository url is required to clone the application", :now respond_to_invalid_deploy end def invalid_app_path(path) warning "The path #{path} is not valid, please remove the slashes", :now respond_to_invalid_deploy end def host $servlet_context.getAttribute('tomcat_host') end def redirect_to_home(status_code) respond_to do |wants| wants.html { redirect sandbox_context.path } wants.xml { status status_code } end end def respond_to_invalid_deploy @page_id = 'deploy' respond_to do |wants| wants.html { haml :deploy } wants.xml { status 400 } end end def warning(message, req = :next) flash.send(req)[:warning] = message $servlet_context.log message end def available_context?(context) context.name != sandbox_context.name || enable_default? || (!enable_default? && context.name == 'default') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trinidad_sandbox_extension-1.0.1 | lib/trinidad_sandbox_extension/app/helpers/context.rb |
trinidad_sandbox_extension-1.0.0 | lib/trinidad_sandbox_extension/app/helpers/context.rb |