Exemple #1
0
        static int Install(InstallOptions options)
        {
            // If we have a zipfile, use it.

            if (options.ZipFile != null)
            {
                // Aha! We've been called as ckan -f somefile.zip somefile.ckan

                if (options.Files.Count > 1)
                {
                    Console.WriteLine("Only a single CKAN file can be provided when installing from zip");
                    return(EXIT_BADOPT);
                }

                // TODO: Support installing from CKAN file embedded in zip.

                string zipFilename  = options.ZipFile;
                string ckanFilename = options.Files[0];

                Console.WriteLine("Installing " + ckanFilename + " from " + zipFilename);

                CkanModule      module    = CkanModule.from_file(ckanFilename);
                ModuleInstaller installer = new ModuleInstaller();

                installer.Install(module, zipFilename);
                return(EXIT_OK);
            }

            // Regular invocation, walk through all CKAN files on the cmdline

            foreach (string filename in options.Files)
            {
                CkanModule      module    = CkanModule.from_file(filename);
                ModuleInstaller installer = new ModuleInstaller();
                installer.Install(module);
            }

            Console.WriteLine("\nDone!\n");

            return(EXIT_OK);
        }