Module: ForemanThemeSatellite

Defined in:
lib/foreman_theme_satellite/documentation.rb,
lib/foreman_theme_satellite.rb,
lib/foreman_theme_satellite/engine.rb,
lib/foreman_theme_satellite/version.rb,
lib/foreman_theme_satellite/pry_rack.rb,
lib/foreman_theme_satellite/branded_words.rb,
app/services/foreman_theme_satellite/lifecycle.rb,
lib/foreman_theme_satellite/replacer_repository.rb,
lib/foreman_theme_satellite/deprecated_templates.rb,
lib/foreman_theme_satellite/rss_checker_branding.rb,
app/services/foreman_theme_satellite/renderer_methods.rb,
lib/generators/foreman_theme_satellite/lib/css_compare.rb,
lib/generators/foreman_theme_satellite/lib/color_changer.rb,
lib/generators/foreman_theme_satellite/color_diff_generator.rb

Overview

rubocop:disable Metrics/LineLength

Defined Under Namespace

Modules: Documentation, RendererMethods, RssCheckerBranding Classes: ColorDiffGenerator, CssCompare, Engine, Lifecycle, PryRack, ReplacerRepository

Constant Summary collapse

METADATA_PATH =
'/usr/share/satellite/metadata.yml'.freeze
LIFECYCLE_METADATA_PATH =
'/usr/share/satellite/lifecycle-metadata.yml'.freeze
SATELLITE_VERSION =

this file indicates the satellite version that will be represented on the login page.

get_satellite_version
SATELLITE_SHORT_VERSION =

this file indicates the satellite version that will be used on links to documentation.

get_satellite_short_version
VERSION =
'13.2.4'.freeze
FOREMAN_BRAND =

This list is used for substitution of branded words by both client and server. The server just uses the list as is. The client is consuming it by generated .js.erb file: app/assets/javascripts/theme_client_side_branding.js.erb. 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.

{
  /%{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[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',
  /\b[Kk]atello 4.13\b(?!-)/       => 'Satellite 6.16',
  %r{https://theforeman.org/plugins/katello/(?!-)} => "https://access.redhat.com/documentation/en-us/red_hat_satellite/#{ForemanThemeSatellite::SATELLITE_SHORT_VERSION}/html/managing_hosts/registering_hosts#registering-a-host-to-satellite-using-the-bootstrap-script"
}.freeze
DEPRECATED_TEMPLATES =
{
  'Satellite Kickstart Default' => 'Kickstart default',
  'Satellite Kickstart Default User Data' => 'Kickstart default user data',
  'Satellite Kickstart Default Finish' => 'Kickstart default finish',
  'idm_register' => 'freeipa_register',
  'Satellite Atomic Kickstart Default' => 'Atomic Kickstart default'
}.freeze
COLOR_REGEX =
/#([0-9A-Fa-f]){3}((?=[^[:alnum:]])|([0-9A-Fa-f]){3,5})/i
COLOR_REPLACEMENT =

This color translation is copied from previous colors.scss file. When the same source color was translated to multiple destinations, one of the conflicting pairs was commented out and left for future reference. Each line is commented by the corresponding parameter name.

{
  '#005c7e' => '#393F44', # $primary_color
  '#0187b6' => '#5F666C',   # $border_color
  # '#005c7e' => '#CC0000',   # $brand_color
  '#0072a0' => '#474C51',   # $primary_gradient_start
  # '#0072a0' => '#393F44', # $primary_gradient_end
  '#005b7e' => '#72757A',   # $selected_gradient_start
  # '#005b7e' => '#5c6165', # $hover_gradient_start
  '#006289' => '#64686C',   # $selected_gradient_end
  # '#006289' => '#4b5053'  # $hover_gradient_end
  '#024d6c' => '#393F44',   # $nav-pf-vertical-bg-color
  '#026991' => '#474C51',   # $nav-pf-vertical-active-bg-color
  '#01749d' => '#202020'    # $topbar-default-color
}.freeze

Class Method Summary collapse

Class Method Details

.documentation_rootObject



149
150
151
152
153
# File 'lib/foreman_theme_satellite/engine.rb', line 149

def self.documentation_root
  @documentation_root ||= begin
    "#{documentation_server}/documentation/en-us/red_hat_satellite/#{documentation_version}/html"
  end
end

.documentation_serverObject



141
142
143
# File 'lib/foreman_theme_satellite/engine.rb', line 141

def self.documentation_server
  @documentation_server ||= ('documentation_server', 'https://access.redhat.com')
end

.documentation_versionObject



145
146
147
# File 'lib/foreman_theme_satellite/engine.rb', line 145

def self.documentation_version
  @documentation_version ||= ('documentation_version', ForemanThemeSatellite::SATELLITE_SHORT_VERSION)
end

.get_satellite_short_versionObject



137
138
139
# File 'lib/foreman_theme_satellite/engine.rb', line 137

def self.get_satellite_short_version
  Foreman::Version.new(SATELLITE_VERSION).short
end

.get_satellite_versionObject



133
134
135
# File 'lib/foreman_theme_satellite/engine.rb', line 133

def self.get_satellite_version
  ('version', '6.14.0-development')
end

.lifecycle_dataObject



129
130
131
# File 'lib/foreman_theme_satellite/engine.rb', line 129

def self.lifecycle_data
  @lifecycle_data ||= ForemanThemeSatellite::Lifecycle.lifecycle_data(get_satellite_version)
end

.metadata_field(key, default) ⇒ Object



119
120
121
122
123
124
125
126
127
# File 'lib/foreman_theme_satellite/engine.rb', line 119

def self.(key, default)
  value = ENV["SATELLITE_#{key.upcase}"]
  return value if value

   = Rails.env.production? ? METADATA_PATH : "#{__dir__}/../../config/metadata.yml"

  @metadata_yaml ||= File.exist?() ? YAML.load_file() : {}
  @metadata_yaml.fetch(key, default)
end