CreateDirectory() public abstract method

public abstract CreateDirectory ( string fullPath ) : void
fullPath string
return void
        public void stay_with_the_default_if_no_other_config_file_is_found()
        {
            var fileSystem = new FileSystem();

            fileSystem.DeleteDirectory("Service");

            fileSystem.CreateDirectory("Service");
            fileSystem.CreateDirectory("Service", "bin");

            var expression = new RemoteDomainExpression();
            expression.ServiceDirectory = "Service";
            Path.GetFileName(expression.Setup.ConfigurationFile).ShouldEqual("BottleServiceRunner.exe.config");
        }
        public void use_web_config_if_it_exists()
        {
            var fileSystem = new FileSystem();

            fileSystem.DeleteDirectory("Service");

            fileSystem.CreateDirectory("Service");
            fileSystem.CreateDirectory("Service", "bin");
            fileSystem.WriteStringToFile("Service".AppendPath("Web.config"), "foo");

            var expression = new RemoteDomainExpression();
            expression.ServiceDirectory = "Service";
            Path.GetFileName(expression.Setup.ConfigurationFile).ShouldEqual("web.config");
        }
Example #3
0
        public void SetUp()
        {
            theCodeDir = ".".AppendPath("code");
            theSolutionDir = theCodeDir.AppendPath("ripple");
            theCurrentDir = theSolutionDir.AppendPath("src", "project1");

            var fileSystem = new FileSystem();
            fileSystem.CreateDirectory(theCodeDir);
            fileSystem.CreateDirectory(theSolutionDir);
            fileSystem.CreateDirectory(theCurrentDir);

            fileSystem.WriteStringToFile(Path.Combine(theSolutionDir, SolutionFiles.ConfigFile), "");

            RippleFileSystem.StubCurrentDirectory(theCurrentDir);
        }
