Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bumped guard minitest, added a config.ru for checking things and provided a better 404 handling #11

Merged
merged 1 commit into from Mar 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rack-combobot (0.0.2)
rack-combobot (0.0.3)
rack
rake

Expand All @@ -12,7 +12,7 @@ GEM
guard (0.10.0)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-minitest (0.4.0)
guard-minitest (0.5.0)
guard (~> 0.4)
minitest (2.10.0)
rack (1.4.0)
Expand Down
4 changes: 4 additions & 0 deletions config.ru
@@ -0,0 +1,4 @@
require 'rack'
require './lib/rack-combobot'

run Rack::Combobot.configure :root => 'spec/public'
9 changes: 7 additions & 2 deletions lib/rack/combobot.rb
@@ -1,3 +1,5 @@
# encoding: UTF-8

require "rack/combobot/config"
require "pathname"
require "uri"
Expand All @@ -22,11 +24,14 @@ def initialize(options = {})
def call(env)
params = env["QUERY_STRING"]
file_names = params.split("&")
extention = file_names[0].split(".").last

return not_found if file_names.empty?

extension = file_names[0].split(".").last
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will file_names be nil? If so, split will fail.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the QUERY_STRING is always a string, so doing "".split('&') will just return an empty array


begin
combo = Combination.new(@config.root, file_names).combine
[200, {"Content-Type" => MIME_TYPES[extention]}, [combo]]
[200, {"Content-Type" => MIME_TYPES[extension]}, [combo]]
rescue Combination::PathError
not_found
end
Expand Down