sinatra/sinatra — Issue #441: Do not play with $LOAD_PATH when is not required
Author: luislavena
Created: 2012-01-03 16:26:40+00:00
State: open

Hello,

Looking at the code I saw that `lib/sinatra.rb` will add the directory to `$LOAD_PATH`:

https://github.com/sinatra/sinatra/blob/master/lib/sinatra.rb#L1-2

The usage of `File.dirname` will result in a relative path (`./`) contrary to a full path in some implementations of Ruby.

Since Ruby 1.9.2, `$LOAD_PATH` is expanded, which means that it will have to expand the paths over and over again and resolve it prior doing a require.

Please remove those lines, since 99% or use cases are covered by RubyGems (lib directory is already in the `$LOAD_PATH` and you shouldn't play with it)

The only 1% is when running locally, but any test framework, including RSpec adds `lib` to the load path or you can manually do it with:

```
ruby -Ilib ...
```

Altering the $LOAD_PATH after RubyGems did for you result in duplicate entries (RubyGems expanded versus non-expanded one)

Also, you shouldn't play with the $LOAD_PATH, bad boy ;-)