Drop ruby-mime-types support in favour of Rack::MIME.

This commit is contained in:
Paul van Tilburg 2011-11-15 17:22:57 +01:00
parent 08a7ef3c01
commit 52c5b858f5
2 changed files with 9 additions and 12 deletions

9
README
View File

@ -7,7 +7,7 @@ invoicing.
* Running project & tasks overview
* Timeline overview of registered time
* Management customer information
* Management customer information
* Administration of running and billed projects/task with
* fixed cost, or
* hourly rates
@ -28,7 +28,6 @@ The following Ruby libraries are required:
* ActionPack (>= 2.3) for ActionView
* ActiveSupport (>= 2.3)
* MIME-Types
* Rack (for deployment using Apache/Rackup)
* SASS
@ -88,7 +87,7 @@ Use the following basic configuration:
</Directory>
XSendFile on
</VirtualHost>
</VirtualHost>
Now, restart Apache and visit http://some.domain.tld/.
@ -103,10 +102,10 @@ serving files under +/path/to/document_root+, i.e. something like:
<Directory /path/to/document_root/
Allow from all
</Directory>
</VirtualHost>
</VirtualHost>
Then, add a symlink from the +public+ subdirectory of to the document
root, e.g.
root, e.g.
ln -s /path/to/stoptime/public /path/to/document_root/stoptime

View File

@ -14,7 +14,6 @@ require "action_view"
require "active_support"
require "camping"
require "markaby"
require "mime/types"
require "pathname"
require "sass/plugin/rack"
@ -986,10 +985,10 @@ module StopTime::Controllers
# Sets the headers such that the web server will fetch and offer
# the file identified by the _path_ relative to the +public/+ subdirectory.
def get(path)
mime_type = MIME::Types.type_for(path).first
@headers['Content-Type'] = mime_type.nil? ? "text/plain" : mime_type.to_s
unless path.include? ".."
@headers['X-Sendfile'] = (PUBLIC_DIR + path).to_s
full_path = PUBLIC_DIR + path
@headers['Content-Type'] = Rack::Mime.mime_type(full_path.extname)
@headers['X-Sendfile'] = full_path.to_s
else
@status = "403"
"Error 403: Invalid path: #{path}"
@ -1051,9 +1050,8 @@ module StopTime::Views
if @tasks.empty?
p do
text "No customers, projects or tasks found! Set them up "
a "here", :href => R(CustomersNew)
text "."
"No customers, projects or tasks found! Set them up " +
"#{a "here", :href => R(CustomersNew)}."
end
else
@tasks.keys.sort_by { |c| c.name }.each do |customer|