Skip to content

Commit

Permalink
Replacing RazorGenerator custom tool with msbuild task
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkm committed Dec 12, 2011
1 parent eb0b39e commit 9d7862e
Show file tree
Hide file tree
Showing 53 changed files with 176 additions and 8,817 deletions.
Binary file added 3rdParty/RazorGenerator/RazorGenerator.Core.dll
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions 3rdParty/RazorGenerator/RazorGenerator.targets
@@ -0,0 +1,23 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RazorGeneratorMsBuildPath Condition=" '$(RazorGeneratorMsBuildPath)' == '' ">$(MSBuildThisFileDirectory)\RazorGenerator.MsBuild.dll</RazorGeneratorMsBuildPath>

<CompileDependsOn>
PrecompileRazorFiles;
$(CompileDependsOn);
</CompileDependsOn>
</PropertyGroup>

<UsingTask AssemblyFile="$(RazorGeneratorMsBuildPath)" TaskName="RazorCodeGen" />
<Target Name="PrecompileRazorFiles" Returns="@(FilesGenerated)">
<ItemGroup>
<RazorSrcFiles Include="**\*.cshtml" />
</ItemGroup>
<RazorCodeGen ProjectRoot="$(MsBuildProjectDirectory)" FilesToPrecompile="@(RazorSrcFiles)" RootNamespace="$(RootNamespace)">
<Output TaskParameter="GeneratedFiles" ItemName="FilesGenerated" />
</RazorCodeGen>
<ItemGroup>
<Compile Include="@(FilesGenerated)" />
</ItemGroup>
</Target>
</Project>
6 changes: 1 addition & 5 deletions Scripts/NuGetGallery.msbuild
Expand Up @@ -28,12 +28,8 @@
<UpdateDatabase /> <UpdateDatabase />
</Target> </Target>


<Target Name="BuildViews" DependsOnTargets="Build">
<MSBuild Projects="..\Website\Website.csproj" Targets="MvcBuildViews" Properties="MvcBuildViews=true" />
</Target>

<Target Name="CIBuild" DependsOnTargets="RunFacts" /> <Target Name="CIBuild" DependsOnTargets="RunFacts" />


<Target Name="FullBuild" DependsOnTargets="RunFacts;UpdateDatabase;BuildViews" /> <Target Name="FullBuild" DependsOnTargets="RunFacts;UpdateDatabase" />


</Project> </Project>
@@ -1,93 +1,95 @@
@* Generator: MvcHelper *@ @* Generator: MvcHelper *@


@using System.Linq; @using System.Linq;
@using System.Collections; @using System.Collections;
@using NuGetGallery; @using System.Web.Mvc;

