Module: Strobe::CLI::Preview

Included in:
Main
Defined in:
lib/strobe/cli/preview.rb

Defined Under Namespace

Classes: Server

Instance Method Summary collapse

Instance Method Details

#wrap(endpoint) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/strobe/cli/preview.rb', line 31

def wrap(endpoint)
  project = bpm_project

  c = config
  s = settings

  app = Rack::Builder.new do
    use Middleware::Proxy
    use Middleware::Addons, :config => c, :settings => s
    use Middleware::Rewrite

    if project
      map "/assets" do
        run BPM::Pipeline.new project
      end
    end

    map "/" do
      run endpoint
    end
  end.to_app
end