diff --git a/lib/sapling/middleware.rb b/lib/sapling/middleware.rb new file mode 100644 index 0000000..604338c --- /dev/null +++ b/lib/sapling/middleware.rb @@ -0,0 +1,14 @@ +require_relative './gardner' + +class Middle + attr_reader :tree + + def initialize(app) + @app = app + @tree = Gardner::Plot.new(YAML.load_file('lib/sapling/example.yaml')) + end + + def call(env) + @app.call(env) + end +end diff --git a/lib/sapling/server.ru b/lib/sapling/server.ru new file mode 100644 index 0000000..1b09c14 --- /dev/null +++ b/lib/sapling/server.ru @@ -0,0 +1,17 @@ +require 'erb' + +require_relative './gardner' + +# Rack Stuff +class Greenhouse + + def initialize + @response = ERB.new(File.read('lib/sapling/index.erb')).result(binding) + end + + def call(_env) + ['200', { 'Content-Type' => 'text/html' }, [@response]] + end +end + +run Greenhouse.new