lib/deck/rack_app.rb in deckrb-0.2.2 vs lib/deck/rack_app.rb in deckrb-0.3.0

- old
+ new

@@ -10,12 +10,15 @@ def self.app_root here = File.dirname(__FILE__) app_root = File.expand_path "#{here}/../.." end - def self.build slide_files + def self.public_file_server + Rack::File.new("#{app_root}/public") + end + def self.build slide_files if const_defined?(:Thin) if require "thin/logging" Thin::Logging.debug = true end end @@ -32,11 +35,11 @@ end def initialize slide_files @slide_files = [slide_files].flatten.map do |slide_file| case slide_file - when /\/?showoff.json$/ + when /\/?showoff(.*)\.json$/ json_file_dir = File.expand_path(File.dirname(slide_file)) json_file = slide_file config = JSON.parse(File.read(json_file)) config['sections'].map do |markdown_file| if markdown_file =~ /^# / # you can use literal markdown instead of a file name @@ -50,10 +53,10 @@ File.new(slide_file) end end.flatten @file_servers = - [Rack::File.new("#{::Deck::RackApp.app_root}/public")] + + [::Deck::RackApp.public_file_server] + @slide_files.map do |slide_file| File.expand_path File.dirname(slide_file.path) if slide_file.is_a? File end.compact.uniq.map do |slide_file_dir| Rack::File.new(slide_file_dir) end