Sha256: 2bb115f7dd15fdb7d2e66c55e9317fe8536f807102eda3072c075db929d62ec1

Contents?: true

Size: 1.68 KB

Versions: 10

Compression:

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

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.helpers Sinatra::RbbtToolHelper

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[:workflows]
  options[:workflows].split(/[\s,]+/).each do |name|
    _wf = Workflow.require_workflow name
    WorkflowRest.add_workflow _wf, :all
  end
end


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

10 entries across 10 versions & 1 rubygems

Version Path
rbbt-util-5.17.10 share/rbbt_commands/workflow/server
rbbt-util-5.17.9 share/rbbt_commands/workflow/server
rbbt-util-5.17.7 share/rbbt_commands/workflow/server
rbbt-util-5.17.6 share/rbbt_commands/workflow/server
rbbt-util-5.17.5 share/rbbt_commands/workflow/server
rbbt-util-5.17.4 share/rbbt_commands/workflow/server
rbbt-util-5.17.3 share/rbbt_commands/workflow/server
rbbt-util-5.17.2 share/rbbt_commands/workflow/server
rbbt-util-5.17.1 share/rbbt_commands/workflow/server
rbbt-util-5.17.0 share/rbbt_commands/workflow/server