Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e63e6cd
Moving src to root
jchadwick Feb 17, 2012
5ebe4b0
Integrated Raven DB. Implemented saving/editing the fiddle.
ShankarSangoli Feb 20, 2012
4b1b1dc
Enabling NuGet package restore
jchadwick Feb 27, 2012
7fc68c4
Cleanup
jchadwick Feb 28, 2012
a688ce5
Merge branch 'EditorUI' of ../RazorPad
jchadwick Feb 28, 2012
1b1cc36
Merging Editor UI
jchadwick Feb 28, 2012
fe4e7b1
Fixing
jchadwick Apr 13, 2012
21fa975
Adding HTML view
jchadwick Apr 13, 2012
285d3fd
Merging helper support from core
jchadwick Apr 13, 2012
5c947a7
Adding Sidebar
jchadwick Apr 16, 2012
c029f22
Moving Views to their own folder
jchadwick Apr 16, 2012
0ea2b3f
Introducing Model Providers
jchadwick Apr 17, 2012
2d62053
Cleanup and restructuring
jchadwick Apr 18, 2012
5b4f5fa
Refactoring ViewModelBase and adding EventHandlerExtensions
jchadwick Apr 18, 2012
f811fe2
Refactoring Acceptance Tests to use files and T4 template
jchadwick Apr 19, 2012
3f4c22f
Adding RazorDocument and moving model providers to Core
jchadwick Apr 19, 2012
a464a5c
Adding RazorDocument loading support
jchadwick Apr 19, 2012
444b979
Adding NCrunch configs
jchadwick Apr 19, 2012
69ed19d
Testing RazorDocumentStore
jchadwick Apr 19, 2012
f08ff56
Fixing test
jchadwick Apr 19, 2012
a1d4173
Enhancing RazorDocumentLoader
jchadwick Apr 19, 2012
2f0ce1e
Playing with AvalonDock
mrchief Apr 20, 2012
d8101b7
Adding Parse support and changing acceptance tests to use RazorDocume…
jchadwick Apr 21, 2012
dde40be
Reorganizing test project
jchadwick Apr 21, 2012
9f7f004
Renaming ModelProviders directory
jchadwick Apr 21, 2012
c83b0e7
Tweaking the Web Browser behavior
jchadwick Apr 21, 2012
1e1d44a
Adding Messages tab
jchadwick Apr 21, 2012
f6393da
Adding ModelBuilderFactory and RazorPad.UI.Tests project to test it
jchadwick Apr 23, 2012
e7fb6a6
Final working version of the Model Provider/Builder implementation...…
jchadwick Apr 23, 2012
4cc8e75
Cleaning up AvalonDock refs
mrchief Apr 23, 2012
bcc9296
Cleaning up the RazorTemplateViewModel
jchadwick Apr 23, 2012
3c22ff4
Adding screenshot to serve as reference
mrchief Apr 23, 2012
be09207
UI For adding references complete (needs finishing touches)
mrchief Apr 24, 2012
85acad8
Some cleanup
jchadwick Apr 24, 2012
0428107
Adding persistence to IModelProvider
jchadwick Apr 24, 2012
7954ea8
Adding support for saving documents
jchadwick Apr 24, 2012
70870cf
Moving template execute off the UI thread (why was it on there to beg…
jchadwick Apr 24, 2012
9881c3d
Adding assembly refs works.
mrchief Apr 24, 2012
c25b9e1
Some more cleanup, error handling while reference add.
mrchief Apr 24, 2012
a993d88
.Net references tab shows currently loaded assemblies (needs bit of t…
mrchief Apr 24, 2012
4dedad3
Filtering out dynamic assemblies
mrchief Apr 24, 2012
3f09268
Finalizing .Net standard refs
mrchief Apr 25, 2012
10fd096
Added Installed refs tab.
mrchief Apr 26, 2012
a96825b
wiring up ModelBuilder choosing and dynamic (MEF) registration
jchadwick Apr 26, 2012
0f748d8
Fixing some bugs
jchadwick Apr 27, 2012
2b8a088
Adding RazorPad.Extensions sample
jchadwick Apr 27, 2012
bd7d0ac
- Recent Refs persistence, retrieval (crude way)
mrchief Apr 27, 2012
71f12e4
Renaming RazorPad.Extensions to RazorPad.Extensions.Xml
jchadwick Apr 28, 2012
446e211
Removing unused ModelProvider.ModelType
jchadwick Apr 28, 2012
530ccfd
Adding CSharp model provider
jchadwick Apr 28, 2012
29e8247
Wiring up ModelChanged in base view model
jchadwick Apr 28, 2012
80861ee
Synchronized listviews!
mrchief Apr 28, 2012
df86df9
Fixing ModelBuilder triggering an OnModelChanged
jchadwick Apr 28, 2012
7ae5c9b
Synchronized Views, filtering ... OMG!!!
mrchief Apr 28, 2012
9653e37
Merging with Assembly Refs branch.
mrchief Apr 28, 2012
06f60a1
Merge branch 'AssemblyRefs'
mrchief Apr 28, 2012
8950039
Fixing merge omissions
mrchief Apr 28, 2012
17fd45e
Fixed: Browsing and adding a reference shows in installed list
mrchief Apr 28, 2012
5005b4b
Refactoring to prepare for docking
jchadwick May 1, 2012
1069f9b
Refactoring file operations
jchadwick May 2, 2012
01dbdb3
Refactoring logic out of MainWindow
jchadwick May 2, 2012
fe6d4a1
Adding docking
jchadwick May 3, 2012
989baaf
Fixes and cleanup
jchadwick May 4, 2012
16991b9
Adding Errors pane
jchadwick May 4, 2012
6514add
Messing around with layout
jchadwick May 4, 2012
192628a
Basic AvalonEdit integration
jchadwick May 4, 2012
4106aaf
Moving CSharp Model Builder into base UI library
jchadwick May 4, 2012
a2f4e75
Adding AvalonEdit to main window
jchadwick May 4, 2012
8b9f018
Setting default background of Model Builder
jchadwick May 5, 2012
8dcae2f
Adding Theme Switching
jchadwick May 5, 2012
27234b6
Fixing XML writing
jchadwick May 5, 2012
6f0c363
AvalonEdit, 2-way binding, delay text notifier and all that jazz!
mrchief May 6, 2012
e06fd04
Introducing IModelBuilder
jchadwick May 10, 2012
6472f2a
Adding RazorPad.Contracts project
jchadwick May 10, 2012
db1c7b9
Adding RazorPad.Contracts project
jchadwick May 10, 2012
222f591
Cleanup/refactoring
jchadwick May 10, 2012
9460a6a
Moving View Models to RazorPad.UI so that the test project isn't refe…
jchadwick May 10, 2012
961a413
Cleanup and assorted awesomeness
jchadwick May 10, 2012
dc85dcd
Adding keyboard shortcuts
jchadwick May 10, 2012
da636c2
Cleaning up Assembly References UI
jchadwick May 10, 2012
efcc867
Refactoring Assembly References
jchadwick May 10, 2012
4305667
Adding Assembly References test (and fixing auto-generated tests)
jchadwick May 10, 2012
1476686
Updating Display Name when file name changes
jchadwick May 10, 2012
d08d44d
Adding Syntax Tree view
jchadwick May 10, 2012
7d30ee8
AE-ifying output windows
jchadwick May 10, 2012
6d5acec
Cleanup/refactoring IModelProviderFactory
jchadwick May 10, 2012
46d24a2
Stablizing file interaction
jchadwick May 10, 2012
de6b6ea
Updating Filename on save
jchadwick May 10, 2012
0134d84
Fixing CodeEditor ReadOnly
jchadwick May 10, 2012
cbfce76
Converting to 'real' logging
jchadwick May 10, 2012
357e715
Better handling of document saving
clearly May 10, 2012
31be024
Moving away from Tracing
jchadwick May 10, 2012
0091a9b
Revert "Better handling of document saving"
clearly May 10, 2012
ceaaa90
Merge branch 'master' of https://github.com/clearly/RazorPad
clearly May 10, 2012
113a7ef
Better SaveAs handling
clearly May 10, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ TestResults
_UpgradeReport_Files
UpgradeLog.XML

RazorPad.Web.Website/App_Data/Database
packages
*ncrunch*
*.DotSettings
*.crunchsolution.cache
6 changes: 6 additions & 0 deletions RazorPad.Contracts/IModelBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace RazorPad.UI
{
public interface IModelBuilder
{
}
}
8 changes: 8 additions & 0 deletions RazorPad.Contracts/IModelBuilderFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace RazorPad.UI
{
public interface IModelBuilderFactory
{
bool CanBuild(IModelProvider provider);
IModelBuilder Build(IModelProvider provider = null);
}
}
16 changes: 16 additions & 0 deletions RazorPad.Contracts/IModelProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace RazorPad
{
public interface IModelProvider
{
event EventHandler<RazorPadErrorEventArgs> Error;

event EventHandler ModelChanged;

dynamic GetModel();

string Serialize();
void Deserialize(string serialized);
}
}
7 changes: 7 additions & 0 deletions RazorPad.Contracts/IModelProviderFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace RazorPad
{
public interface IModelProviderFactory
{
IModelProvider Create();
}
}
12 changes: 12 additions & 0 deletions RazorPad.Contracts/IRazorDocumentLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.IO;

namespace RazorPad.Persistence
{
public interface IRazorDocumentLoader
{
RazorDocument Parse(string content);

RazorDocument Load(string uri);
RazorDocument Load(Stream stream);
}
}
43 changes: 43 additions & 0 deletions RazorPad.Contracts/IRazorDocumentSaver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Diagnostics;
using System.IO;

namespace RazorPad.Persistence
{
public interface IRazorDocumentSaver
{
void Save(RazorDocument document, Stream stream);
}

public static class RazorDocumentSaverExtensions
{
public static void Save(this IRazorDocumentSaver saver, RazorDocument document, string filename = null)
{
var destination = filename ?? document.Filename;

if (string.IsNullOrWhiteSpace(destination))
throw new ApplicationException("No filename specified!");

document.DocumentKind = RazorDocument.GetDocumentKind(filename);

FileInfo fiTarget = new FileInfo( destination );

if( fiTarget.Exists )
{
fiTarget.Delete();
}

using( var stream = fiTarget.OpenWrite() )
{
saver.Save(document, stream);

try { stream.Flush(); }
catch(Exception ex)
{
Trace.WriteLine("Error flushing file stream: " + ex);
}
}
}
}

}
19 changes: 19 additions & 0 deletions RazorPad.Contracts/ITemplateExecutor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace RazorPad.Compilation
{
public interface ITemplateExecutor
{
string Execute(string templateText, dynamic model, IEnumerable<string> assemblyReferences);
}

public static class TemplateExecutorExtensions
{
public static string Execute(this ITemplateExecutor executor, RazorDocument document)
{
Contract.Requires(document != null);
return executor.Execute(document.Template, document.GetModel(), document.References);
}
}
}
36 changes: 36 additions & 0 deletions RazorPad.Contracts/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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("RazorPad.Contracts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("RazorPad.Contracts")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("9a7d59e2-858d-4c3e-9673-cf82aec9a184")]

// 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")]
75 changes: 75 additions & 0 deletions RazorPad.Contracts/RazorDocument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace RazorPad
{
public class RazorDocument
{
public const string DefaultTemplateBaseClassName = "RazorPad.Compilation.TemplateBase";

public static readonly IEnumerable<string> SimpleTemplateExtensions =
new[] { ".txt", ".cshtml", ".vbhtml" };

public static volatile Func<string, RazorDocumentKind> GetDocumentKind =
GetDocumentKindInternal;

public string Filename { get; set; }

public IDictionary<string, string> Metadata { get; private set; }

public IModelProvider ModelProvider { get; set; }

public string Template { get; set; }

public string TemplateBaseClassName { get; set; }

public IEnumerable<string> References { get; set; }

public RazorDocumentKind DocumentKind
{
get { return _documentKind.GetValueOrDefault(GetDocumentKind(Filename)); }
set { _documentKind = value; }
}
private RazorDocumentKind? _documentKind;

public RazorDocument()
: this(null)
{
}

public RazorDocument(string template,
IEnumerable<string> references = null,
IModelProvider modelProvider = null,
IDictionary<string, string> metadata = null
)
{
Metadata = new Dictionary<string, string>(metadata ?? new Dictionary<string, string>());
ModelProvider = modelProvider;
References = references ?? Enumerable.Empty<string>();
Template = template ?? string.Empty;
TemplateBaseClassName = DefaultTemplateBaseClassName;
}

public dynamic GetModel()
{
if (ModelProvider == null)
return null;

return ModelProvider.GetModel();
}

private static RazorDocumentKind GetDocumentKindInternal(string filename)
{
if (!string.IsNullOrWhiteSpace(filename))
{
var extension = Path.GetExtension(filename);
if (SimpleTemplateExtensions.Contains(extension))
return RazorDocumentKind.TemplateOnly;
}

return RazorDocumentKind.Full;
}
}
}
8 changes: 8 additions & 0 deletions RazorPad.Contracts/RazorDocumentKind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace RazorPad
{
public enum RazorDocumentKind
{
TemplateOnly,
Full,
}
}
72 changes: 72 additions & 0 deletions RazorPad.Contracts/RazorPad.Contracts.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{92E04BBB-A022-41BA-A13C-1EB6C47DFFAE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RazorPad</RootNamespace>
<AssemblyName>RazorPad.Contracts</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\assets\RazorPad.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="IModelBuilder.cs" />
<Compile Include="IModelBuilderFactory.cs" />
<Compile Include="IModelProvider.cs" />
<Compile Include="IModelProviderFactory.cs" />
<Compile Include="IRazorDocumentLoader.cs" />
<Compile Include="IRazorDocumentSaver.cs" />
<Compile Include="ITemplateExecutor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RazorDocument.cs" />
<Compile Include="RazorDocumentKind.cs" />
<Compile Include="RazorPadError.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\assets\RazorPad.snk">
<Link>RazorPad.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.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>
16 changes: 16 additions & 0 deletions RazorPad.Contracts/RazorPad.Contracts.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ProjectConfiguration>
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
<RunPreBuildEvents>false</RunPreBuildEvents>
<RunPostBuildEvents>false</RunPostBuildEvents>
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
<InstrumentAssembly>true</InstrumentAssembly>
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<ProxyProcessPath />
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
</ProjectConfiguration>
41 changes: 41 additions & 0 deletions RazorPad.Contracts/RazorPadError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;

namespace RazorPad
{
public class RazorPadError
{
public int Line { get; set; }

public int Column { get; set; }

public string Message { get; set; }

public RazorPadError(string message = null)
{
Message = message;
}

public RazorPadError(Exception exception)
{
if (exception == null)
return;

Message = string.Format("EXCEPTION: {0}", exception.Message);
}

public override string ToString()
{
return string.Format("[{0}:{1}] {2}", Line, Column, Message);
}
}

public class RazorPadErrorEventArgs : EventArgs
{
public RazorPadError Error { get; private set; }

public RazorPadErrorEventArgs(RazorPadError error)
{
Error = error;
}
}
}
Loading