Skip to content
Browse files

Generate pointers to ruby directly.

  • Loading branch information...
1 parent 6768777 commit 9b1c4e52299af3781bc94034d4b82cd96dfb3238 @josevalim josevalim committed
View
BIN ProtocolHandlerWrapper.exe
Binary file not shown.
View
20 ProtocolHandlerWrapper/ProtocolHandlerWrapper.sln
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C# Express 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolHandlerWrapper", "ProtocolHandlerWrapper\ProtocolHandlerWrapper.csproj", "{3295DE4E-8759-4994-809F-F31950577A71}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x86 = Debug|x86
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3295DE4E-8759-4994-809F-F31950577A71}.Debug|x86.ActiveCfg = Debug|x86
- {3295DE4E-8759-4994-809F-F31950577A71}.Debug|x86.Build.0 = Debug|x86
- {3295DE4E-8759-4994-809F-F31950577A71}.Release|x86.ActiveCfg = Release|x86
- {3295DE4E-8759-4994-809F-F31950577A71}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
View
35 ProtocolHandlerWrapper/ProtocolHandlerWrapper/Program.cs
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-using System.Reflection;
-using System.Diagnostics;
-
-namespace ProtocolHandlerWrapper
-{
- class Program
- {
- static void Main(string[] args)
- {
- var ruby = System.Environment.GetEnvironmentVariable("PATH").Split(';').
- Select(path => Path.Combine(path, "ruby.exe")).
- First(path => File.Exists(path));
-
- string wrappedPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "protocol_handler.rb");
- // Console.WriteLine(ruby);
- // Console.WriteLine(wrappedPath);
-
- Process ProcessObj = new Process();
- ProcessObj.StartInfo.FileName = ruby;
- ProcessObj.StartInfo.Arguments = wrappedPath + " " + String.Join(" ", args);
-
- ProcessObj.StartInfo.UseShellExecute = false;
- ProcessObj.StartInfo.CreateNoWindow = true;
-
- ProcessObj.Start();
-
- ProcessObj.WaitForExit();
- }
- }
-}
View
36 ProtocolHandlerWrapper/ProtocolHandlerWrapper/Properties/AssemblyInfo.cs
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ProtocolHandlerWrapper")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("ProtocolHandlerWrapper")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("23d64650-c1fa-4d97-bf4f-34c8be6aa4f6")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
View
65 ProtocolHandlerWrapper/ProtocolHandlerWrapper/ProtocolHandlerWrapper.csproj
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3295DE4E-8759-4994-809F-F31950577A71}</ProjectGuid>
- <OutputType>WinExe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ProtocolHandlerWrapper</RootNamespace>
- <AssemblyName>ProtocolHandlerWrapper</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <TargetFrameworkProfile>Client</TargetFrameworkProfile>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <PlatformTarget>x86</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>../../</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <PlatformTarget>x86</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>..\..\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <UseVSHostingProcess>false</UseVSHostingProcess>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject />
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
View
3 ProtocolHandlerWrapper/ProtocolHandlerWrapper/ProtocolHandlerWrapper.csproj.user
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-</Project>
View
3 ProtocolHandlerWrapper/ProtocolHandlerWrapper/app.config
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
-<startup><supportedRuntime version="v2.0.50727" sku="Client"/></startup></configuration>
View
1 build_wrapper_here.bat
@@ -1 +0,0 @@
-"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\VCSExpress.exe" ProtocolHandlerWrapper/ProtocolHandlerWrapper.sln /build
View
13 register_protocol_handler_wrapper.rb
@@ -1,5 +1,12 @@
-require 'erb'
-reg = ERB.new(IO.read("register_protocol_handler_wrapper.reg.erb")).result
+require "rubygems"
+require "erb"
+
+app = ARGV[0] || "txmt"
+path = ARGV[1] || File.expand_path("..\\ProtocolHandlerWrapper.exe", __FILE__)
+path = path.gsub(/[\\\/]/, "\\\\\\\\")
+ruby = Gem.ruby.gsub(/[\\\/]/, "\\\\\\\\")
+
+reg = ERB.new(IO.read("register_protocol_handler_wrapper.reg.erb")).result(binding)
reg_path = File.expand_path("../register_protocol_handler_wrapper.reg", __FILE__)
File.open(reg_path, "w") { |f| f.write(reg) }
-system("cmd /c regedit #{ reg_path }")
+system("cmd /c regedit #{reg_path}")
View
13 register_protocol_handler_wrapper.reg
@@ -0,0 +1,13 @@
+REGEDIT4
+
+[HKEY_CLASSES_ROOT\txmt]
+@="URL: Protocol handler for txmt"
+"URL Protocol"=""
+
+[HKEY_CLASSES_ROOT\txmt\shell]
+
+[HKEY_CLASSES_ROOT\txmt\shell\open]
+
+[HKEY_CLASSES_ROOT\txmt\shell\open\command]
+@="\"\\Users\\jose\\.rvm\\rubies\\ree-1.8.7-2011.03\\bin\\ruby\" \"\\Users\\jose\\Work\\github\\windows_protocol_handlers\\register_protocol_handler_wrapper.rb\\..\\ProtocolHandlerWrapper.exe\" \"%1\""
+
View
12 register_protocol_handler_wrapper.reg.erb
@@ -1,13 +1,13 @@
REGEDIT4
-[HKEY_CLASSES_ROOT\<%= ARGV[0] || "txmt" %>]
-@="URL: Protocol handled by protocol handler wrapper"
+[HKEY_CLASSES_ROOT\<%= app %>]
+@="URL: Protocol handler for <%= app %>"
"URL Protocol"=""
-[HKEY_CLASSES_ROOT\txmt\shell]
+[HKEY_CLASSES_ROOT\<%= app %>\shell]
-[HKEY_CLASSES_ROOT\txmt\shell\open]
+[HKEY_CLASSES_ROOT\<%= app %>\shell\open]
-[HKEY_CLASSES_ROOT\txmt\shell\open\command]
-@="\"<%= File.expand_path("..\\ProtocolHandlerWrapper.exe", __FILE__).gsub(/[\\\/]/, "\\\\\\\\") %>\" \"%1\""
+[HKEY_CLASSES_ROOT\<%= app %>\shell\open\command]
+@="\"<%= ruby %>\" \"<%= path %>\" \"%1\""

0 comments on commit 9b1c4e5

Please sign in to comment.
Something went wrong with that request. Please try again.