public override void StartFile(CommonProjectNode project, string /*!*/ file, bool debug) { string appType = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.RubyApplicationType, true) : null; if (appType == RubyConstants.ProjectProperties.RubyApplicationType_WebApp) { string host = "localhost"; int port = Convert.ToInt32(project.GetProjectProperty(RubyConstants.ProjectProperties.DefaultPort, true)); if (LaunchWebServer(project, file, host, port)) { StartInBrowser("http://" + host + ":" + port, null); } else { throw new ApplicationException(String.Format( "Unable to start a web server by running file '{0}'. No response on http://{1}:{2}.", file, host, port )); } } else { base.StartFile(project, file, debug); } }
public override int OnAfterRenameFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, string[] newFileNames, VSRENAMEFILEFLAGS[] flags) { if (!_project.IsRefreshing) { //Get the current value of the StartupFile Property string currentStartupFile = _project.GetProjectProperty(CommonConstants.StartupFile, true); if (string.IsNullOrEmpty(currentStartupFile)) { return(VSConstants.S_OK); } string fullPathToStartupFile = CommonUtils.GetAbsoluteFilePath(_project.ProjectHome, currentStartupFile); //Investigate all of the oldFileNames if they are equal to the current StartupFile int index = 0; foreach (string oldfile in oldFileNames) { FileNode node = null; if ((flags[index] & VSRENAMEFILEFLAGS.VSRENAMEFILEFLAGS_Directory) != 0) { if (CommonUtils.IsSubpathOf(oldfile, fullPathToStartupFile)) { // Get the newfilename and update the StartupFile property string newfilename = Path.Combine( newFileNames[index], CommonUtils.GetRelativeFilePath(oldfile, fullPathToStartupFile) ); node = _project.FindNodeByFullPath(newfilename) as FileNode; Debug.Assert(node != null); } } else if (CommonUtils.IsSamePath(oldfile, fullPathToStartupFile)) { //Get the newfilename and update the StartupFile property string newfilename = newFileNames[index]; node = _project.FindNodeByFullPath(newfilename) as FileNode; Debug.Assert(node != null); } if (node != null) { // Startup file has been renamed _project.SetProjectProperty( CommonConstants.StartupFile, CommonUtils.GetRelativeFilePath(_project.ProjectHome, node.Url)); break; } index++; } } return(VSConstants.S_OK); }
public override void StartProject(CommonProjectNode project, bool debug) { IronRubyToolsPackage.Instance.RequireIronRubyInstalled(allowCancel: false); string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; string file; switch (launcher) { case RubyConstants.ProjectProperties.Launcher_Rack: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Rackup.rb"); break; case RubyConstants.ProjectProperties.Launcher_Spec: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Spec.rb"); break; default: file = project.GetStartupFile(); if (String.IsNullOrEmpty(file)) { //TODO: need to start active file then throw new ApplicationException("No startup file is defined for the startup project."); } break; } StartFile(project, file, debug); }
public override string CreateCommandLineDebug(CommonProjectNode project, string startupFile) { string cmdLineArgs = null; if (project != null) { cmdLineArgs = project.GetProjectProperty(CommonConstants.CommandLineArguments, true); } return(String.Format("-X:Debug {0} \"{1}\" {2}", GetOptions(project), startupFile, cmdLineArgs)); }
protected override void SetupEnvironment(CommonProjectNode project, StringDictionary environment) { if (project != null) { //IronPython passes search path via IRONPYTHONPATH environment variable string searchPath = project.GetProjectProperty(CommonConstants.SearchPath, true); if (!string.IsNullOrEmpty(searchPath)) { environment[PythonConstants.IronPythonPath] = searchPath; } } }
private string GetOptions(CommonProjectNode project) { if (project != null) { var debugStdLib = project.GetProjectProperty(PythonConstants.DebugStandardLibrary, false); bool debugStdLibResult; if (!bool.TryParse(debugStdLib, out debugStdLibResult) || !debugStdLibResult) { var res = "-X:NoDebug \"" + System.Text.RegularExpressions.Regex.Escape(Path.Combine(InstallPath, "Lib\\")) + ".*\""; return(res); } } return(""); }
public override string GetInterpreterExecutable(CommonProjectNode project) { return project != null && Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)) ? IronRubyToolsPackage.Instance.IronRubyWindowsExecutable : IronRubyToolsPackage.Instance.IronRubyExecutable; }
/*!*/ private string CreateCommandLine(CommonProjectNode project, string/*!*/ startupFile, bool debug) { var commandLine = new StringBuilder(); bool disableDebugging = project != null && Convert.ToBoolean(project.GetProjectProperty(RubyConstants.ProjectProperties.DisableDebugging, true)); if (debug && !disableDebugging) { commandLine.Append(" -D"); } string searchPath = (project != null) ? project.GetProjectProperty(CommonConstants.SearchPath, true) : null; if (!String.IsNullOrEmpty(searchPath)) { foreach (string path in searchPath.Split(Path.PathSeparator)) { try { // the path is relative to the .rbproj file, not to the ir.exe file: var fullPath = RubyUtils.CanonicalizePath(Path.GetFullPath(path)); commandLine.Append(" -I"); if (fullPath.IndexOf(' ') >= 0) { commandLine.Append('"').Append(fullPath).Append('"'); } else { commandLine.Append(path); } } catch { // ignore } } } commandLine.Append(' ').Append('"').Append(startupFile).Append('"'); string args = null; string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; if (launcher == RubyConstants.ProjectProperties.Launcher_Spec) { string testDir = Path.GetFullPath(Path.Combine(project.GetWorkingDirectory(), "test")); if (Directory.Exists(testDir)) { args = String.Join(" ", Directory.GetFiles(testDir, "*_spec.rb").ConvertAll((path) => path.IndexOf(' ') >= 0 ? '"' + path + '"' : path) ); } } else { args = (project != null) ? project.GetProjectProperty(CommonConstants.CommandLineArguments, true) : null; } if (!String.IsNullOrEmpty(args)) { commandLine.Append(' '); commandLine.Append(args); } return commandLine.ToString(); }
public override void StartProject(CommonProjectNode project, bool debug) { IronRubyToolsPackage.Instance.RequireIronRubyInstalled(allowCancel: false); string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; string file; switch (launcher) { case RubyConstants.ProjectProperties.Launcher_Rack: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Rackup.rb"); break; case RubyConstants.ProjectProperties.Launcher_Spec: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Spec.rb"); break; default: file = project.GetStartupFile(); if (String.IsNullOrEmpty(file)) { //TODO: need to start active file then throw new ApplicationException("No startup file is defined for the startup project."); } break; } StartFile(project, file, debug); }
public override void StartFile(CommonProjectNode project, string/*!*/ file, bool debug) { string appType = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.RubyApplicationType, true) : null; if (appType == RubyConstants.ProjectProperties.RubyApplicationType_WebApp) { string host = "localhost"; int port = Convert.ToInt32(project.GetProjectProperty(RubyConstants.ProjectProperties.DefaultPort, true)); if (LaunchWebServer(project, file, host, port)) { StartInBrowser("http://" + host + ":" + port, null); } else { throw new ApplicationException(String.Format( "Unable to start a web server by running file '{0}'. No response on http://{1}:{2}.", file, host, port )); } } else { base.StartFile(project, file, debug); } }
private string /*!*/ CreateCommandLine(CommonProjectNode project, string /*!*/ startupFile, bool debug) { var commandLine = new StringBuilder(); bool disableDebugging = project != null && Convert.ToBoolean(project.GetProjectProperty(RubyConstants.ProjectProperties.DisableDebugging, true)); if (debug && !disableDebugging) { commandLine.Append(" -D"); } string searchPath = (project != null) ? project.GetProjectProperty(CommonConstants.SearchPath, true) : null; if (!String.IsNullOrEmpty(searchPath)) { foreach (string path in searchPath.Split(Path.PathSeparator)) { try { // the path is relative to the .rbproj file, not to the ir.exe file: var fullPath = RubyUtils.CanonicalizePath(Path.GetFullPath(path)); commandLine.Append(" -I"); if (fullPath.IndexOf(' ') >= 0) { commandLine.Append('"').Append(fullPath).Append('"'); } else { commandLine.Append(path); } } catch { // ignore } } } commandLine.Append(' ').Append('"').Append(startupFile).Append('"'); string args = null; string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; if (launcher == RubyConstants.ProjectProperties.Launcher_Spec) { string testDir = Path.GetFullPath(Path.Combine(project.GetWorkingDirectory(), "test")); if (Directory.Exists(testDir)) { args = String.Join(" ", Directory.GetFiles(testDir, "*_spec.rb").ConvertAll((path) => path.IndexOf(' ') >= 0 ? '"' + path + '"' : path) ); } } else { args = (project != null) ? project.GetProjectProperty(CommonConstants.CommandLineArguments, true) : null; } if (!String.IsNullOrEmpty(args)) { commandLine.Append(' '); commandLine.Append(args); } return(commandLine.ToString()); }
private string GetOptions(CommonProjectNode project) { if (project != null) { var debugStdLib = project.GetProjectProperty(PythonConstants.DebugStandardLibrary, false); bool debugStdLibResult; if (!bool.TryParse(debugStdLib, out debugStdLibResult) || !debugStdLibResult) { var res = "-X:NoDebug \"" + System.Text.RegularExpressions.Regex.Escape(Path.Combine(InstallPath, "Lib\\")) + ".*\""; return res; } } return ""; }
protected override void SetupEnvironment(CommonProjectNode project, StringDictionary environment) { if (project != null) { //IronPython passes search path via IRONPYTHONPATH environment variable string searchPath = project.GetProjectProperty(CommonConstants.SearchPath, true); if (!string.IsNullOrEmpty(searchPath)) { environment[PythonConstants.IronPythonPath] = searchPath; } } }
public override string GetInterpreterExecutable(CommonProjectNode project) { return(project != null && Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)) ? IronRubyToolsPackage.Instance.IronRubyWindowsExecutable : IronRubyToolsPackage.Instance.IronRubyExecutable); }
public override string GetInterpreterExecutable(CommonProjectNode project) { bool isWindows = Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)); return isWindows ? WindowsInterpreterExecutable : InterpreterExecutable; }
public override string CreateCommandLineNoDebug(CommonProjectNode project, string startupFile) { string cmdLineArgs = null; if (project != null) { cmdLineArgs = project.GetProjectProperty(CommonConstants.CommandLineArguments, true); } return String.Format("{0} \"{1}\" {2}", GetOptions(project), startupFile, cmdLineArgs); }
public override string GetInterpreterExecutable(CommonProjectNode project) { bool isWindows = Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)); return(isWindows ? WindowsInterpreterExecutable : InterpreterExecutable); }