-
-
Notifications
You must be signed in to change notification settings - Fork 197
Implement doctor command #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
doctor | ||
========== | ||
|
||
Usage | Synopsis | ||
------|------- | ||
General | `$ tns doctor` | ||
|
||
Checks your system and reports potential problems which may prevent developing with NativeScript. | ||
|
||
|
||
<% if(isHtml) { %> | ||
### Related Commands | ||
|
||
Command | Description | ||
----------|---------- | ||
[feature-usage-tracking](feature-usage-tracking.html) | Configures anonymous usage statistics tracking for the NativeScript CLI. | ||
[autocomplete](autocomplete.html) | Prints your current command-line completion settings. If disabled, prompts you to enable it. | ||
[help](help.html) | Lists the available commands or shows information about the selected command. | ||
<% } %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule common
updated
3 files
+1 −0 | bootstrap.ts | |
+32 −0 | commands/doctor.ts | |
+3 −110 | commands/post-install.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
///<reference path="../.d.ts"/> | ||
"use strict"; | ||
import os = require("os"); | ||
|
||
class DoctorService implements IDoctorService { | ||
|
||
constructor( | ||
private $hostInfo: IHostInfo, | ||
private $sysInfo: ISysInfo, | ||
private $logger: ILogger) { } | ||
|
||
public printWarnings(): boolean { | ||
let result = false; | ||
let sysInfo = this.$sysInfo.getSysInfo(); | ||
|
||
if (!sysInfo.adbVer) { | ||
this.$logger.warn("WARNING: adb from the Android SDK is not installed or is not configured properly."); | ||
this.$logger.out("For Android-related operations, the NativeScript CLI will use a built-in version of adb." + os.EOL | ||
+ "To avoid possible issues with the native Android emulator, Genymotion or connected" + os.EOL | ||
+ "Android devices, verify that you have installed the latest Android SDK and" + os.EOL | ||
+ "its dependencies as described in http://developer.android.com/sdk/index.html#Requirements" + os.EOL); | ||
|
||
this.printPackageManagerTip(); | ||
result = true; | ||
} | ||
if (!sysInfo.antVer) { | ||
this.$logger.warn("WARNING: Apache Ant is not installed or is not configured properly."); | ||
this.$logger.out("You will not be able to build your projects for Android." + os.EOL | ||
+ "To be able to build for Android, download and install Apache Ant and" + os.EOL | ||
+ "its dependencies as described in http://ant.apache.org/manual/index.html" + os.EOL); | ||
|
||
this.printPackageManagerTip(); | ||
result = true; | ||
} | ||
if (!sysInfo.androidInstalled) { | ||
this.$logger.warn("WARNING: The Android SDK is not installed or is not configured properly."); | ||
this.$logger.out("You will not be able to build your projects for Android and run them in the native emulator." + os.EOL | ||
+ "To be able to build for Android and run apps in the native emulator, verify that you have" + os.EOL | ||
+ "installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements" + os.EOL | ||
); | ||
|
||
this.printPackageManagerTip(); | ||
result = true; | ||
} | ||
if (this.$hostInfo.isDarwin && !sysInfo.xcodeVer) { | ||
this.$logger.warn("WARNING: Xcode is not installed or is not configured properly."); | ||
this.$logger.out("You will not be able to build your projects for iOS or run them in the iOS Simulator." + os.EOL | ||
+ "To be able to build for iOS and run apps in the native emulator, verify that you have installed Xcode." + os.EOL); | ||
result = true; | ||
} | ||
if (!sysInfo.itunesInstalled) { | ||
this.$logger.warn("WARNING: iTunes is not installed."); | ||
this.$logger.out("You will not be able to work with iOS devices via cable connection." + os.EOL | ||
+ "To be able to work with connected iOS devices," + os.EOL | ||
+ "download and install iTunes from http://www.apple.com" + os.EOL); | ||
result = true; | ||
} | ||
if(!sysInfo.javaVer) { | ||
this.$logger.warn("WARNING: The Java Development Kit (JDK) is not installed or is not configured properly."); | ||
this.$logger.out("You will not be able to work with the Android SDK and you might not be able" + os.EOL | ||
+ "to perform some Android-related operations. To ensure that you can develop and" + os.EOL | ||
+ "test your apps for Android, verify that you have installed the JDK as" + os.EOL | ||
+ "described in http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8)" + os.EOL | ||
+ "or http://docs.oracle.com/javase/7/docs/webnotes/install/ (for JDK 7)." + os.EOL); | ||
result = true; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
private printPackageManagerTip() { | ||
if (this.$hostInfo.isWindows) { | ||
this.$logger.out("TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies." + os.EOL); | ||
} else if (this.$hostInfo.isDarwin) { | ||
this.$logger.out("TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies." + os.EOL); | ||
} | ||
} | ||
} | ||
$injector.register("doctorService", DoctorService); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this, you've already added it to common