1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/lib/middleman/builder.rb

16 lines
598 B
Ruby
Raw Normal View History

2009-10-01 17:26:39 -04:00
# Use Rack::Test to access Sinatra without starting up a full server
2009-09-29 13:10:47 -04:00
require 'rack/test'
2009-09-28 22:43:08 -04:00
2009-10-01 17:26:39 -04:00
# Placeholder for any methods the builder needs to abstract to allow feature integration
2009-09-28 22:43:08 -04:00
module Middleman
class Builder
2009-10-01 17:26:39 -04:00
# The default render just requests the page over Rack and writes the response
2009-09-29 13:10:47 -04:00
def self.render_file(source, destination)
request_path = destination.gsub(File.join(Dir.pwd, Middleman::Base.build_dir), "")
browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base))
2009-09-28 22:43:08 -04:00
browser.get(request_path)
browser.last_response.body
end
end
end