public IEnumerable <IPackageInfo> Load()
        {
            var packages = new List <IPackageInfo>();
            var includes = _fileSystem.LoadFromFile <ApplicationManifest>(_applicationFolder, ApplicationManifest.FILE);

            packages.AddRange(includes.LinkedFolders.Select(f => LoadFromFolder(Path.Combine(_applicationFolder, f))));
            packages.AddRange(includes.Assemblies.Select(LoadFromAssembly));

            return(packages);
        }
Example #2
0
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            var packages = new List <IPackageInfo>();
            //issue??
            var includes = _fileSystem.LoadFromFile <PackageManifest>(_applicationFolder, PackageManifest.FILE);

            packages.AddRange(includes.LinkedFolders.Select(f => LoadFromFolder(Path.Combine(_applicationFolder, f))));
            packages.AddRange(includes.Assemblies.Select(assemblyName =>
            {
                var assembly = Assembly.Load(assemblyName);
                return(AssemblyPackageInfo.CreateFor(assembly));
            }));

            return(packages);
        }
Example #3
0
        public IEnumerable <IPackageInfo> Load(IPackageLog log)
        {
            var packages = new List <IPackageInfo>();

            var manifestFile = FileSystem.Combine(_applicationDirectory, LinkManifest.FILE);
            var manifest     = _fileSystem.LoadFromFile <LinkManifest>(manifestFile);

            if (manifest == null)
            {
                log.Trace("No package manifest found at {0}", manifestFile);
                return(packages);
            }

            if (manifest.LinkedFolders.Any())
            {
                log.Trace("Loading linked folders via the package manifest at " + _applicationDirectory);
                manifest.LinkedFolders.Each(folder =>
                {
                    var linkedFolder = FileSystem.Combine(_applicationDirectory, folder).ToFullPath();
                    log.Trace("  - linking folder " + linkedFolder);

                    var package = _reader.LoadFromFolder(linkedFolder);
                    packages.Add(package);
                });
            }
            else
            {
                log.Trace("No linked folders found in the package manifest file at " + _applicationDirectory);
            }

            return(packages);
        }
Example #4
0
        public void Start()
        {
            //sets bottles to look for things in '~/packages'
            BottleFiles.PackagesFolder = "packages";

            var manifest = _fileSystem.LoadFromFile <HostManifest>("svc", HostManifest.FILE);

            var type = Type.GetType(manifest.Bootstrapper, true, true);

            //guard clauses here

            _svc = (IBottleAwareService)Activator.CreateInstance(type);

            //this is done so that start can return, as 'LoadPackages' may take some time.
            ThreadPool.QueueUserWorkItem(cb =>
            {
                int shutUpResharper = 0;

                PackageRegistry.LoadPackages(pkg =>
                {
                    pkg.Loader(new BottleHostLoader(_fileSystem, _exploder));

                    pkg.Bootstrapper(_svc);
                });
            });
        }
        public IPackageInfo LoadFromFolder(string packageDirectory)
        {
            packageDirectory = packageDirectory.ToFullPath();

            var manifest = _fileSystem.LoadFromFile <PackageManifest>(packageDirectory, PackageManifest.FILE);
            var package  = new PackageInfo(manifest.Name)
            {
                Description  = "{0} ({1})".ToFormat(manifest.Name, packageDirectory),
                Dependencies = manifest.Dependencies
            };



            // Right here, this needs to be different
            registerFolders(packageDirectory, package);

            var binPath = determineBinPath(packageDirectory);


            package.Role = manifest.Role;

            readAssemblyPaths(manifest, package, binPath);

            return(package);
        }
Example #6
0
        public void Execute(TemplatePlanContext context)
        {
            var dir      = AppDomain.CurrentDomain.BaseDirectory;
            var registry = _fileSystem.LoadFromFile <GitAliasRegistry>(dir, GitAliasRegistry.ALIAS_FILE);
            var url      = context.Input.GitFlag;
            var token    = registry.AliasFor(url);

            if (token != null)
            {
                url = token.Url;
            }

            var gitProcess = _processFactory
                             .Create(p =>
            {
                p.UseShellExecute = false;
                p.FileName        = "git";
                p.Arguments       = "clone {0} {1}".ToFormat(url, context.TempDir);
            });

            gitProcess.Start();
            gitProcess.WaitForExit();
            if (gitProcess.ExitCode != 0)
            {
                throw new FubuException(gitProcess.ExitCode, "Command finished with a non-zero exit code");
            }
        }
