Sha256: 1a83d0947e2c7fef25347e17d4fe7ca2cbc91f618d47fc76565d3b3bc4997df1

Contents?: true

Size: 1.69 KB

Versions: 36

Compression:

Stored size: 1.69 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

36 entries across 36 versions & 1 rubygems

Version Path
rbbt-util-5.17.26 share/rbbt_commands/workflow/server
rbbt-util-5.17.25 share/rbbt_commands/workflow/server
rbbt-util-5.17.24 share/rbbt_commands/workflow/server
rbbt-util-5.17.23 share/rbbt_commands/workflow/server
rbbt-util-5.17.22 share/rbbt_commands/workflow/server
rbbt-util-5.17.21 share/rbbt_commands/workflow/server
rbbt-util-5.17.20 share/rbbt_commands/workflow/server
rbbt-util-5.17.19 share/rbbt_commands/workflow/server
rbbt-util-5.17.18 share/rbbt_commands/workflow/server
rbbt-util-5.17.17 share/rbbt_commands/workflow/server
rbbt-util-5.17.16 share/rbbt_commands/workflow/server
rbbt-util-5.17.15 share/rbbt_commands/workflow/server
rbbt-util-5.17.14 share/rbbt_commands/workflow/server
rbbt-util-5.17.13 share/rbbt_commands/workflow/server
rbbt-util-5.17.12 share/rbbt_commands/workflow/server
rbbt-util-5.17.11 share/rbbt_commands/workflow/server