How to use the autorest.home function in autorest

To help you get started, we’ve selected a few autorest examples, based on popular ways it is used in public projects.

github Azure / autorest / src / autorest / app.ts View on Github external
.option("force", {
    describe: "force the re-installation of the **autorest-core** extension and frameworks",
    type: "boolean",
    group: "### Installation",
  })
  .option("version", {
    describe: "use the specified version of the **autorest-core** extension",
    type: "string",
    group: "### Installation",
  })
  .argv;

const preview: boolean = args.preview;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
console.trace(`Autorest Home folder: ${process.env["autorest.home"]}`);
const rootFolder: string = join(home, ".autorest");
const dotnetFolder: string = join(home, ".dotnet");

const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const maxPkgVersion = `${semver.major(basePkgVersion) + 1}.0.0`

const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const versionRange = preview ? `>=${basePkgVersion}-any <${maxPkgVersion}` : `>=${basePkgVersion} <${maxPkgVersion}`; // the version range of the core package required.
const extensionManager: Promise<ExtensionManager> = ExtensionManager.Create(rootFolder);

let currentVersion: Extension = null;
const frameworkVersion: string = null;

let requestedVersion: string = args.version || (args.latest && "latest") || "latest-installed";
const showInfo: boolean = args.autorest["show-info"] || false;
const listAvailable: boolean = args.autorest["list-available"] || false;
github Azure / autorest / src / autorest / app.ts View on Github external
group: "### Installation",
  })
  .option("force", {
    describe: "force the re-installation of the **autorest-core** extension and frameworks",
    type: "boolean",
    group: "### Installation",
  })
  .option("version", {
    describe: "use the specified version of the **autorest-core** extension",
    type: "string",
    group: "### Installation",
  })
  .argv;

const preview: boolean = args.preview;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;
console.trace(`Autorest Home folder: ${process.env["autorest.home"]}`);
const rootFolder: string = join(home, ".autorest");
const dotnetFolder: string = join(home, ".dotnet");

const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const maxPkgVersion = `${semver.major(basePkgVersion) + 1}.0.0`

const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const versionRange = preview ? `>=${basePkgVersion}-any <${maxPkgVersion}` : `>=${basePkgVersion} <${maxPkgVersion}`; // the version range of the core package required.
const extensionManager: Promise<ExtensionManager> = ExtensionManager.Create(rootFolder);

let currentVersion: Extension = null;
const frameworkVersion: string = null;

let requestedVersion: string = args.version || (args.latest && "latest") || "latest-installed";
github Azure / autorest / src / autorest / autorest-as-a-service.ts View on Github external
import { lookup } from "dns";
import { Extension, ExtensionManager } from "@microsoft.azure/extension";
import { homedir } from "os";
import { dirname, join, resolve } from "path";
import { Enumerable as IEnumerable, From } from "linq-es2015";
import { Exception, LazyPromise } from "@microsoft.azure/polyfill";

import * as semver from "semver";
import { isFile, mkdir, isDirectory } from "@microsoft.azure/async-io";

export const pkgVersion: string = require(`${__dirname}/../package.json`).version;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;

export const rootFolder: string = join(home, ".autorest");

export const extensionManager: Promise<ExtensionManager> = ExtensionManager.Create(rootFolder);
export const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const versionRange = `^${basePkgVersion}`; // the version range of the core package required.

export const networkEnabled: Promise<boolean> = new Promise<boolean>((r, j) => {
  lookup("8.8.8.8", 4, (err, address, family) => {
    r(err ? false : true);
  });
});

export async function availableVersions() {
  if (await networkEnabled) {
github Azure / autorest / core / lib / autorest-core.ts View on Github external
public constructor(private fileSystem: IFileSystem = new RealFileSystem(), public configFileOrFolderUri?: string) {
    super();
    // ensure the environment variable for the home folder is set.
    process.env['autorest.home'] = process.env['autorest.home'] || homedir();
  }
github Azure / autorest / src / autorest / autorest-as-a-service.ts View on Github external
import { lookup } from "dns";
import { Extension, ExtensionManager } from "@microsoft.azure/extension";
import { homedir } from "os";
import { dirname, join, resolve } from "path";
import { Enumerable as IEnumerable, From } from "linq-es2015";
import { Exception, LazyPromise } from "@microsoft.azure/polyfill";

import * as semver from "semver";
import { isFile, mkdir, isDirectory } from "@microsoft.azure/async-io";

export const pkgVersion: string = require(`${__dirname}/../package.json`).version;
const home: string = process.env["autorest.home"] || homedir();
process.env["autorest.home"] = home;

export const rootFolder: string = join(home, ".autorest");

export const extensionManager: Promise<ExtensionManager> = ExtensionManager.Create(rootFolder);
export const corePackage = "@microsoft.azure/autorest-core"; // autorest-core"
const basePkgVersion = pkgVersion.indexOf("-") > -1 ? pkgVersion.substring(0, pkgVersion.indexOf("-")) : pkgVersion;
const versionRange = `^${basePkgVersion}`; // the version range of the core package required.

export const networkEnabled: Promise<boolean> = new Promise<boolean>((r, j) => {
  lookup("8.8.8.8", 4, (err, address, family) => {
    r(err ? false : true);
  });
});

export async function availableVersions() {

autorest

The AutoRest tool generates client libraries for accessing RESTful web services. Input to AutoRest is an OpenAPI spec that describes the REST API.

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis