Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

License

  • Loading branch information...
commit 025af8a99668a1dcdefa3aebd74e4bd583526896 1 parent 5e64b17
Jeremy Skinner JeremySkinner authored
15 GitAspx.5.1.ReSharper
View
@@ -66,6 +66,21 @@
<XML>
<FormatSettings />
</XML>
+ <FileHeader Region="License"><![CDATA[Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx]]></FileHeader>
<GenerateMemberBody />
<Naming2>
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
43 GitAspx.Tests/BaseTest.cs
View
@@ -1,12 +1,30 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Tests {
- using System;
using System.IO;
+ using System.Linq;
using System.Net;
- using System.Web.Configuration;
using System.Xml.Linq;
using CassiniDev;
using NUnit.Framework;
- using System.Linq;
[TestFixture]
public class BaseTest : CassiniDevServer {
@@ -24,7 +42,7 @@ public class BaseTest : CassiniDevServer {
ChangeRepo("C:\\Repositories");
}
- private void ChangeRepo(string repoDir) {
+ void ChangeRepo(string repoDir) {
string path = "..\\..\\..\\GitAspx\\Web.config";
var doc = XDocument.Load(path);
@@ -38,10 +56,11 @@ public class BaseTest : CassiniDevServer {
protected HttpWebResponse Get(string url) {
try {
url = NormalizeUrl(url);
- var request = (HttpWebRequest)WebRequest.Create(url);
- return (HttpWebResponse)request.GetResponse();
+ var request = (HttpWebRequest) WebRequest.Create(url);
+ return (HttpWebResponse) request.GetResponse();
}
- catch(WebException e) { //wtf, why does WebRequest throw for non-200 status codes?!
+ catch (WebException e) {
+ //wtf, why does WebRequest throw for non-200 status codes?!
return (HttpWebResponse) e.Response;
}
}
@@ -49,15 +68,15 @@ public class BaseTest : CassiniDevServer {
public HttpWebResponse Post(string url, string contentType = null) {
try {
url = NormalizeUrl(url);
- var request = (HttpWebRequest)WebRequest.Create(url);
- if(contentType!=null) {
+ var request = (HttpWebRequest) WebRequest.Create(url);
+ if (contentType != null) {
request.ContentType = contentType;
}
request.Method = "POST";
- return (HttpWebResponse)request.GetResponse();
+ return (HttpWebResponse) request.GetResponse();
}
- catch(WebException e) {
- return (HttpWebResponse)e.Response;
+ catch (WebException e) {
+ return (HttpWebResponse) e.Response;
}
}
}
30 GitAspx.Tests/InfoRefsControllerTests.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Tests {
using System.IO;
using GitAspx.Controllers;
@@ -11,7 +31,10 @@ public class InfoRefsControllerTests {
[SetUp]
public void Setup() {
var dir = new DirectoryInfo("../../Repositories");
- this.controller = new InfoRefsController(new RepositoryService(new AppSettings { ReceivePack = true, UploadPack = true, RepositoriesDirectory = dir })).FakeContxt();
+ controller =
+ new InfoRefsController(
+ new RepositoryService(new AppSettings {ReceivePack = true, UploadPack = true, RepositoriesDirectory = dir})).
+ FakeContxt();
}
[Test]
@@ -26,16 +49,15 @@ public class InfoRefsControllerTests {
body.ShouldContain("0000009514bf0836c3371b740ebad55fbda6223bd7940f20 HEAD");
body.ShouldContain("multi_ack_detailed");
-*/ }
+*/
+ }
[Test]
public void Gets_receive_pack_advertisement() {
-
}
[Test]
public void Returns_404_when_repository_not_found() {
-
}
}
}
22 GitAspx.Tests/MainTests.cs
View
@@ -1,8 +1,26 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Tests {
- using System;
using System.Net;
using NUnit.Framework;
- using System.Linq;
// These tests are largely ported from GRack.
// They are all in one file to ensure the webserver is only started once (slooow)
35 GitAspx.Tests/MockHttpContext.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Tests {
using System;
using System.Collections;
@@ -7,19 +27,18 @@ namespace GitAspx.Tests {
using Moq;
public class MockHttpContext : Mock<HttpContextBase> {
-
readonly Mock<HttpServerUtilityBase> server = new Mock<HttpServerUtilityBase>();
public MockHttpContext() {
HttpRequest = new HttpRequestMock();
HttpResponse = new HttpResponseMock();
- Setup(c => c.Request).Returns(this.HttpRequest.Object);
- Setup(c => c.Response).Returns(this.HttpResponse.Object);
+ Setup(c => c.Request).Returns(HttpRequest.Object);
+ Setup(c => c.Response).Returns(HttpResponse.Object);
Setup(x => x.Session).Returns(new MockSessionState());
Setup(x => x.Server).Returns(server.Object);
Setup(x => x.Items).Returns(new Hashtable());
- this.SetupProperty(x => x.User);
+ SetupProperty(x => x.User);
}
public HttpRequestMock HttpRequest { get; private set; }
@@ -45,7 +64,6 @@ public class HttpRequestMock : Mock<HttpRequestBase> {
Setup(r => r.Form).Returns(form);
Setup(x => x.InputStream).Returns(inputStream);
}
-
}
public class HttpResponseMock : Mock<HttpResponseBase> {
@@ -57,14 +75,12 @@ public class HttpResponseMock : Mock<HttpResponseBase> {
Setup(x => x.OutputStream).Returns(outputStream);
SetupProperty(x => x.ContentType);
SetupProperty(x => x.StatusCode);
- Setup(x => x.Write(It.IsAny<string>())).Callback(new Action<string>(s => {
- writer.Write(s);
- }));
+ Setup(x => x.Write(It.IsAny<string>())).Callback(new Action<string>(s => { writer.Write(s); }));
}
}
public class MockSessionState : HttpSessionStateBase {
- private Hashtable hash = new Hashtable();
+ readonly Hashtable hash = new Hashtable();
public override object this[string name] {
get { return hash[name]; }
@@ -91,5 +107,4 @@ public class MockSessionState : HttpSessionStateBase {
hash.Clear();
}
}
-
}
24 GitAspx.Tests/TestExtensions.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Tests {
using System;
using System.IO;
@@ -36,10 +56,10 @@ public static class TestExtensions {
}
public static string[] SplitOnNewLine(this string str) {
- return str.Split(new[] { "\n" }, StringSplitOptions.None);
+ return str.Split(new[] {"\n"}, StringSplitOptions.None);
}
- public static T FakeContxt<T>(this T controller) where T:Controller {
+ public static T FakeContxt<T>(this T controller) where T : Controller {
var context = MockHttpContext.Create();
var cc = new ControllerContext(context, new RouteData(), controller);
controller.ControllerContext = cc;
36 GitAspx/Controllers/BaseController.cs
View
@@ -1,13 +1,29 @@
-using System.IO;
-using System.Web.Mvc;
+#region License
-namespace GitAspx.Controllers
-{
- using System.Linq;
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
+namespace GitAspx.Controllers {
+ using System.IO;
+ using System.Web.Mvc;
using GitAspx.Lib;
- public class BaseController : Controller
- {
+ public class BaseController : Controller {
public AppSettings AppSettings { get; set; }
protected string PktFlush() {
@@ -31,15 +47,15 @@ public class BaseController : Controller
}
protected bool HasAccess(Rpc rpc, bool checkContentType = false) {
- if(checkContentType && Request.ContentType != string.Format("application/x-git-{0}-request", rpc.GetDescription())) {
+ if (checkContentType && Request.ContentType != string.Format("application/x-git-{0}-request", rpc.GetDescription())) {
return false;
}
- if(rpc == Rpc.ReceivePack) {
+ if (rpc == Rpc.ReceivePack) {
return AppSettings.ReceivePack;
}
- if(rpc == Rpc.UploadPack) {
+ if (rpc == Rpc.UploadPack) {
return AppSettings.UploadPack;
}
29 GitAspx/Controllers/DirectoryListController.cs
View
@@ -1,11 +1,30 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Controllers {
using System.Web.Mvc;
using GitAspx.Lib;
using GitAspx.ViewModels;
public class DirectoryListController : Controller {
-
- RepositoryService repositories;
+ readonly RepositoryService repositories;
public DirectoryListController(RepositoryService repositories) {
this.repositories = repositories;
@@ -13,9 +32,9 @@ public class DirectoryListController : Controller {
public ActionResult Index() {
return View(new DirectoryListViewModel {
- RepositoriesDirectory = repositories.GetRepositoriesDirectory().FullName,
- Directories = repositories.GetAllRepositories()
- });
+ RepositoriesDirectory = repositories.GetRepositoriesDirectory().FullName,
+ Directories = repositories.GetAllRepositories()
+ });
}
}
}
29 GitAspx/Controllers/InfoRefsController.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Controllers {
using System.Web.Mvc;
using GitAspx.Lib;
@@ -5,7 +25,7 @@ namespace GitAspx.Controllers {
// Handles /project/info/refs
public class InfoRefsController : BaseController {
- RepositoryService repositories;
+ readonly RepositoryService repositories;
public InfoRefsController(RepositoryService repositories) {
this.repositories = repositories;
@@ -19,17 +39,16 @@ public class InfoRefsController : BaseController {
WriteNoCache();
var repository = repositories.GetRepository(project);
-
- if(repository == null) {
+
+ if (repository == null) {
return new NotFoundResult();
}
using (repository) {
-
Response.Write(PktWrite("# service=git-{0}\n", service));
Response.Write(PktFlush());
-
+
if (service == "upload-pack") {
var pack = new UploadPack(repository);
pack.sendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(new PacketLineOut(Response.OutputStream)));
26 GitAspx/Controllers/Rpc.cs
View
@@ -1,10 +1,28 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Controllers {
using System.ComponentModel;
public enum Rpc {
- [Description("upload-pack")]
- UploadPack,
- [Description("receive-pack")]
- ReceivePack
+ [Description("upload-pack")] UploadPack,
+ [Description("receive-pack")] ReceivePack
}
}
25 GitAspx/Controllers/RpcController.cs
View
@@ -1,6 +1,25 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Controllers {
using System;
- using System.IO;
using System.Web.Mvc;
using GitAspx.Lib;
using GitSharp.Core;
@@ -8,7 +27,7 @@ namespace GitAspx.Controllers {
// Handles project/git-upload-pack and project/git-receive-pack
public class RpcController : BaseController {
- RepositoryService repositories;
+ readonly RepositoryService repositories;
public RpcController(RepositoryService repositories) {
this.repositories = repositories;
@@ -31,7 +50,7 @@ public class RpcController : BaseController {
});
}
- private ActionResult ExecuteRpc(string project, Rpc rpc, Action<Repository> action) {
+ ActionResult ExecuteRpc(string project, Rpc rpc, Action<Repository> action) {
if (!HasAccess(Rpc.UploadPack, checkContentType: true)) {
return new ForbiddenResult();
}
25 GitAspx/Global.asax.cs
View
@@ -1,5 +1,24 @@
-namespace GitAspx {
- using System;
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
+namespace GitAspx {
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
@@ -39,7 +58,7 @@ public class MvcApplication : HttpApplication {
ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());
}
- private class AppRegistry : Registry {
+ class AppRegistry : Registry {
public AppRegistry() {
For<AppSettings>()
.Singleton()
29 GitAspx/Helpers.cs
View
@@ -1,19 +1,40 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx {
using System;
using System.ComponentModel;
- using System.Reflection;
using System.Web.Mvc;
using System.Web.Routing;
public static class Helpers {
public static string ProjectUrl(this UrlHelper urlHelper, string project) {
- return urlHelper.RouteUrl("project", new RouteValueDictionary(new { project }), urlHelper.RequestContext.HttpContext.Request.Url.Scheme, urlHelper.RequestContext.HttpContext.Request.Url.Host);
+ return urlHelper.RouteUrl("project", new RouteValueDictionary(new {project}),
+ urlHelper.RequestContext.HttpContext.Request.Url.Scheme,
+ urlHelper.RequestContext.HttpContext.Request.Url.Host);
}
public static string GetDescription(this Enum e) {
var field = e.GetType().GetField(e.ToString());
- var attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
-
+ var attributes = (DescriptionAttribute[]) field.GetCustomAttributes(typeof (DescriptionAttribute), false);
+
if (attributes.Length > 0) {
return attributes[0].Description;
}
31 GitAspx/Lib/AppSettings.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Lib {
using System;
using System.Configuration;
@@ -18,7 +38,8 @@ public class AppSettings {
}
if (!Directory.Exists(path)) {
- throw new DirectoryNotFoundException(string.Format("Could not find the directory '{0}' which is configured as the directory of repositories.", path));
+ throw new DirectoryNotFoundException(
+ string.Format("Could not find the directory '{0}' which is configured as the directory of repositories.", path));
}
settings.RepositoriesDirectory = new DirectoryInfo(path);
@@ -30,17 +51,15 @@ public class AppSettings {
bool uploadpack;
bool receivePack;
- if(!string.IsNullOrEmpty(uploadPackRaw) && bool.TryParse(uploadPackRaw, out uploadpack)) {
+ if (!string.IsNullOrEmpty(uploadPackRaw) && bool.TryParse(uploadPackRaw, out uploadpack)) {
settings.UploadPack = uploadpack;
}
-
- if(!string.IsNullOrEmpty(receivePackRaw) && bool.TryParse(receivePackRaw, out receivePack)) {
+
+ if (!string.IsNullOrEmpty(receivePackRaw) && bool.TryParse(receivePackRaw, out receivePack)) {
settings.ReceivePack = receivePack;
}
return settings;
}
-
}
-
}
21 GitAspx/Lib/ForbiddenResult.cs
View
@@ -1,5 +1,24 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Lib {
- using System;
using System.Web.Mvc;
public class ForbiddenResult : ActionResult {
21 GitAspx/Lib/NotFoundResult.cs
View
@@ -1,5 +1,24 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Lib {
- using System;
using System.Web.Mvc;
public class NotFoundResult : ActionResult {
25 GitAspx/Lib/RepositoryService.cs
View
@@ -1,11 +1,30 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Lib {
using System.Collections.Generic;
using System.IO;
- using System.Linq;
using GitSharp.Core;
public class RepositoryService {
- AppSettings appSettings;
+ readonly AppSettings appSettings;
public RepositoryService(AppSettings appSettings) {
this.appSettings = appSettings;
@@ -18,7 +37,7 @@ public class RepositoryService {
public Repository GetRepository(string project) {
var directory = Path.Combine(appSettings.RepositoriesDirectory.FullName, project);
- if(!Directory.Exists(directory)) {
+ if (!Directory.Exists(directory)) {
return null;
}
26 GitAspx/Lib/StructureMapControllerFactory.cs
View
@@ -1,14 +1,36 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.Lib {
+ using System;
using System.Web.Mvc;
+ using System.Web.Routing;
using GitAspx.Controllers;
using StructureMap;
public class StructureMapControllerFactory : DefaultControllerFactory {
- protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, System.Type controllerType) {
+ protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) {
var controller = (IController) ObjectFactory.GetInstance(controllerType);
var baseCon = controller as BaseController;
- if(baseCon != null) {
+ if (baseCon != null) {
baseCon.AppSettings = ObjectFactory.GetInstance<AppSettings>();
}
20 GitAspx/ViewModels/DirectoryListViewModel.cs
View
@@ -1,3 +1,23 @@
+#region License
+
+// Copyright 2010 Jeremy Skinner (http://www.jeremyskinner.co.uk)
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// The latest version of this file can be found at http://github.com/JeremySkinner/git-dot-aspx
+
+#endregion
+
namespace GitAspx.ViewModels {
using System.Collections.Generic;
using System.IO;
176 License.txt
View
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
36 lib/GitSharp/GitSharp licence.txt
View
@@ -0,0 +1,36 @@
+Git# is Copyright (C) 2007-2009 by the Git Development Community
+See source file headers for specific contributor copyrights
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+- Neither the name of the Git Development Community nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
Please sign in to comment.
Something went wrong with that request. Please try again.