My sinatra app is contained in a gem. This means that assets (css / js) live in a gem. This application records on-the-fly generated images and serves them; they are currently writing and serving from a public directory.
I prefer not to write the generated images to gem dir, but to some kind of "cache server" of some kind within the framework of a web application that implements this gem.
The gem is set at /var/www/TE/shared/gems/ruby/1.8/gems/tubemp-0.6.0 , so the assets are, for example. /var/www/TE/shared/gems/ruby/1.8/gems/tubemp-0.6.0/lib/public/css/ .
Gem is deployed in a simple application rack at /var/www/TE/current/ , so I'd rather write and maintain thumbnails from /var/www/TE/current/public .
However, the parameter for custom public-dir allows you to set only one directory:
set :public_folder, File.join(Dir.pwd, "public")
Interrupts asset servicing; Dir.pwd is the Rack application directory. The public is now in the Rack-app directory, but this is not the place where the assets are located: they live under the βpublicβ in stone.
set :public_folder, File.join(gemdir, "public")
Service break of generated sketches.
I could rewrite the application to serve either assets or thumbnails through Sinatra, but that seems pretty overhead.
Is this the only way? Or is there a way to give Sinatra two or more public dirs to serve its static elements from?
source share