You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

publish_banner_printer.rb 1.9 kB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # frozen_string_literal: true
  2. require 'cucumber/term/banner'
  3. module Cucumber
  4. module Formatter
  5. class PublishBannerPrinter
  6. include Term::Banner
  7. def initialize(configuration)
  8. return if configuration.publish_enabled?
  9. configuration.on_event :test_run_finished do |_event|
  10. display_publish_ad(configuration.error_stream)
  11. end
  12. end
  13. # rubocop:disable Metrics/MethodLength
  14. def display_publish_ad(io)
  15. display_banner(
  16. [
  17. [
  18. 'Share your Cucumber Report with your team at ',
  19. link('https://reports.cucumber.io')
  20. ],
  21. '',
  22. [
  23. 'Command line option: ',
  24. highlight('--publish')
  25. ],
  26. [
  27. 'Environment variable: ',
  28. highlight('CUCUMBER_PUBLISH_ENABLED'),
  29. '=',
  30. highlight('true')
  31. ],
  32. [
  33. 'cucumber.yml: ',
  34. highlight('default: --publish')
  35. ],
  36. '',
  37. [
  38. 'More information at ',
  39. link('https://cucumber.io/docs/cucumber/environment-variables/')
  40. ],
  41. '',
  42. [
  43. 'To disable this message, specify ',
  44. pre('CUCUMBER_PUBLISH_QUIET=true'),
  45. ' or use the '
  46. ],
  47. [
  48. pre('--publish-quiet'),
  49. ' option. You can also add this to your ',
  50. pre('cucumber.yml:')
  51. ],
  52. [pre('default: --publish-quiet')]
  53. ],
  54. io
  55. )
  56. end
  57. # rubocop:enable Metrics/MethodLength
  58. def highlight(text)
  59. [text, :cyan]
  60. end
  61. def link(text)
  62. [text, :cyan, :bold, :underline]
  63. end
  64. def pre(text)
  65. [text, :bold]
  66. end
  67. end
  68. end
  69. end

No Description

Contributors (1)