Sha256: 5917f4bc8abda8c8eb1ed206d8b20fbcc3ba000bcdf7962f30cf311c1ce3f50a

Contents?: true

Size: 1.6 KB

Versions: 13

Compression:

Stored size: 1.6 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*"

template = ARGV.first

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

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

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)
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

13 entries across 13 versions & 1 rubygems

Version Path
rbbt-util-5.17.46 share/rbbt_commands/app/template
rbbt-util-5.17.45 share/rbbt_commands/app/template
rbbt-util-5.17.44 share/rbbt_commands/app/template
rbbt-util-5.17.43 share/rbbt_commands/app/template
rbbt-util-5.17.42 share/rbbt_commands/app/template
rbbt-util-5.17.41 share/rbbt_commands/app/template
rbbt-util-5.17.40 share/rbbt_commands/app/template
rbbt-util-5.17.39 share/rbbt_commands/app/template
rbbt-util-5.17.38 share/rbbt_commands/app/template
rbbt-util-5.17.37 share/rbbt_commands/app/template
rbbt-util-5.17.35 share/rbbt_commands/app/template
rbbt-util-5.17.33 share/rbbt_commands/app/template
rbbt-util-5.17.32 share/rbbt_commands/app/template