]> git.wincent.com - wikitext.git/commitdiff
rails/init.rb: trust LOAD_PATH
authorWincent Colaiuta <win@wincent.com>
Sat, 12 Jun 2010 15:46:55 +0000 (17:46 +0200)
committerWincent Colaiuta <win@wincent.com>
Sat, 12 Jun 2010 15:46:55 +0000 (17:46 +0200)
Rather than doing requires with absolute paths, trust the calling
environment (in this case, Rails 2) to set up the LOAD_PATH
appropriately.

This saves us later on re-requiring the same file with a different,
relative path and needlessly re-evaluating the same code.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
rails/init.rb

index a6a4552736fab6de618ca9bc58bf1908967b2e44..7c09d2e9fb0823308c5ca3864e6cc62899dd112e 100644 (file)
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-# Avoid Rails bug #2266 by not requiring during "rake gems:build"
-# See: https://rails.lighthouseapp.com/projects/8994/tickets/2266
+# this file evaluated automatically under Rails 2
 unless $gems_build_rake_task
-  libdir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'wikitext'))
-  require File.join(libdir, 'nil_class')
-  require File.join(libdir, 'string')
-  require File.join(libdir, 'rails_template_handler')
+  # avoid Rails bug #2266 by not requiring during "rake gems:build"
+  # see: https://rails.lighthouseapp.com/projects/8994/tickets/2266
+  require 'wikitext/nil_class'
+  require 'wikitext/string'
+  require 'wikitext/rails_template_handler'
 end