Example #4
0
        public void ExportTo(string directory, Topic root, Func<Topic, string> pathing)
        {
            var fileSystem = new FileSystem();

            string sourceContent = _settings.Root.AppendPath("content");
            if (fileSystem.DirectoryExists(sourceContent))
            {
                fileSystem.CopyToDirectory(sourceContent, directory.AppendPath("content"));
            }

            root.AllTopicsInOrder().Each(topic =>
            {
                var path = pathing(topic);
                var parentDirectory = path.ParentUrl();

                if (parentDirectory.IsNotEmpty())
                {
                    fileSystem.CreateDirectory(directory.AppendPath(parentDirectory));
                }
                

                var text = _generator.Generate(topic);

                // Hoakum
                topic.Substitutions.Each((key, value) =>
                {
                    text = text.Replace(key, value);
                });

                fileSystem.WriteStringToFile(directory.AppendPath(path), text);
            });
        }
        public void SetUp()
        {
            var system = new FileSystem();
            system.DeleteDirectory("geonosis");
            system.CreateDirectory("geonosis");

            var data1 = newData();
            var data2 = newData();
            var data3 = newData();
            var data4 = newData();
            var data5 = newData();
            var data6 = newData();
            var data7 = newData();

            saveData(data1, "a", "a1");
            saveData(data2, "a", "a2");
            saveData(data3, "b", "b3");
            saveData(data4, "b", "b4");
            saveData(data5, "c", "c5");
            saveData(data6, "c", "c6");
            saveData(data7, "c", "c7");

            var data8 = newData();
            data8["pak1"] = "pak1-value";
            PackageSettingsSource.WriteToDirectory(data8, "geonosis".AppendPath("a"));

            theCache = new PackageFilesCache();
            theCache.AddDirectory(FileSystem.Combine("geonosis", "a"));
            theCache.AddDirectory(FileSystem.Combine("geonosis", "b"));
            theCache.AddDirectory(FileSystem.Combine("geonosis", "c"));
        }
        public void SetUp()
        {
            var system = new FileSystem();
            system.DeleteDirectory("geonosis");
            system.CreateDirectory("geonosis");

            var data1 = newData();
            var data2 = newData();
            var data3 = newData();
            var data4 = newData();
            var data5 = newData();
            var data6 = newData();
            var data7 = newData();

            saveData(data1, "a", "a1");
            saveData(data2, "a", "a2");
            saveData(data3, "b", "b3");
            saveData(data4, "b", "b4");
            saveData(data5, "c", "c5");
            saveData(data6, "c", "c6");
            saveData(data7, "c", "c7");

            theCache = new PackageFilesCache();
            theCache.AddDirectory(FileSystem.Combine("geonosis", "a"));
            theCache.AddDirectory(FileSystem.Combine("geonosis", "b"));
            theCache.AddDirectory(FileSystem.Combine("geonosis", "c"));
        }
        public void SetUp()
        {
            theFileSystem = new FileSystem();
            theSolutionDir = Guid.NewGuid().ToString().ToFullPath();

            theFileSystem.CreateDirectory(theSolutionDir);
            theFileSystem.CreateDirectory(theSolutionDir, "src");
            theFileSystem.WriteStringToFile(Path.Combine(theSolutionDir, "src", "Solution.sln"), "");

            createProject("ProjectA");
            createProject("ProjectB");
            createProject("ProjectC");

            RippleFileSystem.StopTraversingAt(theSolutionDir.ParentDirectory());
            RippleFileSystem.StubCurrentDirectory(theSolutionDir);

            new InitCommand().Execute(new InitInput { Name = "Test" });
        }
        public void plan_for_directory()
        {
            var fileSystem = new FileSystem();
            fileSystem.CreateDirectory("deep-root");
            fileSystem.CleanDirectory("deep-root");
            fileSystem.CreateDirectory("deep-root", "foo", "bar");
            fileSystem.CreateDirectory("deep-root", "src");
            fileSystem.CreateDirectory("deep-root", "packaging", "nuget");

            var directories = SolutionDirectory.PlanForDirectory("deep-root");
            directories.OrderBy(x => x.RelativePath).ShouldHaveTheSameElementsAs(
                new SolutionDirectory("foo"),
                new SolutionDirectory("foo/bar"),
                new SolutionDirectory("packaging"),
                new SolutionDirectory("packaging/nuget"),
                new SolutionDirectory("src")
                );
        }
        public void find_file_with_no_rakefile()
        {
            var fileSystem = new FileSystem();
            fileSystem.DeleteDirectory("sd");
            fileSystem.CreateDirectory("sd");

            RakeFileTransform.FindFile("sd").ToLower()
                .ShouldEqual("sd".AppendPath("rakefile").ToFullPath().ToLower());
        }
        public void find_file_with_rakefile()
        {
            var fileSystem = new FileSystem();
            fileSystem.DeleteDirectory("oak");
            fileSystem.CreateDirectory("oak");

            fileSystem.WriteStringToFile("oak".AppendPath("rakefile"), "something");

            RakeFileTransform.FindFile("oak").ToLower()
                .ShouldEqual("oak".AppendPath("rakefile").ToFullPath().ToLower());
        }
		public static FileScenario Create(Action<FileScenarioDefinition> configure)
		{
			var directory = Path.GetTempPath().AppendRandomPath();
			var fileSystem = new FileSystem();
			fileSystem.CreateDirectory(directory);

			var definition = new FileScenarioDefinition(directory);
			configure(definition);

			return new FileScenario(directory, fileSystem);
		}
Example #12
0
        public static void SaveResult(TestResult result, Test test, string folder)
        {
            result.Locator = test.GetPath().Locator;

            var fileSystem = new FileSystem();
            fileSystem.CreateDirectory(folder);

            var filename = Path.Combine(folder, FileNameFor(test));

            fileSystem.PersistToFile(result, filename);
        }
        public void SetUp()
        {
            var system = new FileSystem();
            system.DeleteDirectory("package1");

            system.CreateDirectory("package1");
            system.CreateDirectory("package1", "bin");
            system.CreateDirectory("package1", "WebContent");
            system.CreateDirectory("package1", "Data");

            theOriginalManifest = new PackageManifest
            {
                Assemblies = new[] { "a", "b", "c" },
                Name = "Extraordinary"
            };

            theOriginalManifest.AddDependency("bottle1", true);
            theOriginalManifest.AddDependency("bottle2", true);
            theOriginalManifest.AddDependency("bottle3", false);

            theOriginalManifest.WriteTo("package1");

            thePackage = new PackageManifestReader(new FileSystem(), directory => directory.AppendPath("WebContent")).LoadFromFolder("package1");
        }