Example #7
0
        public virtual void CreatePackage(CreateBottleInput input, IFileSystem fileSystem)
        {
            var fileName = FileSystem.Combine(input.PackageFolder, input.ManifestFileNameFlag ?? PackageManifest.FILE);
            var manifest = fileSystem.LoadFromFile <PackageManifest>(fileName);

            var creator = new PackageCreator(fileSystem, new ZipFileService(fileSystem), new PackageLogger(), new AssemblyFileFinder(fileSystem));

            creator.CreatePackage(input, manifest);
        }
Example #8
0
        public virtual bool CreatePackage(CreateBottleInput input, IFileSystem fileSystem)
        {
            var fileName = FileSystem.Combine(input.PackageFolder, input.ManifestFileNameFlag ?? PackageManifest.FILE);
            var manifest = fileSystem.LoadFromFile <PackageManifest>(fileName);

            var creator = new ZipPackageCreator(fileSystem, new ZipFileService(fileSystem), new BottleLogger(new LoggingSession()), new AssemblyFileFinder(fileSystem));

            return(creator.CreatePackage(input, manifest));
        }
 //REVIEW: why is this reading?
 public void ReadFrom(string fileName, Action <PackageManifest> onCreation)
 {
     if (_fileSystem.FileExists(fileName))
     {
         _manifest = _fileSystem.LoadFromFile <PackageManifest>(fileName);
     }
     else
     {
         _manifest = new PackageManifest();
         onCreation(_manifest);
     }
 }
Example #10
0
        public LinkManifest GetLinkManifest(string path)
        {
            var result = new LinkManifest();

            path = path.AppendPath(LinkManifest.FILE);

            if (_fileSystem.FileExists(path))
            {
                result = _fileSystem.LoadFromFile <LinkManifest>(path);
            }

            return(result);
        }
Example #11
0
        public Solution LoadFrom(IFileSystem fileSystem, string filePath)
        {
            Config = fileSystem.LoadFromFile<SolutionConfig>(filePath);
            var solution = new Solution { Mode = SolutionMode.Classic };

            solution.Name = Config.Name;
            solution.SourceFolder = Config.SourceFolder;
            solution.FastBuildCommand = Config.FastBuildCommand;
            solution.BuildCommand = Config.BuildCommand;
            solution.NugetSpecFolder = Config.NugetSpecFolder;

            return solution;
        }
Example #12
0
        public CommandDocumentationSource(IFubuApplicationFiles files, IFileSystem fileSystem)
        {
            _applications = new Cache <string, CommandLineApplicationReport>(name => {
                var filename = "{0}.cli.xml".ToFormat(name);
                var file     = files.Find(filename);

                if (file == null)
                {
                    throw new ArgumentOutOfRangeException("name", name, "Unable to find a *.cli.xml file for the requested application name");
                }

                return(fileSystem.LoadFromFile <CommandLineApplicationReport>(file.Path));
            });
        }
Example #13
0
        public Solution LoadFrom(IFileSystem fileSystem, string filePath)
        {
            Config = fileSystem.LoadFromFile <SolutionConfig>(filePath);
            var solution = new Solution {
                Mode = SolutionMode.Classic
            };

            solution.Name             = Config.Name;
            solution.SourceFolder     = Config.SourceFolder;
            solution.FastBuildCommand = Config.FastBuildCommand;
            solution.BuildCommand     = Config.BuildCommand;
            solution.NugetSpecFolder  = Config.NugetSpecFolder;

            return(solution);
        }
