Sha256: aa20aeaef596907c92373126ee2c8e603304f433be7dd1061d2e5ee5873ff5ab

Contents?: true

Size: 1.85 KB

Versions: 11

Compression:

Stored size: 1.85 KB

Contents

# frozen_string_literal: true

require 'cucumber/term/banner'

module Cucumber
  module Formatter
    class PublishBannerPrinter
      include Term::Banner

      def initialize(configuration)
        return if configuration.publish_enabled?

        configuration.on_event :test_run_finished do |_event|
          display_publish_ad(configuration.error_stream)
        end
      end

      # rubocop:disable Metrics/MethodLength
      def display_publish_ad(io)
        display_banner(
          [
            [
              'Share your Cucumber Report with your team at ',
              link('https://reports.cucumber.io')
            ],
            '',
            [
              'Command line option:    ',
              highlight('--publish')
            ],
            [
              'Environment variable:   ',
              highlight('CUCUMBER_PUBLISH_ENABLED'),
              '=',
              highlight('true')
            ],
            [
              'cucumber.yml:           ',
              highlight('default: --publish')
            ],
            '',
            [
              'More information at ',
              link('https://cucumber.io/docs/cucumber/environment-variables/')
            ],
            '',
            [
              'To disable this message, specify ',
              pre('CUCUMBER_PUBLISH_QUIET=true'),
              ' or use the '
            ],
            [
              pre('--publish-quiet'),
              ' option. You can also add this to your ',
              pre('cucumber.yml:')
            ],
            [pre('default: --publish-quiet')]
          ],
          io
        )
      end
      # rubocop:enable Metrics/MethodLength

      def highlight(text)
        [text, :cyan]
      end

      def link(text)
        [text, :cyan, :bold, :underline]
      end

      def pre(text)
        [text, :bold]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
cucumber-9.0.1 lib/cucumber/formatter/publish_banner_printer.rb
cucumber-9.0.0 lib/cucumber/formatter/publish_banner_printer.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/publish_banner_printer.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/publish_banner_printer.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/publish_banner_printer.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/publish_banner_printer.rb
cucumber-8.0.0 lib/cucumber/formatter/publish_banner_printer.rb
cucumber-8.0.0.rc.1 lib/cucumber/formatter/publish_banner_printer.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-7.1.0/lib/cucumber/formatter/publish_banner_printer.rb
cucumber-7.1.0 lib/cucumber/formatter/publish_banner_printer.rb
cucumber-7.0.0 lib/cucumber/formatter/publish_banner_printer.rb