@using Microsoft.Web.Helpers;
@helper PreviousNextPager(IPreviousNextPager pager) { @using NuGetGallery;
if (pager.HasNextPage || pager.HasPreviousPage) {
<ul class="pager"> @helper PreviousNextPager(IPreviousNextPager pager) {
<li class="previous"> if (pager.HasNextPage || pager.HasPreviousPage) {
@if (pager.HasPreviousPage) { <ul class="pager">
<a href="@pager.PreviousPageUrl" title="Go to the previous page.">Previous</a> <li class="previous">
} @if (pager.HasPreviousPage) {
else { <a href="@pager.PreviousPageUrl" title="Go to the previous page.">Previous</a>
<text>Previous</text> }
} else {
</li> <text>Previous</text>
<li class="next"> }
@if (pager.HasNextPage) { </li>
<a href="@pager.NextPageUrl" title="Go to the next page.">Next</a> <li class="next">
} @if (pager.HasNextPage) {
else { <a href="@pager.NextPageUrl" title="Go to the next page.">Next</a>
<text>Next</text> }
} else {
</li> <text>Next</text>
</ul> }
} </li>
} </ul>

}
@helper Option(string value, string label, string currentValue) { }
<option value="@value" @if (value == currentValue) {<text>selected="selected"</text>}>@label</option>
} @helper Option(string value, string label, string currentValue) {

<option value="@value" @if (value == currentValue) {<text>selected="selected"</text>}>@label</option>
@helper UploadSequence(int currentStep) { }
<ol class="sequence">
@SequenceStep(1, "Upload", currentStep) @helper UploadSequence(int currentStep) {
@SequenceStep(2, "Verify Details", currentStep) <ol class="sequence">
@SequenceStep(3, "Enjoy", currentStep) @SequenceStep(1, "Upload", currentStep)
</ol> @SequenceStep(2, "Verify Details", currentStep)
<div class="clear-fix"><!--Sad Panda--></div> @SequenceStep(3, "Enjoy", currentStep)
} </ol>

<div class="clear-fix"><!--Sad Panda--></div>
@helper SequenceStep(int step, string caption, int currentStep) { }
if (currentStep > step) {
<li class="past">@caption</li> @helper SequenceStep(int step, string caption, int currentStep) {
} if (currentStep > step) {
else if (currentStep == step) { <li class="past">@caption</li>
<li class="current">@caption</li> }
} else if (currentStep == step) {
else { <li class="current">@caption</li>
<li>@caption</li> }
} else {
} <li>@caption</li>

}
@helper OwnersGravatar(IEnumerable<User> owners, int size, UrlHelper url, bool showName = true) { }
<ul class="owners">
@foreach (var owner in owners) { @helper OwnersGravatar(IEnumerable<User> owners, int size, UrlHelper url, bool showName = true) {
<li> <ul class="owners">
@ViewHelpers.OwnerGravatar(owner, size, url, showName) @foreach (var owner in owners) {
</li> <li>
} @ViewHelpers.OwnerGravatar(owner, size, url, showName)
</ul> </li>
} }

</ul>
@helper OwnerGravatar(User owner, int size, UrlHelper url, bool showName = true) { }
<a class="owner" href="@url.Action(MVC.Users.Profiles(owner.Username))" title="@owner.Username">
@GravatarImage(owner.EmailAddress, owner.Username, size) @helper OwnerGravatar(User owner, int size, UrlHelper url, bool showName = true) {
@if (showName) { <a class="owner" href="@url.Action(MVC.Users.Profiles(owner.Username))" title="@owner.Username">
<text>@owner.Username</text> @GravatarImage(owner.EmailAddress, owner.Username, size)
} @if (showName) {
</a> <text>@owner.Username</text>
} }

</a>
@helper GravatarImage(string email, string username, int size) { }
<text>
@Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" }) @helper GravatarImage(string email, string username, int size) {
</text> <text>
} @Gravatar.GetHtml(email, size, "retro", GravatarRating.G, attributes: new { width = size, height = size, title = username, @class = "owner-image" })

</text>
@helper ReleaseTag(){ }
string name = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseName"];
string sha = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseSha"]; @helper ReleaseTag(){
string branch = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseBranch"]; string name = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseName"];
string time = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseTime"]; string sha = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseSha"];
if(!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(sha) && !String.IsNullOrEmpty(branch) && !String.IsNullOrEmpty(time)){ string branch = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseBranch"];
<p id="releaseTag"> string time = System.Configuration.ConfigurationManager.AppSettings["Gallery:ReleaseTime"];
@name - if(!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(sha) && !String.IsNullOrEmpty(branch) && !String.IsNullOrEmpty(time)){
Deployed from <a href="https://github.com/NuGet/NuGetGallery/commit/@sha" title="View the commit.">@sha.Substring(0,10)</a> <p id="releaseTag">
on <a href="https://github.com/NuGet/NuGetGallery/branches/@branch" title="View the branch.">@branch</a> @name -
at @time. Deployed from <a href="https://github.com/NuGet/NuGetGallery/commit/@sha" title="View the commit.">@sha.Substring(0,10)</a>
</p> on <a href="https://github.com/NuGet/NuGetGallery/branches/@branch" title="View the branch.">@branch</a>
} at @time.
</p>
}
} }
36 changes: 1 addition & 35 deletions Website/AuthenticationController.generated.cs
Expand Up @@ -20,14 +20,8 @@
using System.Web.Mvc.Html; using System.Web.Mvc.Html;
using System.Web.Routing; using System.Web.Routing;
using T4MVC; using T4MVC;