Example #14
0
        public void SetUp()
        {
            theDirectory = ".".AppendPath("local-feed").ToFullPath();
            theFileSystem = new FileSystem();

            theFileSystem.CreateDirectory(theDirectory);

            createNuget("FubuCore", "0.9.9.9");
            createNuget("FubuCore", "1.0.0.0");
            createNuget("Bottles", "1.0.0.0");

            createNuget("FubuNew", "1.0.0.0");
            createNuget("FubuNew", "1.0.0.1-alpha");

            theFeed = new FileSystemNugetFeed(theDirectory, NugetStability.ReleasedOnly);
        }
        public void SetUp()
        {
            theDirectory = ".".AppendPath("local-feed").ToFullPath();
            theFileSystem = new FileSystem();

            theFileSystem.CreateDirectory(theDirectory);

            createNuget("FubuCore", "0.9.9.9");
            createNuget("fubuCore", "0.9.9.82819");
			createNuget("FubuCore", "1.0.0.0");
            createNuget("Bottles", "1.0.0.0");

            createNuget("ExtendHealth.Quoting.Imm.Data", "2.2.0.275");
            createNuget("ExtendHealth.Quoting.Imm.Data", "2.2.0.249");

            createNuget("FubuNew", "1.0.0.0");
            createNuget("FubuNew", "1.0.0.1-alpha");

            theFeed = new FloatingFileSystemNugetFeed(theDirectory, NugetStability.Anything);
        }
Example #16
0
        /// <summary>
        /// Create an assignment
        /// </summary>
        public int Create(int courseID, string creator, string desc, DateTime duedate)
        {
            //Check perm
            Authorize(courseID, Permission.COURSE, "createasst", courseID, null);

            Assignment asst = new Assignment();
            asst.CourseID = courseID;
            asst.Creator = creator;
            asst.Description = desc;
            asst.DueDate = duedate;
            asst.Format = Assignment.DEFAULT_FORMAT;

            //Create
            m_dp.CreateAssignment(asst);

            //Setup default permissions
            CreatePermissions(asst.ID, courseID, Permission.ASSIGNMENT);

            //Setup default file permissions
            Courses courseda = new Courses(m_ident);
            CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
            CourseRole.CourseRoleList staff = courseda.GetTypedRoles(courseID, true, null);
            CourseRole.CourseRoleList stu = courseda.GetTypedRoles(courseID, false, null);
            foreach (CourseRole role in staff)
                perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));

            foreach (CourseRole role in stu)
                perms.Add(new CFilePermission(role.PrincipalID, FileAction.READ, true));

            //Create content area
            FileSystem fs = new FileSystem(m_ident);
            CFile cdir = fs.CreateDirectory(@"c:\acontent\" + asst.ID, false, perms, false);
            asst.ContentID = cdir.ID;
            Update(asst);

            //Log
            Log("Created assignment: " + desc, asst.ID);

            return asst.ID;
        }
