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/foreman_brand.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/foreman_theme_satellite/scap_bulk_upload_extensions.rb,
lib/generators/foreman_theme_satellite/lib/color_changer.rb,
lib/generators/foreman_theme_satellite/color_diff_generator.rb

Overview

rubocop:disable Layout/LineLength

Defined Under Namespace

Modules: Documentation, RendererMethods, RssCheckerBranding, ScapBulkUploadExtensions 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 =
'15.2.0'.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. 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

{
  /%{proxy}/               => '%{proxy}',
  /%{foreman}/             => '%{foreman}',
  /\b[Pp]roxy [Hh][Tt][Tt][Pp]\b(?!-)/    => 'Proxy HTTP', # Workaround for French translation
  /\b[Pp]roxies [Hh][Tt][Tt][Pp]\b(?!-)/ => 'Proxies HTTP', # Workaround for French translation
  ## BEGIN Remove after imprecise strings have been fixed in core
  /\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxy\b(?!-)/ => 'HTTP proxy',
  /\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [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',
  ## END
  /\b[Ff]oreman\b(?!-)/            => 'Satellite',
  /\b[Ss]mart[- ]?[Pp]roxy\(ies\)(?!-)/ => 'Capsule(s)',
  /\b[Ss]mart[- ]?[pP]roxy\b(?!-)/ => 'Capsule',
  /\b[Ss]mart[- ]?[pP]roxies\b(?!-)/ => 'Capsules',
  /\b[Pp]roxy\b(?!-)/              => 'Capsule',
  /\b[Pp]roxies\b(?!-)/              => 'Capsules',
  /\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',
  /\b[Kk]atello 4.13\b(?!-)/       => 'Satellite 6.16',
}.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



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

def self.documentation_root
  @documentation_root ||= begin
    "#{unversioned_documentation_root}/#{documentation_version}/html"
  end
end

.documentation_serverObject



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

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

.documentation_versionObject



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

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

.get_satellite_short_versionObject



125
126
127
# File 'lib/foreman_theme_satellite/engine.rb', line 125

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

.get_satellite_versionObject



121
122
123
# File 'lib/foreman_theme_satellite/engine.rb', line 121

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

.lifecycle_dataObject



117
118
119
# File 'lib/foreman_theme_satellite/engine.rb', line 117

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

.metadata_field(key, default) ⇒ Object



107
108
109
110
111
112
113
114
115
# File 'lib/foreman_theme_satellite/engine.rb', line 107

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

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

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

.unversioned_documentation_rootObject



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

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