|
From: <caw...@us...> - 2007-07-25 14:27:12
|
Revision: 2837
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2837&view=rev
Author: cawilliams
Date: 2007-07-25 07:27:05 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
fix #5299 - Make gem loadpaths use variables that get resolved. Gem loadpaths now use the RUBY_LIB variable to make paths relative to the ruby library directory. This makes it so that oaths aren't absolute anymore and can be moved across workspaces/etc.
BUT, gems aren't always relative to the Ruby lib folder, so we really need to define a special GEM_LIB variable.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-07-25 14:26:59 UTC (rev 2836)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-07-25 14:27:05 UTC (rev 2837)
@@ -2,12 +2,16 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.LoadpathVariableInitializer;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
public class RubyLoadpathVariablesInitializer extends LoadpathVariableInitializer {
@@ -15,38 +19,36 @@
@Override
public void initialize(String variable) {
-// FIXME What should we be looking for?!
-// IVMInstall vmInstall= RubyRuntime.getDefaultVMInstall();
-// if (vmInstall != null) {
-// IPath newPath= null;
-// IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
-//
-//
-// if (systemLib != null) {
-// if (variable.equals(RubyRuntime.RUBYLIB_VARIABLE)) {
-// newPath= systemLib;
-// }
-// if (newPath == null) {
-// return;
-// }
-// IWorkspace workspace= ResourcesPlugin.getWorkspace();
-// IWorkspaceDescription wsDescription= workspace.getDescription();
-// boolean wasAutobuild= wsDescription.isAutoBuilding();
-// try {
-// setAutobuild(workspace, false);
-// setRubyVMVariable(newPath, variable);
-// } catch (CoreException ce) {
-// LaunchingPlugin.log(ce);
-// return;
-// } finally {
-// try {
-// setAutobuild(workspace, wasAutobuild);
-// } catch (CoreException ce) {
-// LaunchingPlugin.log(ce);
-// }
-// }
-// }
-// }
+ IVMInstall vmInstall= RubyRuntime.getDefaultVMInstall();
+ if (vmInstall != null) {
+ IPath newPath= null;
+// IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
+ IPath systemLib = new Path(vmInstall.getInstallLocation().getAbsolutePath()).append("lib");
+ if (systemLib != null) {
+ if (variable.equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ newPath= systemLib;
+ }
+ if (newPath == null) {
+ return;
+ }
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription wsDescription= workspace.getDescription();
+ boolean wasAutobuild= wsDescription.isAutoBuilding();
+ try {
+ setAutobuild(workspace, false);
+ setRubyVMVariable(newPath, variable);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ return;
+ } finally {
+ try {
+ setAutobuild(workspace, wasAutobuild);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ }
+ }
+ }
+ }
}
private void setRubyVMVariable(IPath newPath, String var) throws CoreException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|