Skip to content

Commit

Permalink
Fix outdated branded words:
Browse files Browse the repository at this point in the history
- Red Hat Virtualization: Change from "RHEV" to "RHV"
- Red Hat Openstack Platform: Change from "RHEL Openstack Platform" to "Red Hat Openstack Platform"
- Fix link to docs for registering hosts using bootstrap script
- Simplify regular expressions
- Add test based on documentation strings
  • Loading branch information
Thorben-D committed Jul 31, 2024
1 parent d224425 commit 2fabc8d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 43 deletions.
51 changes: 10 additions & 41 deletions lib/foreman_theme_satellite/branded_words.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,17 @@ module ForemanThemeSatellite
# For now, modifiers are not supported by the generator.
# Make sure the regexp works both with Ruby and JavaScript.
# Entries are processed in order and first wins.
# Occurrences of "proxy" should be treated as a bug as it is unclear whether the author refers to a HTTP(S) proxy or a Capsule
FOREMAN_BRAND = {
/%{proxy}/ => '%{proxy}',
/%{foreman}/ => '%{foreman}',
/\b[Hh][Tt][Tt][Pp] [Pp]roxy\b(?!-)/ => 'HTTP Proxy',
/\b[Hh][Tt][Tt][Pp] [Pp]roxies\b(?!-)/ => 'HTTP Proxies',
/\bHTTP\(S\) proxy\b(?!-)/ => 'HTTP(S) proxy',
/\bIgnore Proxy\b(?!-)/ => 'Ignore Proxy',
/\bIgnore proxy\b(?!-)/ => 'Ignore Proxy',
/\bSystem-wide proxies\b(?!-)/ => 'System-wide proxies',
/\bLeave this blank if no proxy is used\b(?!-)/ => 'Leave this blank if no proxy is used',
/\bbypass proxy settings\b(?!-)/ => 'bypass proxy settings',
/\bURL of the proxy\b(?!-)/ => 'URL of the proxy',
%r{\bhttps://proxy.example.com:8080\b(?!-)} => 'https://proxy.example.com:8080',
/\bproxy for all outgoing HTTP connections\b(?!-)/ => 'proxy for all outgoing HTTP connections',
/\bperform various actions through those proxies\b(?!-)/ => 'perform various actions through those proxies',
/\bForeman\b(?!-)/ => 'Satellite',
/\bforeman\b(?!-)/ => 'satellite',
/\bsmart-proxy\b(?!-)/ => 'capsule',
/\bSmart-proxy\b(?!-)/ => 'Capsule',
/\bsmart proxies\b(?!-)/ => 'capsules',
/\bSmart proxies\b(?!-)/ => 'Capsules',
/\bsmart-proxies\b(?!-)/ => 'capsules',
/\bSmart-proxies\b(?!-)/ => 'Capsules',
/\bSmart Proxies\b(?!-)/ => 'Capsules',
/\bSmart Proxy\(ies\)(?!-)/ => 'Capsule(s)',
/\bSmart Proxy\b(?!-)/ => 'Capsule',
/\bsmart proxy\b(?!-)/ => 'capsule',
/\bSmart-Proxies\b(?!-)/ => 'Capsules',
/\bSmart proxy\b(?!-)/ => 'Capsule',
/\bSmart-Proxy\b(?!-)/ => 'Capsule',
/\boVirt\b(?!-)/ => 'RHEV',
/\bovirt\b(?!-)/ => 'RHEV',
/\bOvirt\b(?!-)/ => 'RHEV',
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
/\bOpenStack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bopenstack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bOpenstack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bProxy\b(?!-)/ => 'Capsule',
/\bproxy\b(?!-)/ => 'Capsule',
/\bProxies\b(?!-)/ => 'Capsules',
/\bproxies\b(?!-)/ => 'Capsules',
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxy\b(?!-)/ => 'HTTP proxy',
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxies\b(?!-)/ => 'HTTP proxies',
/\b[Ff]oreman\b(?!-)/ => 'Satellite',
/\b[Ss]mart[- ]?[pP]roxy\b(?!-)/ => 'Capsule',
/\b[Ss]mart[- ]?[pP]roxies\b(?!-)/ => 'Capsules',
/\b[Oo][Vv]irt\b(?!-)/ => 'RHV',
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
/\b[Oo]pen[Ss]tack\b(?!-)/ => 'Red Hat OpenStack Platform',
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
/\b[Kk]atello 4.10\b(?!-)/ => 'Satellite 6.15',
/\b[Kk]atello 4.11\b(?!-)/ => 'Satellite 6.15',
/\b[Kk]atello 4.12\b(?!-)/ => 'Satellite 6.16',
Expand Down
29 changes: 27 additions & 2 deletions test/unit/replacer_repository_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,33 @@ class TranslationsTest < ActiveSupport::TestCase
end

test 'Can work with whitelist branding' do
actual = _('HTTP proxy for proxy')
actual = _('http proxy for smart proxy')

assert_equal 'HTTP Proxy for Capsule', actual
assert_equal 'HTTP proxy for Capsule', actual
end

test 'random branding test' do
# Tests branding based on strings randomly picked from Foreman- and Satellite-documentation
# rubocop:disable Layout/LineLength

Check failure on line 24 in test/unit/replacer_repository_test.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Lint/RedundantCopDisableDirective: Unnecessary disabling of `Layout/LineLength`.
test_strings = [
'An operating system is a collection of resources that define how Foreman server installs a base operating system on a host.',
'Installing the Infoblox CA certificate on Smart Proxy server',
'In the Foreman web UI, navigate to Infrastructure > Smart Proxies, select the Smart Proxy with the DHCP Infoblox module, and ensure that the dhcp feature is listed.',
'Foreman Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.',
'In Foreman, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.',
]
translated_strings = [
'An operating system is a collection of resources that define how Satellite server installs a base operating system on a host.', # Pr. Hosts: 2.3
'Installing the Infoblox CA certificate on Capsule server', # Pr. Hosts: 4.3
'In the Satellite web UI, navigate to Infrastructure > Capsules, select the Capsule with the DHCP Infoblox module, and ensure that the dhcp feature is listed.', # Pr. Hosts: 4.4
'Satellite Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.', # Pr. Hosts: 5.3
'In Satellite, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.', # Pr. Hosts: 14.4
]
# rubocop:enable Layout/LineLength

test_strings.zip(translated_strings).each do |original, target|
assert_equal target, _(original)
end
end

Check failure on line 45 in test/unit/replacer_repository_test.rb

View workflow job for this annotation

GitHub Actions / Rubocop / Rubocop

Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
end

0 comments on commit 2fabc8d

Please sign in to comment.