|
From: <caw...@us...> - 2007-08-14 16:33:21
|
Revision: 2972
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2972&view=rev
Author: cawilliams
Date: 2007-08-14 09:32:40 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
first attempt to see if we can force some ruby launches to run under sudo (like the gem install comamnd needs to)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
@@ -130,6 +131,10 @@
*/
protected List<String> constructProgramString(VMRunnerConfiguration config) throws CoreException {
List<String> string = new ArrayList<String>();
+ if (!Platform.getOS().equals(Platform.OS_WIN32) && config.isSudo()) {
+ string.add("sudo");
+ }
+
// Look for the user-specified ruby executable command
String command= null;
Map map= config.getVMSpecificAttributesMap();
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -433,4 +433,8 @@
}
return (String[]) userEntries.toArray(new String[userEntries.size()]);
}
+
+ public boolean getIsSudo(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_IS_SUDO, false);
+ }
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -60,6 +60,7 @@
* @see DebugPlugin#exec(String[], File)
*/
protected Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
+ LaunchingPlugin.info("Starting: " + getCmdLineAsString(cmdLine));
return DebugPlugin.exec(cmdLine, workingDirectory);
}
@@ -68,7 +69,7 @@
* @see DebugPlugin#exec(String[], File, String[])
*/
protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
- LaunchingPlugin.info("Starting: " + getCmdLineAsString(cmdLine)) ;
+ LaunchingPlugin.info("Starting: " + getCmdLineAsString(cmdLine));
return DebugPlugin.exec(cmdLine, workingDirectory, envp);
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -194,5 +194,7 @@
* configuration (via the <code>ATTR_LOADPATH_PROVIDER</code> attribute).
*/
public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".CUSTOM_LOAD_PATH"; //$NON-NLS-1$
+
+ public static final String ATTR_IS_SUDO = LaunchingPlugin.getUniqueIdentifier() + ".IS_SUDO"; //$NON-NLS-1$
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -70,6 +70,8 @@
// Loadpath
String[] classpath = getLoadpath(configuration);
+ boolean isSudo = getIsSudo(configuration);
+
// Create VM config
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
@@ -77,6 +79,7 @@
runConfig.setVMArguments(execArgs.getVMArgumentsArray());
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+ runConfig.setIsSudo(isSudo);
// check for cancellation
if (monitor.isCanceled()) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java 2007-08-14 16:32:32 UTC (rev 2971)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java 2007-08-14 16:32:40 UTC (rev 2972)
@@ -32,6 +32,7 @@
private String fWorkingDirectory;
private Map fVMSpecificAttributesMap;
private boolean fResume = true;
+ private boolean fIsSudo;
private static final String[] fgEmpty= new String[0];
@@ -221,4 +222,12 @@
public boolean isResumeOnStartup() {
return fResume;
}
+
+ public void setIsSudo(boolean isSudo) {
+ fIsSudo = isSudo;
+ }
+
+ public boolean isSudo() {
+ return fIsSudo;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|