Exemplo n.º 1
0
        public static async Task Provision_recursive_dir_as()
        {
            var directory = new DirectoryBuilder("root");

            directory.Directory("out");
            var cfg = directory.Directory("cfg");
            var src = directory.Directory("src");
            var lib = src.Directory("lib").Directory("config");

            directory.TextFile("package.json").Code.Append("{ \"private\": true }");
            cfg.TextFile("config.ini").Code.Append("SOME_CONFIG = 'SOME VALUE'");
            src.TextFile("index.js").Code.Append("require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
            lib.TextFile("config.js").Code.Append("// Test.");

            await directory.ProvisionAsAsync(Tmp);

            AssertDirectory("", 4);
            AssertDirectory("cfg", 1);
            AssertDirectory("src", 2);
            AssertDirectory(Path.Join("src", "lib"), 1);
            AssertDirectory(Path.Join("src", "lib", "config"), 1);
            AssertDirectory(Path.Join("out"), 0);

            AssertFile("package.json", "{ \"private\": true }");
            AssertFile(Path.Join("cfg", "config.ini"), "SOME_CONFIG = 'SOME VALUE'");
            AssertFile(Path.Join("src", "index.js"), "require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
            AssertFile(Path.Join("src", "lib", "config", "config.js"), "// Test.");
        }
Exemplo n.º 2
0
        public static async Task Provision_simple_dir_as()
        {
            var directory = new DirectoryBuilder("src");

            directory.TextFile("config.ini").Code.Append("SOME_CONFIG = 'SOME VALUE'");
            directory.TextFile("index.js").Code.Append("require('config').getFromFile('./config.txt').log('SOME_CONFIG')");

            await directory.ProvisionAsAsync(Tmp);

            AssertDirectory("", 2);

            AssertFile("config.ini", "SOME_CONFIG = 'SOME VALUE'");
            AssertFile("index.js", "require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
        }