Example #17
0
        /// <summary>
        /// Create the course
        /// </summary>
        public bool Create(string name, string number, string instructor)
        {
            Course course = new Course();

            //TODO: Verify these values
            course.Name = name;
            course.Number = number;

            //Create course
            m_dp.CreateCourse(course);

            //Get all data
            course = GetInfo(course.ID);

            //Define default roles
            CourseRole role = new CourseRole();
            role.CourseID = course.ID;
            role.Name = "Student"; role.Staff = false;
            m_dp.CreateCourseRole(role);
            role.Name = "TA"; role.Staff = true;
            m_dp.CreateCourseRole(role);
            role.Name = "Instructor"; role.Staff = true;
            m_dp.CreateCourseRole(role);

            //Assign filesys permissions
            CourseRole student = GetRoleInfo("Student", course.ID);
            CourseRole ta = GetRoleInfo("TA", course.ID);
            CourseRole ins = GetRoleInfo("Instructor", course.ID);
            CFilePermission.FilePermissionList full = new CFilePermission.FilePermissionList();
            full.AddRange(CFilePermission.CreateFullAccess(ta.PrincipalID));
            full.AddRange(CFilePermission.CreateFullAccess(ins.PrincipalID));
            full.Add(new CFilePermission(student.PrincipalID, FileAction.READ, true));

            //Create content area
            FileSystem fs = new FileSystem(m_ident);
            string cpath = @"c:\ccontent\" + course.ID;
            CFile cdir = fs.CreateDirectory(cpath, false, full);

            course.ContentID = cdir.ID;
            Update(course);
            CFile ldir = fs.CreateDirectory(cpath + @"\" + "lnotes", false, null);
            ldir.Alias = "Lecture Notes"; fs.UpdateFileInfo(ldir, false);

            //Put operator in course temporarily
            m_dp.CreateCourseMember(m_ident.Name, course.ID, "Instructor", null);

            //Assign course perms
            CreatePermissions(course.ID, course.ID, Permission.COURSE);

            if (instructor != m_ident.Name) {
                //Add instructor
                AddUser(instructor, "Instructor", course.ID, null);

                //Take operator out
                RemoveUser(m_ident.Name, course.ID);
            }

            return true;
        }
        public void SetUp()
        {
            var system = new FileSystem();
            system.DeleteDirectory("localization1");
            system.DeleteDirectory("localization2");
            system.DeleteDirectory("localization3");

            system.CreateDirectory("localization1");
            system.CreateDirectory("localization2");
            system.CreateDirectory("localization3");
        }
        public void SetUp()
        {
            var fileSystem = new FileSystem();
            fileSystem.DeleteDirectory("hoth");
            fileSystem.CreateDirectory("hoth");

            new InitializeCommand().Execute(new InitializeInput()
            {
                DeploymentFlag = "hoth".AppendPath("deployment"),
                ForceFlag = true
            });

            fileSystem.DeleteDirectory("tatooine");
            fileSystem.CreateDirectory("tatooine");
            new InitializeCommand().Execute(new InitializeInput()
            {
                DeploymentFlag = "tatooine".AppendPath("deployment"),
                ForceFlag = true
            });

            theSettings = new DeploymentSettings("hoth".AppendPath("deployment"));
            theSettings.AddImportedFolder("tatooine".AppendPath("deployment"));
        }
 public void SetUp()
 {
     var fileSystem = new FileSystem();
     fileSystem.DeleteDirectory("TestSolution");
     fileSystem.CreateDirectory("TestSolution");
 }
Example #21
0
 public void Create()
 {
     FileSystem.CreateDirectory(FullPath);
 }
        public static void ResetBottleProjectCode()
        {
            var system = new FileSystem();
            CleanStagingDirectory();

            system.Copy(SourceDirectory, StagingDirectory);

            system.CreateDirectory(ZipsDirectory);
            system.CleanDirectory(ZipsDirectory);
        }
Example #23
0
        /// <summary>
        /// Load submission directory with new files, updates time
        /// </summary>
        public bool Update(Submission sub, IExternalSource files)
        {
            FileSystem fs = new FileSystem(m_ident);
            bool markcmp, unmarkcmp, defunct;

            //Get old sub
            Components.Submission oldsub = GetInfo(sub.ID);
            markcmp = (oldsub.Status == Components.Submission.UNGRADED &&
                      sub.Status == Components.Submission.GRADED);
            unmarkcmp = (oldsub.Status == Components.Submission.GRADED &&
                         sub.Status == Components.Submission.UNGRADED);
            defunct = (oldsub.Status != Components.Submission.DEFUNCT &&
                        sub.Status == Components.Submission.DEFUNCT);

            //Make sure toplevel zone directory exists
            CFile subdir = fs.GetFile(@"c:\subs");
            if (null == subdir)
                subdir = fs.CreateDirectory(@"c:\subs", true, null, false);

            //Build file perms
            CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
            int courseID = new Assignments(m_ident).GetInfo(sub.AsstID).CourseID;
            CourseRole.CourseRoleList staff = new Courses(m_ident).GetTypedRoles(courseID, true, null);
            foreach (CourseRole role in staff)
                perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));
            perms.AddRange(CFilePermission.CreateOprFullAccess(sub.PrincipalID));

            //Create zone directory
            CFile esubdir;
            string zpath = @"c:\subs\" + sub.ID;
            if (null == (esubdir = fs.GetFile(zpath))) {
                esubdir = fs.CreateDirectory(zpath, false, perms, false);
                esubdir.SpecType = CFile.SpecialType.SUBMISSION;
                string name = new Principals(m_ident).GetInfo(sub.PrincipalID).Name;
                esubdir.Alias = String.Format("{0}: {1}",
                    name, GetNextSubmission(sub.AsstID, sub.PrincipalID));
                fs.UpdateFileInfo(esubdir, false);
            }
            //Update sub entry
            sub.LocationID = esubdir.ID;
            m_dp.UpdateSubmission(sub);

            //Load files
            try {
                fs.ImportData(zpath, files, false, false); //Import the data
            } catch (Exception) {
                throw new DataAccessException("Invalid external file source. This means the system does " +
                    "not understand how to extract files from the source. Please create a valid source");
            }

            //Verify submission structure
            VerifyFormat(sub.AsstID, zpath);

            //Log
            if (markcmp)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " completed", sub.ID);
            else if (unmarkcmp)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " incomplete", sub.ID);
            else if (defunct)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " defunct", sub.ID);

            return true;
        }
 public void SetUp()
 {
     var fileSystem = new FileSystem();
     fileSystem.DeleteDirectory("myfoo");
     fileSystem.CreateDirectory("myfoo");
     fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness.csproj");
 }
