Skip to content

fix (getting started): Improve behaviour when nativescript-cloud is installed #3495

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 4 commits into from
Apr 3, 2018

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Mar 26, 2018

Fixes the behaviour of getting started when nativescript-cloud is already installed.
Fixes messages when console is non-interactive.
Add In case you have any issues, you can ask in our forum. message when env is not configured after setup script.
Refactor unit tests

}

private getExtensionData(): IExtensionData {
return this.$extensibilityService.getInstalledExtensionsData()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use _.find instead of array.find, it is safer to use Lodash methods


return `${PlatformEnvironmentRequirements.MISSING_LOCAL_AND_CLOUD_SETUP_MESSAGE}` + EOL
+ "Run $ tns setup command to run the setup script to try to automatically configure your environment for local builds." + EOL
+ `Run $ tns cloud setup command to install the ${constants.NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension to configure your environment for cloud builds.` + EOL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line of the message is the only difference between this message and the one used in the if above. I suggest extrating the cloud message in a const and use it in the message here. This way you'll not duplicate all other messages:

const cloudBuildMessage = this.$nativescriptCloudExtensionService.isInstalled() ? this.getCloudBuildsMessage(platform) : 
    `Run $ tns cloud setup command to install the ${constants.NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension to configure your environment for cloud builds.`;

+ `Select "Configure for Cloud Builds" to install the ${constants.NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension and automatically configure your environment for cloud builds.` + EOL
+ `Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.`
+ `Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.`
+ `Select "Skip Step and Configure Manually" to disregard these options and install any required components manually.`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, some of the messages are duplicated, can you extract them in const variables.

@@ -6,7 +6,8 @@ import { assert } from "chai";
const platform = "android";
const cloudBuildsErrorMessage = `In order to test your application use the $ tns login command to log in with your account and then $ tns cloud build command to build your app in the cloud.`;
const manuallySetupErrorMessage = `To be able to build for ${platform}, verify that your environment is configured according to the system requirements described at `;
const nonInteractiveConsoleErrorMessage = `You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: \nRun $ tns setup command to run the setup script to try to automatically configure your environment for local builds.\nRun $ tns cloud setup command to install the nativescript-cloud extension to configure your environment for cloud builds.\nVerify that your environment is configured according to the system requirements described at `;
const nonInteractiveConsoleMessageWhenExtensionIsNotInstalled = `You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: \nRun $ tns setup command to run the setup script to try to automatically configure your environment for local builds.\nRun $ tns cloud setup command to install the nativescript-cloud extension to configure your environment for cloud builds.\nVerify that your environment is configured according to the system requirements described at `;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use os.EOL instead of \n
Also can you please wrap the calls to command in quotes, for example ``Run '$ tns setup' command to run the...`

@@ -6,7 +6,8 @@ import { assert } from "chai";
const platform = "android";
const cloudBuildsErrorMessage = `In order to test your application use the $ tns login command to log in with your account and then $ tns cloud build command to build your app in the cloud.`;
const manuallySetupErrorMessage = `To be able to build for ${platform}, verify that your environment is configured according to the system requirements described at `;
const nonInteractiveConsoleErrorMessage = `You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: \nRun $ tns setup command to run the setup script to try to automatically configure your environment for local builds.\nRun $ tns cloud setup command to install the nativescript-cloud extension to configure your environment for cloud builds.\nVerify that your environment is configured according to the system requirements described at `;
const nonInteractiveConsoleMessageWhenExtensionIsNotInstalled = `You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: \nRun $ tns setup command to run the setup script to try to automatically configure your environment for local builds.\nRun $ tns cloud setup command to install the nativescript-cloud extension to configure your environment for cloud builds.\nVerify that your environment is configured according to the system requirements described at `;
const nonInteractiveConsoleMessageWhenExtensionIsInstalled = `Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: \nRun $ tns setup command to run the setup script to try to automatically configure your environment for local builds.\nIn order to test your application use the $ tns login command to log in with your account and then $ tns cloud build command to build your app in the cloud.\nVerify that your environment is configured according to the system requirements described at .`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

private static NOT_CONFIGURED_ENV_MESSAGE = "To continue, choose one of the following options: ";
private static NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE = "The setup script was not able to configure your environment for local builds. To execute local builds, you have to set up your environment manually. To continue, choose one of the following options:";
private static NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE = "The setup script was not able to configure your environment for local builds. To execute local builds, you have to set up your environment manually. In case you have any issues, you can ask in our forum. To continue, choose one of the following options:";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need the actual link to the forum here: http://forum.nativescript.org

@Fatme Fatme force-pushed the fatme/fix-env-messages branch from c5457ea to 97f550e Compare March 29, 2018 12:45
Fatme added 3 commits March 29, 2018 15:47
…lready installed.

Fixes messages when console is non-interactive.
Add `In case you have any issues, you can ask in our forum.` message when env is not configured after setup script.
Refactor unit tests
@Fatme Fatme force-pushed the fatme/fix-env-messages branch from 97f550e to 9940fdd Compare March 29, 2018 12:47
@Fatme
Copy link
Contributor Author

Fatme commented Mar 29, 2018

run ci

@Fatme Fatme force-pushed the fatme/fix-env-messages branch from 2168c55 to 50bbfb6 Compare April 2, 2018 06:29
@Fatme
Copy link
Contributor Author

Fatme commented Apr 2, 2018

run ci

@Fatme Fatme merged commit f1a2995 into release Apr 3, 2018
@Fatme Fatme deleted the fatme/fix-env-messages branch April 3, 2018 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants