Sha256: 3bbbc4de40352ab0b09289f1bdec6222ebff176cd46f6568fccbffc6343b349d

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

#!/usr/bin/env ruby

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

require 'zurb-foundation'
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'

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

workflow = ARGV.first

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

raise rbbt_usage unless workflow

wf = Workflow.require_workflow workflow

$title = wf.to_s

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

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

app.register Sinatra::RbbtRESTWorkflow
app.register Sinatra::RbbtRESTKnowledgeBase

app.get '/' do
  redirect to(File.join('/', wf.to_s))
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

WorkflowRest.add_workflow wf, :all

if options[:views] and not options[:views].empty?
  Sinatra::RbbtRESTMain.add_resource_path(Path.setup(options[:views]), true)
end


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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbbt-util-5.16.3 share/rbbt_commands/workflow/server
rbbt-util-5.16.2 share/rbbt_commands/workflow/server
rbbt-util-5.16.1 share/rbbt_commands/workflow/server
rbbt-util-5.16.0 share/rbbt_commands/workflow/server
rbbt-util-5.15.3 share/rbbt_commands/workflow/server
rbbt-util-5.15.2 share/rbbt_commands/workflow/server