11using Nancy ;
2+ using SvnManager . WebUI . Code ;
23using System . Collections . Generic ;
3- using System . Configuration ;
44using System . Diagnostics ;
55using System . IO ;
66using System . Linq ;
77using System . Reflection ;
88
99namespace SvnManager . WebUI
1010{
11- public class RepositoriesModule : NancyModule
11+ public class RepositoriesModule : SvnBaseModule
1212 {
13- private static string RepoPath => ConfigurationManager . AppSettings [ "Manager.RepoPath" ] ;
14- private static string SvnLocation => ConfigurationManager . AppSettings [ "SvnLocation" ] ;
15-
1613 public RepositoriesModule ( ) : base ( "/api/repositories" )
1714 {
1815 Get [ "/" ] = x =>
@@ -25,33 +22,34 @@ public RepositoriesModule() : base("/api/repositories")
2522 {
2623 using ( Process p = new Process ( ) )
2724 {
28- p . StartInfo = new ProcessStartInfo ( $@ "{ SvnLocation } \svnadmin", $@ "create { x . name } ")
25+ p . StartInfo = new ProcessStartInfo ( $@ "{ SvnLocation } \svnadmin", $@ "create { Path . Combine ( RepoPath , x . name ) } ")
2926 {
30- WorkingDirectory = RepoPath ,
27+ UseShellExecute = false ,
28+ WorkingDirectory = SvnLocation ,
3129 RedirectStandardError = true
3230 } ;
3331 p . Start ( ) ;
3432 p . WaitForExit ( ) ;
3533 }
3634
3735 // This gives all users read/write access
38- string svnAuthz = File . ReadAllText ( $@ "C:\Repositories\ { x . name } \conf\SvnAuthz.ini ") ;
36+ string svnAuthz = File . ReadAllText ( $@ "{ RepoPath } \ { x . name } \conf\authz ") ;
3937 svnAuthz += "\r \n \r \n [/]\r \n *=rw" ;
40- File . WriteAllText ( $@ "C:\Repositories\ { x . name } \conf\SvnAuthz.ini ", svnAuthz ) ;
38+ File . WriteAllText ( $@ "{ RepoPath } \ { x . name } \conf\authz ", svnAuthz ) ;
4139
4240 // pre-commit hook to require commit messages
43- using ( var resource = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "SvnManager.Api .SvnHooks.pre-commit.cmd" ) )
41+ using ( var resource = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "SvnManager.WebUI .SvnHooks.pre-commit.cmd" ) )
4442 {
45- using ( var file = new FileStream ( $@ "C:\Repositories \{ x . name } \hooks\pre-commit.cmd", FileMode . Create , FileAccess . Write ) )
43+ using ( var file = new FileStream ( $@ "{ RepoPath } \{ x . name } \hooks\pre-commit.cmd", FileMode . Create , FileAccess . Write ) )
4644 {
4745 resource . CopyTo ( file ) ;
4846 }
4947 }
5048
5149 // pre-revprop-change hook to allow for using svnsync
52- using ( var resource = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "SvnManager.Api .SvnHooks.pre-revprop-change.cmd" ) )
50+ using ( var resource = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "SvnManager.WebUI .SvnHooks.pre-revprop-change.cmd" ) )
5351 {
54- using ( var file = new FileStream ( $@ "C:\Repositories \{ x . name } \hooks\pre-revprop-change.cmd", FileMode . Create , FileAccess . Write ) )
52+ using ( var file = new FileStream ( $@ "{ RepoPath } \{ x . name } \hooks\pre-revprop-change.cmd", FileMode . Create , FileAccess . Write ) )
5553 {
5654 resource . CopyTo ( file ) ;
5755 }
0 commit comments