diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts index c26c2acf3f..e46818651d 100644 --- a/lib/bootstrap.ts +++ b/lib/bootstrap.ts @@ -34,3 +34,4 @@ $injector.requireCommand("list-devices", "./commands/list-devices"); $injector.require("npm", "./node-package-manager"); $injector.require("config", "./config"); +$injector.require("optionsService", "./services/options-service"); diff --git a/lib/common b/lib/common index 915d5872e0..33b81c2682 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 915d5872e06e0ca4a642b1f0df5e9aa9a28344f7 +Subproject commit 33b81c26827c3f872be810789a987a6061452efb diff --git a/lib/options.ts b/lib/options.ts index e0c29014f9..cf438f7f67 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -4,6 +4,7 @@ import path = require("path"); import helpers = require("./common/helpers"); import commonOptions = require("./common/options"); import osenv = require("osenv"); +import hostInfo = require("./common/host-info"); var knownOpts:any = { "frameworkPath": String, @@ -23,11 +24,19 @@ var knownOpts:any = { _.extend(knownOpts, commonOptions.knownOpts); _.extend(shorthands, commonOptions.shorthands); -commonOptions.setProfileDir(".nativescript-cli"); +var defaultProfileDir = ""; +var nativeScriptCacheFolder = ".nativescript-cli"; +if(hostInfo.isWindows()) { + defaultProfileDir = path.join(process.env.LocalAppData, nativeScriptCacheFolder); +} else { + defaultProfileDir = path.join(osenv.home(), ".local/share", nativeScriptCacheFolder); +} + +commonOptions.setProfileDir(defaultProfileDir); var parsed = helpers.getParsedOptions(knownOpts, shorthands); Object.keys(parsed).forEach((opt) => exports[opt] = parsed[opt]); exports.knownOpts = knownOpts; declare var exports:any; -export = exports; \ No newline at end of file +export = exports; diff --git a/lib/services/options-service.ts b/lib/services/options-service.ts new file mode 100644 index 0000000000..23c2139790 --- /dev/null +++ b/lib/services/options-service.ts @@ -0,0 +1,12 @@ +/// + +"use strict"; + +import options = require("../options"); + +export class OptionsService implements IOptionsService { + public getKnownOptions(): string[]{ + return Object.keys(options.knownOpts); + } +} +$injector.register("optionsService", OptionsService); diff --git a/package.json b/package.json index 5ed29a766a..a0f62127f5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "0.3.2", + "version": "0.4.0", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { @@ -50,7 +50,7 @@ "underscore": "1.5.2", "unzip": "0.1.9", "watchr": "2.4.11", - "xmlhttprequest": "1.6.0", + "xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master", "yargs": "1.2.2" }, "analyze": true, diff --git a/test/stubs.ts b/test/stubs.ts index 9cdef9d031..c8e1b2dbf4 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -119,6 +119,14 @@ export class FileSystemStub implements IFileSystem { symlink(sourePath: string, destinationPath: string): IFuture { return undefined; } + + closeStream(stream: any): IFuture { + return undefined; + } + + setCurrentUserAsOwner(path: string, owner: string): IFuture { + return undefined; + } } export class ErrorsStub implements IErrors {