Sha256: 760d419a2bfe9acff8d372ab48d74300790cbd8a7a4df4d4fbe0c52b7b2de79c

Contents?: true

Size: 1.77 KB

Versions: 132

Compression:

Stored size: 1.77 KB

Contents

#!/usr/bin/env ruby

require 'rbbt/util/simpleopt'
require 'rbbt/workflow'

require 'modular-scale'

require 'rbbt/rest/main'
require 'rbbt/rest/entity'
require 'rbbt/rest/workflow'
require 'rbbt/rest/file_server'
require 'rbbt/rest/knowledge_base'
require 'rbbt/rest/helpers'
require 'rbbt/rest/web_tool'

options = SOPT.get "-e--environment*:-p--port*:-s--server*:-b--bind*:-e--environment*:-R--RServe_session*:--finder:--views*:-w--workflows*"

template = ARGV.first

template = File.expand_path(template)
template = template.sub('.haml','')

ENV["RBBT_FINDER"] = "true" if options.include?(:finder)
ENV["RServe-session"] = options[:RServe_session] 
ENV["RACK_ENV"] = options[:environment] if options.include?(:environment)

raise rbbt_usage unless template

$title = File.basename(template)

load Rbbt.etc['app.d/init.rb'].find

app = class SingleTemplate < Sinatra::Base; self end

if options[:workflows]
  app.register Sinatra::RbbtRESTWorkflow
  options[:workflows].split(/[\s,]+/).each do |name|
    wf = Workflow.require_workflow name
    app.add_workflow wf, :all
  end
end

app.register Sinatra::RbbtRESTKnowledgeBase

app.helpers Sinatra::RbbtMiscHelpers
app.helpers Sinatra::RbbtToolHelper

app.get '/' do
  template_render(template, @clean_params, "Template cache", :cache_type => :asynchronous)
end
app.instance_eval Rbbt.etc['app.d/base.rb'].read
app.use Rack::Deflater

load Rbbt.etc['app.d/resources.rb'].find

app.class_eval do
  eval Rbbt.etc['app.d/finder.rb'].read
end

Sinatra::RbbtRESTMain.add_resource_path(Path.setup('/home/mvazquezg/'), true)


SingleTemplate.port = options[:port] || 4567
SingleTemplate.bind = options[:bind] || "0.0.0.0"
SingleTemplate.environment = options[:environment] || "development"
SingleTemplate.server = options[:server] if options[:server]
SingleTemplate.run!

Version data entries

132 entries across 132 versions & 1 rubygems

Version Path
rbbt-util-5.21.91 share/rbbt_commands/app/template
rbbt-util-5.21.90 share/rbbt_commands/app/template
rbbt-util-5.21.89 share/rbbt_commands/app/template
rbbt-util-5.21.87 share/rbbt_commands/app/template
rbbt-util-5.21.86 share/rbbt_commands/app/template
rbbt-util-5.21.85 share/rbbt_commands/app/template
rbbt-util-5.21.84 share/rbbt_commands/app/template
rbbt-util-5.21.83 share/rbbt_commands/app/template
rbbt-util-5.21.81 share/rbbt_commands/app/template
rbbt-util-5.21.80 share/rbbt_commands/app/template
rbbt-util-5.21.78 share/rbbt_commands/app/template
rbbt-util-5.21.77 share/rbbt_commands/app/template
rbbt-util-5.21.76 share/rbbt_commands/app/template
rbbt-util-5.21.75 share/rbbt_commands/app/template
rbbt-util-5.21.74 share/rbbt_commands/app/template
rbbt-util-5.21.73 share/rbbt_commands/app/template
rbbt-util-5.21.72 share/rbbt_commands/app/template
rbbt-util-5.21.71 share/rbbt_commands/app/template
rbbt-util-5.21.70 share/rbbt_commands/app/template
rbbt-util-5.21.69 share/rbbt_commands/app/template