namespace NuGetGallery { namespace NuGetGallery {

public partial class AuthenticationController { public partial class AuthenticationController {


[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected AuthenticationController(Dummy d) { } protected AuthenticationController(Dummy d) { }


Expand All @@ -37,14 +31,12 @@ public partial class AuthenticationController {
return RedirectToRoute(callInfo.RouteValueDictionary); return RedirectToRoute(callInfo.RouteValueDictionary);
} }



[NonAction] [NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public System.Web.Mvc.ActionResult LogOff() { public System.Web.Mvc.ActionResult LogOff() {
return new T4MVC_ActionResult(Area, Name, ActionNames.LogOff); return new T4MVC_ActionResult(Area, Name, ActionNames.LogOff);
} }



[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public AuthenticationController Actions { get { return MVC.Authentication; } } public AuthenticationController Actions { get { return MVC.Authentication; } }
[GeneratedCode("T4MVC", "2.0")] [GeneratedCode("T4MVC", "2.0")]
Expand All @@ -57,70 +49,44 @@ public partial class AuthenticationController {
public ActionNamesClass ActionNames { get { return s_actions; } } public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass { public class ActionNamesClass {


public readonly string LogOn = "LogOn"; public readonly string LogOn = "LogOn";


public readonly string LogOff = "LogOff"; public readonly string LogOff = "LogOff";

} }





static readonly ViewNames s_views = new ViewNames(); static readonly ViewNames s_views = new ViewNames();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewNames Views { get { return s_views; } } public ViewNames Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewNames { public class ViewNames {
public readonly string LogOn = "~/Views/Authentication/LogOn.cshtml"; public readonly string LogOn = "~/Views/Authentication/LogOn.cshtml";

} }
} }



[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class T4MVC_AuthenticationController: NuGetGallery.AuthenticationController { public class T4MVC_AuthenticationController: NuGetGallery.AuthenticationController {
public T4MVC_AuthenticationController() : base(Dummy.Instance) { } public T4MVC_AuthenticationController() : base(Dummy.Instance) { }



public override System.Web.Mvc.ActionResult LogOn() { public override System.Web.Mvc.ActionResult LogOn() {
var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOn); var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOn);

return callInfo; return callInfo;
} }



public override System.Web.Mvc.ActionResult LogOn(NuGetGallery.SignInRequest request, string returnUrl) { public override System.Web.Mvc.ActionResult LogOn(NuGetGallery.SignInRequest request, string returnUrl) {
var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOn); var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOn);


callInfo.RouteValueDictionary.Add("request", request); callInfo.RouteValueDictionary.Add("request", request);

callInfo.RouteValueDictionary.Add("returnUrl", returnUrl); callInfo.RouteValueDictionary.Add("returnUrl", returnUrl);


return callInfo; return callInfo;
} }



public override System.Web.Mvc.ActionResult LogOff(string returnUrl) { public override System.Web.Mvc.ActionResult LogOff(string returnUrl) {
var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOff); var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.LogOff);


callInfo.RouteValueDictionary.Add("returnUrl", returnUrl); callInfo.RouteValueDictionary.Add("returnUrl", returnUrl);


return callInfo; return callInfo;
} }



} }


} }




#endregion T4MVC #endregion T4MVC
#pragma warning restore 1591 #pragma warning restore 1591
7 changes: 0 additions & 7 deletions Website/Controllers/ForgotPasswordViewModel.cs

This file was deleted.

46 changes: 0 additions & 46 deletions Website/DataServices/FeedPackage.cs

This file was deleted.

3 changes: 0 additions & 3 deletions Website/DataServices/Feeds.svc

This file was deleted.

0 comments on commit 9d7862e

Please sign in to comment.