Like Rack::File, but it serves the last lines of a file.
Add this line to your application's Gemfile:
gem 'rack-tail'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-tail
Rack::Tail serves files below the +root+ directory given, according to the path info of the Rack request.
e.g. when Rack::Tail.new("/etc") is used, you can access the last n
lines of the 'passwd' file
as http://localhost:9292/passwd?n=3
Great idea...
Be careful how you use this.
Here's a legitimate example.
require 'rack/tail'
app = map "/logging" do
run Rack::Tail.new("logs")
end
run app
# Now open http://localhost:9292/logging/app.log?n=2
Note that you cannot hack the URL to access any files that are outside the root directory specified in the constructor.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request