예제 #1
0
        protected override void ExecuteImpl(string[] args)
        {
            string id      = args[0];
            string version = args[1];

            var catalog = ApiCatalog.Load();
            var api     = catalog[id];

            string oldVersion = api.Version;

            api.Version = version;
            var layout   = DirectoryLayout.ForApi(id);
            var apiNames = catalog.CreateIdHashSet();

            GenerateProjectsCommand.GenerateMetadataFile(layout.SourceDirectory, api);
            GenerateProjectsCommand.GenerateProjects(layout.SourceDirectory, api, apiNames);
            GenerateProjectsCommand.RewriteReadme(catalog);
            GenerateProjectsCommand.RewriteDocsRootIndex(catalog);

            // Update the parsed JObject associated with the ID, and write it back to apis.json.
            api.Json["version"] = version;
            string formatted = catalog.FormatJson();

            File.WriteAllText(ApiCatalog.CatalogPath, formatted);
            Console.WriteLine("Updated apis.json");
            Console.WriteLine();
            Console.WriteLine(new ApiVersionPair(id, oldVersion, version));
        }
        internal void InternalExecute(string id, string version, bool quiet)
        {
            var catalog = ApiCatalog.Load();
            var api     = catalog[id];

            string oldVersion = api.Version;

            api.Version = version;
            if (api.StructuredVersion.Patch == 0)
            {
                GenerateProjectsCommand.UpdateDependencies(catalog, api);
            }
            var layout   = DirectoryLayout.ForApi(id);
            var apiNames = catalog.CreateIdHashSet();

            // This will still write output, even if "quiet" is true, but that's probably
            // okay for batch releasing.
            GenerateProjectsCommand.GenerateMetadataFile(layout.SourceDirectory, api);
            GenerateProjectsCommand.GenerateProjects(layout.SourceDirectory, api, apiNames);
            GenerateProjectsCommand.RewriteReadme(catalog);

            // Update the parsed JObject associated with the ID, and write it back to apis.json.
            api.Json["version"] = version;
            string formatted = catalog.FormatJson();

            File.WriteAllText(ApiCatalog.CatalogPath, formatted);
            if (!quiet)
            {
                Console.WriteLine("Updated apis.json");
                Console.WriteLine();
                Console.WriteLine(new ApiVersionPair(id, oldVersion, version));
            }
        }
        protected override void ExecuteImpl(string[] args)
        {
            var catalog  = ApiCatalog.Load();
            var apiNames = catalog.CreateIdHashSet();

            foreach (var api in catalog.Apis)
            {
                GenerateProjectsCommand.UpdateDependencies(catalog, api);
                var layout = DirectoryLayout.ForApi(api.Id);
                GenerateProjectsCommand.GenerateMetadataFile(layout.SourceDirectory, api);
                GenerateProjectsCommand.GenerateProjects(layout.SourceDirectory, api, apiNames);
            }
            string formatted = catalog.FormatJson();

            File.WriteAllText(ApiCatalog.CatalogPath, formatted);
            Console.WriteLine("Updated apis.json");
        }