From ff6227125bd907130964ff54829b346c13be8346 Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Sun, 5 Feb 2023 14:59:22 +0530 Subject: [PATCH 1/2] Ruby version check for RN CLI Doctor --- packages/cli-doctor/src/tools/envinfo.ts | 2 +- .../src/tools/healthchecks/index.ts | 2 ++ .../cli-doctor/src/tools/healthchecks/ruby.ts | 24 +++++++++++++++++++ .../cli-doctor/src/tools/versionRanges.ts | 1 + packages/cli-doctor/src/types.ts | 1 + 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 packages/cli-doctor/src/tools/healthchecks/ruby.ts diff --git a/packages/cli-doctor/src/tools/envinfo.ts b/packages/cli-doctor/src/tools/envinfo.ts index 78fdb0a04..5caaf114e 100644 --- a/packages/cli-doctor/src/tools/envinfo.ts +++ b/packages/cli-doctor/src/tools/envinfo.ts @@ -33,7 +33,7 @@ async function getEnvironmentInfo( System: ['OS', 'CPU', 'Memory', 'Shell'], Binaries: ['Node', 'Yarn', 'npm', 'Watchman'], IDEs: ['Xcode', 'Android Studio', 'Visual Studio'], - Managers: ['CocoaPods'], + Managers: ['CocoaPods', 'RubyGems'], Languages: ['Java'], SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'], npmPackages: packages, diff --git a/packages/cli-doctor/src/tools/healthchecks/index.ts b/packages/cli-doctor/src/tools/healthchecks/index.ts index 2116ff01b..688423796 100644 --- a/packages/cli-doctor/src/tools/healthchecks/index.ts +++ b/packages/cli-doctor/src/tools/healthchecks/index.ts @@ -2,6 +2,7 @@ import nodeJS from './nodeJS'; import {yarn, npm} from './packageManagers'; import jdk from './jdk'; import watchman from './watchman'; +import ruby from './ruby'; import androidHomeEnvVariable from './androidHomeEnvVariable'; import androidStudio from './androidStudio'; import androidSDK from './androidSDK'; @@ -37,6 +38,7 @@ export const getHealthchecks = ({contributor}: Options): Healthchecks => { label: 'Common', healthchecks: [ nodeJS, + ruby, yarn, npm, ...(process.platform === 'darwin' ? [watchman] : []), diff --git a/packages/cli-doctor/src/tools/healthchecks/ruby.ts b/packages/cli-doctor/src/tools/healthchecks/ruby.ts new file mode 100644 index 000000000..031c2a818 --- /dev/null +++ b/packages/cli-doctor/src/tools/healthchecks/ruby.ts @@ -0,0 +1,24 @@ +import versionRanges from '../versionRanges'; +import {doesSoftwareNeedToBeFixed} from '../checkInstallation'; +import {HealthCheckInterface} from '../../types'; + +export default { + label: 'Ruby', + isRequired: false, + getDiagnostics: async ({Managers}) => ({ + needsToBeFixed: doesSoftwareNeedToBeFixed({ + version: Managers.RubyGems.version, + versionRange: versionRanges.RUBY, + }), + version: Managers.RubyGems.version, + versionRange: versionRanges.RUBY, + }), + runAutomaticFix: async ({loader, logManualInstallation}) => { + loader.fail(); + + logManualInstallation({ + healthcheck: 'Ruby', + url: 'https://www.ruby-lang.org/en/downloads/', + }); + }, +} as HealthCheckInterface; diff --git a/packages/cli-doctor/src/tools/versionRanges.ts b/packages/cli-doctor/src/tools/versionRanges.ts index 534fe7ad9..aaa3c215c 100644 --- a/packages/cli-doctor/src/tools/versionRanges.ts +++ b/packages/cli-doctor/src/tools/versionRanges.ts @@ -3,6 +3,7 @@ export default { NODE_JS: '>= 14', YARN: '>= 1.10.x', NPM: '>= 4.x', + RUBY: '>= 2.6.x', JAVA: '>= 11', // Android ANDROID_SDK: '>= 31.x', diff --git a/packages/cli-doctor/src/types.ts b/packages/cli-doctor/src/types.ts index 866c62f05..9d8336425 100644 --- a/packages/cli-doctor/src/types.ts +++ b/packages/cli-doctor/src/types.ts @@ -26,6 +26,7 @@ export type EnvironmentInfo = { }; Managers: { CocoaPods: AvailableInformation; + RubyGems: AvailableInformation; }; SDKs: { 'iOS SDK': { From eb19da7cc4a2ff6086dce18f6bc2ea849c55823e Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Sun, 5 Feb 2023 14:59:22 +0530 Subject: [PATCH 2/2] Ruby version check for RN CLI Doctor --- packages/cli-doctor/src/tools/envinfo.ts | 2 +- .../src/tools/healthchecks/index.ts | 2 ++ .../cli-doctor/src/tools/healthchecks/ruby.ts | 24 +++++++++++++++++++ .../cli-doctor/src/tools/versionRanges.ts | 1 + packages/cli-doctor/src/types.ts | 1 + 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 packages/cli-doctor/src/tools/healthchecks/ruby.ts diff --git a/packages/cli-doctor/src/tools/envinfo.ts b/packages/cli-doctor/src/tools/envinfo.ts index 78fdb0a04..5caaf114e 100644 --- a/packages/cli-doctor/src/tools/envinfo.ts +++ b/packages/cli-doctor/src/tools/envinfo.ts @@ -33,7 +33,7 @@ async function getEnvironmentInfo( System: ['OS', 'CPU', 'Memory', 'Shell'], Binaries: ['Node', 'Yarn', 'npm', 'Watchman'], IDEs: ['Xcode', 'Android Studio', 'Visual Studio'], - Managers: ['CocoaPods'], + Managers: ['CocoaPods', 'RubyGems'], Languages: ['Java'], SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'], npmPackages: packages, diff --git a/packages/cli-doctor/src/tools/healthchecks/index.ts b/packages/cli-doctor/src/tools/healthchecks/index.ts index 2116ff01b..688423796 100644 --- a/packages/cli-doctor/src/tools/healthchecks/index.ts +++ b/packages/cli-doctor/src/tools/healthchecks/index.ts @@ -2,6 +2,7 @@ import nodeJS from './nodeJS'; import {yarn, npm} from './packageManagers'; import jdk from './jdk'; import watchman from './watchman'; +import ruby from './ruby'; import androidHomeEnvVariable from './androidHomeEnvVariable'; import androidStudio from './androidStudio'; import androidSDK from './androidSDK'; @@ -37,6 +38,7 @@ export const getHealthchecks = ({contributor}: Options): Healthchecks => { label: 'Common', healthchecks: [ nodeJS, + ruby, yarn, npm, ...(process.platform === 'darwin' ? [watchman] : []), diff --git a/packages/cli-doctor/src/tools/healthchecks/ruby.ts b/packages/cli-doctor/src/tools/healthchecks/ruby.ts new file mode 100644 index 000000000..031c2a818 --- /dev/null +++ b/packages/cli-doctor/src/tools/healthchecks/ruby.ts @@ -0,0 +1,24 @@ +import versionRanges from '../versionRanges'; +import {doesSoftwareNeedToBeFixed} from '../checkInstallation'; +import {HealthCheckInterface} from '../../types'; + +export default { + label: 'Ruby', + isRequired: false, + getDiagnostics: async ({Managers}) => ({ + needsToBeFixed: doesSoftwareNeedToBeFixed({ + version: Managers.RubyGems.version, + versionRange: versionRanges.RUBY, + }), + version: Managers.RubyGems.version, + versionRange: versionRanges.RUBY, + }), + runAutomaticFix: async ({loader, logManualInstallation}) => { + loader.fail(); + + logManualInstallation({ + healthcheck: 'Ruby', + url: 'https://www.ruby-lang.org/en/downloads/', + }); + }, +} as HealthCheckInterface; diff --git a/packages/cli-doctor/src/tools/versionRanges.ts b/packages/cli-doctor/src/tools/versionRanges.ts index 534fe7ad9..4faf0d421 100644 --- a/packages/cli-doctor/src/tools/versionRanges.ts +++ b/packages/cli-doctor/src/tools/versionRanges.ts @@ -3,6 +3,7 @@ export default { NODE_JS: '>= 14', YARN: '>= 1.10.x', NPM: '>= 4.x', + RUBY: '>= 2.7.6', JAVA: '>= 11', // Android ANDROID_SDK: '>= 31.x', diff --git a/packages/cli-doctor/src/types.ts b/packages/cli-doctor/src/types.ts index 866c62f05..9d8336425 100644 --- a/packages/cli-doctor/src/types.ts +++ b/packages/cli-doctor/src/types.ts @@ -26,6 +26,7 @@ export type EnvironmentInfo = { }; Managers: { CocoaPods: AvailableInformation; + RubyGems: AvailableInformation; }; SDKs: { 'iOS SDK': {