Example #14
0
        private IPackageInfo convertToPackage(string directory)
        {
            var folder = _fileSystem.GetFullPath(directory);

            var manifest = _fileSystem.LoadFromFile <HostManifest>(folder, HostManifest.CONTROL, HostManifest.FILE);

            var package = new PackageInfo(manifest.Name)
            {
                Description = "{0} ({1})".ToFormat(manifest.Name, folder)
            };

            package.RegisterFolder("data", FileSystem.Combine(folder, HostManifest.DATA));
            package.RegisterFolder("control", FileSystem.Combine(folder, HostManifest.CONTROL));

            return(package);
        }
Example #15
0
        public string GetFolderForAlias(string alias)
        {
            var token = _fileSystem
                        .LoadFromFile <AliasRegistry>(AliasRegistry.ALIAS_FILE)
                        .AliasFor(alias);

            string path = alias;

            if (token != null)
            {
                path = token.Folder;
            }

            ConsoleWriter.Write(ConsoleColor.Yellow, "Alias is returning '{0}'".ToFormat(path));

            return(path);
        }
Example #16
0
        public static PackageManifest TryFindManifest(this IFileSystem system, string directory, string fileName)
        {
            if (fileName.IsEmpty())
            {
                return(null);
            }

            var path = FileSystem.Combine(directory, fileName);

            if (system.FileExists(path))
            {
                var manifest = system.LoadFromFile <PackageManifest>(path);
                manifest.ManifestFileName = path;

                return(manifest);
            }

            return(null);
        }
Example #17
0
        public virtual void InstallManifest(InstallInput input, IFileSystem fileSystem)
        {
            Console.WriteLine("Executing the installers for the FubuMVC application at {0}", input.AppFolder);

            var manifest = fileSystem.LoadFromFile <ApplicationManifest>(input.ManifestFileName);
            var run      = CreateEnvironmentRun(input, manifest);

            try
            {
                run.AssertIsValid();
            }
            catch (EnvironmentRunnerException e)
            {
                Console.WriteLine("The application manifest is either incomplete or invalid");
                Console.WriteLine(e.Message);

                throw;
            }

            RunTheEnvironment(input, new EnvironmentGateway(run));
        }
Example #18
0
        public void Execute(AliasInput input, IFileSystem system)
        {
            var registry = system.LoadFromFile <AliasRegistry>(AliasRegistry.ALIAS_FILE);

            if (input.Name.IsEmpty())
            {
                writeAliases(registry);
                return;
            }

            if (input.RemoveFlag)
            {
                registry.RemoveAlias(input.Name);
                Console.WriteLine("Alias {0} removed", input.Name);
            }
            else
            {
                registry.CreateAlias(input.Name, input.Folder);
                Console.WriteLine("Alias {0} created for folder {1}", input.Name, input.Folder);
            }

            persist(system, registry);
        }
        public List <Person> GetList()
        {
            var persons = new List <Person>();

            foreach (var name in filesystem.GetFiles())
            {
                if (!name.Contains("person"))
                {
                    continue;
                }
                logger.Write("found file: " + name);
                var lines = filesystem.LoadFromFile(name);

                if (lines.Length != 3)
                {
                    continue;
                }
                logger.Write(String.Format("found Person - email: {0} name: {1} birthday: {2}", lines));
                persons.Add(new Person(lines[0], lines[1], DateTime.Parse(lines[2])));
            }

            return(persons);
        }
Example #20
0
 public static PackageManifest LoadApplicationManifestFrom(this IFileSystem fileSystem, string folder)
 {
     return(fileSystem.LoadFromFile <PackageManifest>(folder, PackageManifest.FILE));
 }
Example #21
0
 public static T LoadFromFile <T>(this IFileSystem fileSystem, params string[] pathParts) where T : new()
 {
     return(fileSystem.LoadFromFile <T>(FileSystem.Combine(pathParts)));
 }
Example #22
0
 public Solution LoadFrom(IFileSystem fileSystem, string filePath)
 {
     return fileSystem.LoadFromFile<Solution>(filePath);
 }
Example #23
0
 public Solution LoadFrom(IFileSystem fileSystem, string filePath)
 {
     return(fileSystem.LoadFromFile <Solution>(filePath));
 }
 public static LinkManifest LoadLinkManifestFrom(this IFileSystem fileSystem, string folder)
 {
     return(fileSystem.LoadFromFile <LinkManifest>(folder, LinkManifest.FILE));
 }