Browse Source

chore(onboarding): Cleanup ruby/rails onboarding a bit more (#75547)

Co-authored-by: Steven Eubank <eubank.steven88@gmail.com>
Neel Shah 7 months ago
parent
commit
ba9c4d25dc

+ 1 - 0
static/app/gettingStartedDocs/ruby/rack.spec.tsx

@@ -13,6 +13,7 @@ describe('getting started with rack', function () {
     // Renders main headings
     expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
     expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
+    expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
   });
 
   it('renders performance onboarding docs correctly', async function () {

+ 37 - 4
static/app/gettingStartedDocs/ruby/rack.tsx

@@ -7,7 +7,7 @@ import type {
 } from 'sentry/components/onboarding/gettingStartedDoc/types';
 import {CrashReportWebApiOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
 import {getRubyMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
-import {tct} from 'sentry/locale';
+import {t, tct} from 'sentry/locale';
 
 type Params = DocsParams;
 
@@ -44,15 +44,23 @@ end
 
 use Sentry::Rack::CaptureExceptions`;
 
+const getVerifySnippet = () => `
+begin
+  1 / 0
+rescue ZeroDivisionError => exception
+  Sentry.capture_exception(exception)
+end
+
+Sentry.capture_message("test message")`;
+
 const onboarding: OnboardingConfig = {
   install: params => [
     {
       type: StepType.INSTALL,
       description: tct(
-        'The Sentry SDK for Ruby comes as a gem and is straightforward to install. If you are using Bundler just add this to your [gemfileCode:Gemfile] and run [bundleCode:bundle install]:',
+        'The Sentry SDK for Ruby comes as a gem that should be added to your [gemfileCode:Gemfile]:',
         {
           gemfileCode: <code />,
-          bundleCode: <code />,
         }
       ),
       configurations: [
@@ -72,6 +80,11 @@ const onboarding: OnboardingConfig = {
           language: 'ruby',
           code: getInstallSnippet(params),
         },
+        {
+          description: t('After adding the gems, run the following to install the SDK:'),
+          language: 'ruby',
+          code: 'bundle install',
+        },
       ],
     },
   ],
@@ -93,7 +106,27 @@ const onboarding: OnboardingConfig = {
       ],
     },
   ],
-  verify: () => [],
+  verify: () => [
+    {
+      type: StepType.VERIFY,
+      description: t(
+        "This snippet contains a deliberate error and message sent to Sentry and can be used as a test to make sure that everything's working as expected."
+      ),
+      configurations: [
+        {
+          code: [
+            {
+              label: 'ruby',
+              value: 'ruby',
+              language: 'ruby',
+              code: getVerifySnippet(),
+            },
+          ],
+        },
+      ],
+    },
+  ],
+  nextSteps: () => [],
 };
 
 const docs: Docs = {

+ 1 - 1
static/app/gettingStartedDocs/ruby/rails.spec.tsx

@@ -13,7 +13,7 @@ describe('rails onboarding docs', function () {
     // Renders main headings
     expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
     expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
-    expect(screen.getByRole('heading', {name: 'Caveats'})).toBeInTheDocument();
+    expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
 
     // Renders config options
     expect(

+ 25 - 15
static/app/gettingStartedDocs/ruby/rails.tsx

@@ -21,6 +21,8 @@ const getInstallSnippet = (
 ) => `${params.isProfilingSelected ? 'gem "stackprof"\n' : ''}gem "sentry-ruby"
 gem "sentry-rails"`;
 
+const generatorSnippet = 'bin/rails generate sentry';
+
 const getConfigureSnippet = (params: Params) => `
 Sentry.init do |config|
   config.dsn = '${params.dsn}'
@@ -48,7 +50,13 @@ Sentry.init do |config|
   }
 end`;
 
-const getVerifyRailsSnippet = () => `
+const getVerifySnippet = () => `
+begin
+  1 / 0
+rescue ZeroDivisionError => exception
+  Sentry.capture_exception(exception)
+end
+
 Sentry.capture_message("test message")`;
 
 const onboarding: OnboardingConfig = {
@@ -60,10 +68,9 @@ const onboarding: OnboardingConfig = {
     {
       type: StepType.INSTALL,
       description: tct(
-        'The Sentry SDK for Rails comes as two gems and is straightforward to install. If you are using Bundler just add this to your [gemfileCode:Gemfile] and run [bundleCode:bundle install]:',
+        'The Sentry SDK for Rails comes as two gems that should be added to your [gemfileCode:Gemfile]:',
         {
           gemfileCode: <code />,
-          bundleCode: <code />,
         }
       ),
       configurations: [
@@ -83,6 +90,11 @@ const onboarding: OnboardingConfig = {
           language: 'ruby',
           code: getInstallSnippet(params),
         },
+        {
+          description: t('After adding the gems, run the following to install the SDK:'),
+          language: 'ruby',
+          code: 'bundle install',
+        },
       ],
     },
   ],
@@ -90,33 +102,31 @@ const onboarding: OnboardingConfig = {
     {
       type: StepType.CONFIGURE,
       description: tct(
-        'Run [generate:bin/rails generate sentry] to create the initializer file [code:config/initializers/sentry.rb] and configure it as follows:',
+        'Run the following Rails generator to create the initializer file [code:config/initializers/sentry.rb].',
         {
           code: <code />,
         }
       ),
       configurations: [
+        {
+          language: 'ruby',
+          code: generatorSnippet,
+        },
+        {
+          description: t('You can then change the Sentry configuration as follows:'),
+        },
         {
           language: 'ruby',
           code: getConfigureSnippet(params),
         },
       ],
     },
-    {
-      title: t('Caveats'),
-      description: tct(
-        'Currently, custom exception applications [code:(config.exceptions_app)] are not supported. If you are using a custom exception app, you must manually integrate Sentry yourself.',
-        {
-          code: <code />,
-        }
-      ),
-    },
   ],
   verify: () => [
     {
       type: StepType.VERIFY,
       description: t(
-        "This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected."
+        "This snippet contains a deliberate error and message sent to Sentry and can be used as a test to make sure that everything's working as expected."
       ),
       configurations: [
         {
@@ -125,7 +135,7 @@ const onboarding: OnboardingConfig = {
               label: 'ruby',
               value: 'ruby',
               language: 'ruby',
-              code: getVerifyRailsSnippet(),
+              code: getVerifySnippet(),
             },
           ],
         },

+ 9 - 4
static/app/gettingStartedDocs/ruby/ruby.tsx

@@ -54,10 +54,9 @@ const onboarding: OnboardingConfig = {
     {
       type: StepType.INSTALL,
       description: tct(
-        'The Sentry SDK for Ruby comes as a gem and is straightforward to install. If you are using Bundler just add this to your [gemfileCode:Gemfile] and run [bundleCode:bundle install]:',
+        'The Sentry SDK for Ruby comes as a gem that should be added to your [gemfileCode:Gemfile]:',
         {
           gemfileCode: <code />,
-          bundleCode: <code />,
         }
       ),
       configurations: [
@@ -77,6 +76,11 @@ const onboarding: OnboardingConfig = {
           language: 'ruby',
           code: getInstallSnippet(params),
         },
+        {
+          description: t('After adding the gems, run the following to install the SDK:'),
+          language: 'ruby',
+          code: 'bundle install',
+        },
       ],
     },
   ],
@@ -98,11 +102,12 @@ const onboarding: OnboardingConfig = {
   verify: () => [
     {
       type: StepType.VERIFY,
-      description: t('You can then report errors or messages to Sentry:'),
+      description: t(
+        "This snippet contains a deliberate error and message sent to Sentry and can be used as a test to make sure that everything's working as expected."
+      ),
       configurations: [
         {
           language: 'ruby',
-
           code: getVerifySnippet(),
         },
       ],