Project

General

Profile

Bug #2380 » 0001-Try-to-fix-ruby-not-finding-local-gems.patch

Pavel Shved, 02/05/2012 09:36 PM

View differences:

watcher/ldv-watcher
#!/usr/bin/env ruby
#
# Watch for tasks to be completed in order
#
# Set path to gems so that our gems are automatically loaded
# Just in case, try the old method again
ENV['GEM_PATH'] = File.join(File.dirname(__FILE__),"..","shared","ruby","gem") + (ENV['GEM_PATH']?":#{ENV['GEM_PATH']}":"") + ":" + (`gem env gempath`.chomp)
# We can't just set GEM_PATH here because Ruby gems read it only at the first path request, which may already have occured.
old_paths = Gem.path
new_paths = [File.join(File.dirname(__FILE__),"..","shared","ruby","gem")]
# We set Gem.home to nil, and then will call Gem.dir that sets it to a better value
Gem.use_paths(nil,old_paths + new_paths)
# Set home, as promised
Gem.dir
require 'fileutils'
require 'find'
require 'logger'
# Set path to gems so that our gems are automatically loaded
ENV['GEM_PATH'] = File.join(File.dirname(__FILE__),"..","shared","ruby","gem") + (ENV['GEM_PATH']?":#{ENV['GEM_PATH']}":"") + ":" + (`gem env gempath`.chomp)
# Require gems
require 'rubygems'
$:.unshift File.dirname(__FILE__)
(1-1/2)