Example #25
0
            public PublishesExpression Assembly(string assembly, string name = null)
            {
                // TODO -- Need to create the binary on the fly
                if (name.IsEmpty())
                {
                    name = assembly.Replace(".dll", "");
                }
               
                
                // Fake the binaries
                var binaryPath = "src{0}{1}{0}bin{0}Debug".ToFormat(Path.DirectorySeparatorChar, name);
                var binaryFile = "{0}{1}{2}".ToFormat(binaryPath, Path.DirectorySeparatorChar, assembly);

                // ..\..\src\Bottles\bin\Debug\Bottles.dll
                var relativePath = "..{0}..{0}{1}".ToFormat(Path.DirectorySeparatorChar, binaryFile);

                _spec.AddPublishedAssembly(relativePath);

                var files = new FileSystem();
                files.CreateDirectory(_solution.Directory.AppendPath(binaryPath));
                files.WriteStringToFile(_solution.Directory.AppendPath(binaryFile), "");

                return this;
            }
        public void SetUp()
        {
            var system = new FileSystem();
            system.DeleteDirectory("package1");

            system.CreateDirectory("package1");
            system.CreateDirectory("package1", "bin");
            system.WriteStringToFile(Path.Combine("package1", "bin", "a.dll"), "I'm a managed assembly");
            system.WriteStringToFile(Path.Combine("package1", "bin", "b.dll"), "I'm a native assembly");
            system.CreateDirectory("package1", "WebContent");
            system.CreateDirectory("package1", "Data");

            theOriginalManifest = new PackageManifest
            {
                Assemblies = new[] { "a" },
                NativeAssemblies = new[] { "b" },
                Name = "Extraordinary"
            };

            theOriginalManifest.WriteTo("package1");

            thePackage = new PackageManifestReader(new FileSystem(), directory => directory.AppendPath("WebContent")).LoadFromFolder("package1");
        }
Example #27
0
 public void Create(System.Security.AccessControl.DirectorySecurity directorySecurity)
 => FileSystem.CreateDirectory(FullPath);                  // ignore directorySecurity
Example #28
0
        public IPackage ExplodeTo(string directory)
        {
            var explodedDirectory = ExplodedDirectory(directory);

            RippleLog.Info("Exploding to " + explodedDirectory);

            var fileSystem = new FileSystem();
            fileSystem.CreateDirectory(explodedDirectory);
            fileSystem.ForceClean(explodedDirectory);

            var package = new ZipPackage(_path);

            package.GetFiles().Each(file =>
            {
                var target = explodedDirectory.AppendPath(file.Path);
                fileSystem.CreateDirectory(target.ParentDirectory());

                using (var stream = new FileStream(target, FileMode.Create, FileAccess.Write))
                {
                    file.GetStream().CopyTo(stream);
                }
            });

            fileSystem.CopyToDirectory(_path, explodedDirectory);

            fileSystem.DeleteFile(_path);

            var newFile = Path.Combine(explodedDirectory, Path.GetFileName(_path));
            return new ZipPackage(newFile);
        }
Example #29
0
        public string NamespacedDirectory()
        {
            if (Namespace.IsEmpty()) return RootDirectory;

            var fileSystem = new FileSystem();

            var directory = RootDirectory;
            var parts = Namespace.Split('.');
            parts.Each(folder =>
            {
                directory = directory.AppendPath(folder);
                fileSystem.CreateDirectory(directory);
            });

            return directory;
        }
Example #30
0
            public SolutionGraphScenarioDefinition()
            {
                _directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString());
                var system = new FileSystem();

                system.CleanDirectory(_directory);
                system.DeleteDirectory(_directory);
                system.DeleteDirectory(_directory);
                system.CreateDirectory(_directory);
            }
Example #31
0
        public void SetUp()
        {
            fileSystem = new FileSystem();

            fileSystem.Copy("FubuMVC.SlickGrid.Docs.csproj.fake", "FubuMVC.SlickGrid.Docs.csproj");
            fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness.csproj");
            fileSystem.Copy("SlickGridHarness.csproj.fake", "SlickGridHarness/SlickGridHarness.csproj");

            fileSystem.DeleteDirectory("myproj");
            fileSystem.CreateDirectory("myproj");
        }
 public void SetUp()
 {
     var fileSystem = new FileSystem();
     fileSystem.DeleteDirectory("myfoo");
     fileSystem.CreateDirectory("myfoo");
 }