foreman_theme_satellite 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +619 -0
  3. data/README.md +482 -0
  4. data/Rakefile +47 -0
  5. data/app/assets/images/foreman_theme_satellite/favicon.ico +0 -0
  6. data/app/assets/images/foreman_theme_satellite/header_logo.svg +836 -0
  7. data/app/assets/images/foreman_theme_satellite/login_bg.svg +384 -0
  8. data/app/assets/images/foreman_theme_satellite/login_logo.svg +840 -0
  9. data/app/assets/javascripts/foreman_theme_satellite/locale/en/foreman_theme_satellite.js +124 -0
  10. data/app/assets/javascripts/foreman_theme_satellite/theme_dashboard.js +17 -0
  11. data/app/assets/javascripts/foreman_theme_satellite/theme_ng_page_title.js +15 -0
  12. data/app/assets/stylesheets/foreman_theme_satellite/application_colors.css +12 -0
  13. data/app/assets/stylesheets/foreman_theme_satellite/bastion.scss +5 -0
  14. data/app/assets/stylesheets/foreman_theme_satellite/external_logout.scss +13 -0
  15. data/app/assets/stylesheets/foreman_theme_satellite/foreman_theme_satellite.css +1 -0
  16. data/app/assets/stylesheets/foreman_theme_satellite/login.scss +32 -0
  17. data/app/assets/stylesheets/foreman_theme_satellite/patternfly_and_overrides.scss +7 -0
  18. data/app/assets/stylesheets/foreman_theme_satellite/provisioning_templates.scss +3 -0
  19. data/app/assets/stylesheets/foreman_theme_satellite/theme.scss +14 -0
  20. data/app/assets/stylesheets/foreman_theme_satellite/topbar.scss +11 -0
  21. data/app/assets/stylesheets/foreman_theme_satellite/wizard.scss +14 -0
  22. data/app/controllers/concerns/documentation_controller_branding.rb +33 -0
  23. data/app/controllers/concerns/provisioning_templates_controller_branding.rb +94 -0
  24. data/app/helpers/provisioning_templates_helper_branding.rb +12 -0
  25. data/app/helpers/rhev_helper.rb +10 -0
  26. data/app/helpers/theme_application_helper.rb +17 -0
  27. data/app/helpers/theme_css_class_helper.rb +8 -0
  28. data/app/helpers/theme_discovery_helper.rb +10 -0
  29. data/app/helpers/theme_external_logout_helper.rb +10 -0
  30. data/app/helpers/theme_layout_helper.rb +18 -0
  31. data/app/helpers/theme_login_helper.rb +10 -0
  32. data/app/models/concerns/branch_info_branding.rb +9 -0
  33. data/app/models/concerns/deprecation_notification.rb +23 -0
  34. data/app/models/concerns/distributor_version.rb +7 -0
  35. data/app/models/concerns/gce.rb +7 -0
  36. data/app/models/concerns/openstack.rb +8 -0
  37. data/app/models/concerns/ovirt.rb +8 -0
  38. data/app/models/concerns/provisioning.rb +21 -0
  39. data/app/models/concerns/realm_theme.rb +18 -0
  40. data/app/models/concerns/satellite_packages.rb +8 -0
  41. data/app/models/concerns/setting_branding.rb +17 -0
  42. data/app/models/concerns/upstream_only_settings.rb +6 -0
  43. data/app/overrides/bootdisk_help_page.rb +44 -0
  44. data/app/overrides/layouts/base/theme_react_root.html.erb.deface +7 -0
  45. data/app/overrides/layouts/base/theme_resources.html.erb.deface +7 -0
  46. data/app/overrides/layouts/base/theme_style_resources.html.erb.deface +3 -0
  47. data/app/overrides/rhev.rb +14 -0
  48. data/app/overrides/satellite_name_override.rb +83 -0
  49. data/app/services/concerns/setting_registry_branding.rb +20 -0
  50. data/app/services/foreman_theme_satellite/renderer_methods.rb +22 -0
  51. data/app/views/api/v2/home/status_extensions.json.rabl +1 -0
  52. data/app/views/foreman_theme_satellite/_theme_client_side_branding.js.erb +63 -0
  53. data/app/views/foreman_theme_satellite/rhev/_form.erb +8 -0
  54. data/app/views/foreman_theme_satellite/rhev/_show.html.erb +6 -0
  55. data/db/migrate/20160404130619_remove_satellite_from_notification_name.rb +8 -0
  56. data/db/migrate/20161220092005_remove_satellite_from_notification_name_spell_correction.rb +24 -0
  57. data/db/migrate/20180516103339_update_idm_params.rb +19 -0
  58. data/db/migrate/20180605150932_deprecate_satellite_templates.rb +52 -0
  59. data/db/migrate/20181108171732_change_blog_url.rb +13 -0
  60. data/db/migrate/20201118090534_insights_param.rb +9 -0
  61. data/db/seeds.d/069-provisioning_templates_defaults.rb +24 -0
  62. data/db/seeds.d/850-global_parameters.rb +15 -0
  63. data/lib/foreman_theme_satellite/branded_words.rb +58 -0
  64. data/lib/foreman_theme_satellite/deprecated_templates.rb +9 -0
  65. data/lib/foreman_theme_satellite/documentation.rb +76 -0
  66. data/lib/foreman_theme_satellite/engine.rb +155 -0
  67. data/lib/foreman_theme_satellite/pry_rack.rb +12 -0
  68. data/lib/foreman_theme_satellite/replacer_repository.rb +57 -0
  69. data/lib/foreman_theme_satellite/rss_checker_branding.rb +11 -0
  70. data/lib/foreman_theme_satellite/version.rb +3 -0
  71. data/lib/foreman_theme_satellite.rb +4 -0
  72. data/lib/generators/foreman_theme_satellite/color_diff_generator.rb +32 -0
  73. data/lib/generators/foreman_theme_satellite/lib/color_changer.rb +25 -0
  74. data/lib/generators/foreman_theme_satellite/lib/css_compare.rb +85 -0
  75. data/lib/tasks/foreman_theme_satellite_tasks.rake +48 -0
  76. data/locale/Makefile +65 -0
  77. data/locale/en/foreman_theme_satellite.edit.po +152 -0
  78. data/locale/en/foreman_theme_satellite.po +286 -0
  79. data/locale/en/foreman_theme_satellite.po.time_stamp +0 -0
  80. data/locale/foreman_theme_satellite.pot +387 -0
  81. data/locale/gemspec.rb +2 -0
  82. data/package.json +31 -0
  83. data/webpack/index.js +5 -0
  84. metadata +226 -0
data/README.md ADDED
@@ -0,0 +1,482 @@
1
+ # ForemanThemeSatellite
2
+
3
+ ## Goals:
4
+ 1. Make downstream release automated.
5
+ 2. Have the same code base for all upstream/downstream projects.
6
+ 3. Create one place to insert all the changes from upstream to downstream (1
7
+ project changes vs all projects).
8
+ 4. Usage of downstream translations for upstream use.
9
+
10
+ ## String branding
11
+
12
+ The most common task is to brand string messages shown to the user:
13
+
14
+ We want `Welcome to foreman` to become `Welcome to Satellite`.
15
+
16
+ This is done for both `.erb` and `.js` files by enabling translation:
17
+
18
+ Ruby code - erb and helpers:
19
+ ``` ruby
20
+ <%= _('Welcome to Foreman') %>
21
+ # => "Welcome to Satellite"
22
+ ```
23
+
24
+ React:
25
+ ``` jsx
26
+ const SettingName = ({ setting }) => (
27
+ <React.Fragment>
28
+ {__('Welcome to Foreman')}
29
+ </React.Fragment>
30
+ );
31
+ // =>
32
+ // <React.Fragment>
33
+ // Welcome to Satellite
34
+ // </React.Fragment>
35
+ ```
36
+
37
+ In case there is a need to add more terms to be branded **or bypass branding**,
38
+ it can be done in
39
+ [`branded_words.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/lib/foreman_theme_satellite/branded_words.rb).
40
+ This is a dictionary where the key is a
41
+ [Regular Expression](https://regex101.com/) and the value is a replacement
42
+ string.
43
+
44
+ ``` ruby
45
+ FOREMAN_BRAND = {
46
+ # string to replace:
47
+ /\bForeman\b(?!-)/ => 'Satellite',
48
+ /\bproxy\b(?!-)/ => 'Capsule',
49
+ # string to bypass
50
+ /\bHTTP\(S\) proxy\b(?!-)/ => 'HTTP(S) proxy',
51
+ }
52
+
53
+ branded_string = _('Use proxy for this')
54
+ # => "Use Capsule for this"
55
+ bypassed_string = _('HTTP(S) proxy will not be branded')
56
+ # => "HTTP(S) proxy will not be branded"
57
+ ```
58
+
59
+ In order to brand translated strings too, the system assumes that the names will
60
+ appear in the translated string exactly as they appear in the original string.
61
+
62
+ For example in Russian we will use
63
+ ```
64
+ "Добро пожаловать в Foreman"
65
+ ```
66
+ that will be branded automatically to
67
+ ```
68
+ "Добро пожаловать в Satellite"
69
+ ```
70
+
71
+ ## Downstream documentation
72
+
73
+ Many times we need to use a downstream link instead of an upstream one. The most
74
+ common example for this is pointing to a documentation link.
75
+
76
+ All links to documentation in Foreman are local and redirected to
77
+ `links_controller`. This controller is prepended with
78
+ `documentation_controller_branding` concern that uses dictionary stored in
79
+ `lib/foreman_theme_satellite/documentation.rb` to redirect documentation to
80
+ downstream URLs.
81
+
82
+ In foreman:
83
+ ``` ruby
84
+ <p><%= link_to _('Learn more about LDAP authentication in the documentation.'), documentation_url("4.1.1LDAPAuthentication")%></p>
85
+ ```
86
+ will redirect to https://theforeman.org/manuals/2.2/index.html#4.1.1LDAPAuthentication
87
+
88
+ to change that, we need to add a downstream documentation link to [`documentation.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/lib/foreman_theme_satellite/documentation.rb):
89
+
90
+ ``` ruby
91
+ USER_GUIDE_DICTIONARY = {
92
+ # ...
93
+ 'LDAPAuthentication' => "#{ForemanThemeSatellite.documentation_root}/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-configuring_external_authentication",
94
+ # ...
95
+ }
96
+ ```
97
+ notice the use of
98
+ ``` ruby
99
+ ForemanThemeSatellite.documentation_root
100
+ ```
101
+ this constant is maintained by the theme and always point to the correct
102
+ documentation version.
103
+
104
+ ## Settings
105
+
106
+ Most of the time a setting's default value should be changed to a downstream
107
+ version. This is done by adding more entries to setting changing code in
108
+ [`settings_branding.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/models/concerns/settings_branding.rb)
109
+
110
+ ``` ruby
111
+ @branded_settings ||= {
112
+ 'my_new_setting' => 'satellite value'
113
+ 'email_reply_address' => "satellite-noreply@#{domain}",
114
+ 'email_subject_prefix' => '[satellite]',
115
+
116
+ 'rss_url' => 'https://www.redhat.com/en/rss/blog/channel/red-hat-satellite',
117
+ 'foreman_tasks_troubleshooting_url' => 'https://access.redhat.com/solutions/satellite6-tasks#%{label}'
118
+ }.freeze
119
+
120
+ ```
121
+
122
+ ## Notifications
123
+
124
+ When a feature is deprecated upstream, a deprecation notification might need
125
+ branding.
126
+
127
+ An example to this is in
128
+ [`deprecation_notification.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/models/concerns/deprecation_notification.rb)
129
+
130
+ Standard ruby override technique is used to override notification behavior
131
+
132
+ ``` ruby
133
+ module DeprecationNotification
134
+ module StringParser
135
+ def initialize(template, options = {})
136
+ options[:version] = '6.8' if options[:version] == '2.0'
137
+ super(template, options)
138
+ end
139
+ end
140
+
141
+ module Notification
142
+ def create!(opts)
143
+ if opts[:notification_blueprint] == NotificationBlueprint.find_by_name('feature_deprecation') &&
144
+ opts.dig(:actions, :links, 0, :href) == 'https://community.theforeman.org/t/dropping-smart-variables/16176'
145
+ opts[:actions][:links][0][:href] = "#{ForemanThemeSatellite.documentation_root}/release_notes/index"
146
+ end
147
+ super(opts)
148
+ end
149
+ end
150
+ end
151
+ ```
152
+
153
+ and later on in [`engine.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/lib/foreman_theme_satellite/engine.rb)
154
+ ``` ruby
155
+ UINotifications::StringParser.send :prepend, DeprecationNotification::StringParser
156
+ Notification.singleton_class.send :prepend, DeprecationNotification::Notification
157
+ ```
158
+ ## CSS:
159
+
160
+ There are two common tasks that need to be done:
161
+ * layout changes
162
+ * color scheme adjustments
163
+
164
+ ### Layout changes
165
+
166
+ Layout constants may need adjusting since the logos e.t.c. look differently in
167
+ themed pages. This is done by adding a new SCSS file under
168
+ [`satellite`](https://github.com/RedHatSatellite/foreman_theme_satellite/tree/develop/app/assets/stylesheets/satellite)
169
+ folder in `app/assets/stylesheets`.
170
+
171
+ Make sure the CSS rules are the most specific, so that the CSS engine would use
172
+ theme version instead of the default foreman ones.
173
+
174
+ ```scss
175
+ .wizard li {
176
+ padding: 8px 12px 8px;
177
+
178
+ &:first-child {
179
+ -webkit-border-radius: 0;
180
+ -moz-border-radius: 0;
181
+ border-radius: 0;
182
+ }
183
+ &:last-child {
184
+ -webkit-border-radius: 0;
185
+ -moz-border-radius: 0;
186
+ border-radius: 0;
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### Color adjustments
192
+
193
+ When a color scheme need adjustment, most of the time it should be done across
194
+ all the values. It will require generating the final CSS file (not the scss
195
+ sources) and running a transformation that will result in a set of color
196
+ changing rules that should be placed under the
197
+ [`satellite`](https://github.com/RedHatSatellite/foreman_theme_satellite/tree/develop/app/assets/stylesheets/satellite)
198
+ folder.
199
+
200
+ * For files in `app/assets/...` run `rails assets:precompile`. The source path
201
+ will be `public/assets/application-ETag.css`
202
+ * For files in `webpack/...` run `rake webpack:compile`. The source path will
203
+ be `public/webpack/bundle-ETag.css`
204
+ * Run the following command in the foreman directory:
205
+ `rails generate foreman_theme_satellite:color_diff --source_css <PATH_TO_SOURCE_FILE> --destination_file <PATH_TO_DESTINATION_FILE>`
206
+
207
+ List of color conversion rules can be found in:
208
+ [`color_changer.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/lib/generators/foreman_theme_satellite/lib/color_changer.rb)
209
+ in case a new rule should be added.
210
+
211
+ ``` ruby
212
+ COLOR_REPLACEMENT = {
213
+ '#000000' => '#FFFFFF', # $primary_color
214
+ }
215
+ ```
216
+
217
+ ## HTML and components
218
+
219
+ ### React components
220
+ For react components there is a need to create an extension point in the base
221
+ code by using a proper [`Slot`](https://theforeman.github.io/foreman/?path=/docs/introduction-slot-and-fill--page).
222
+ Later we will be able to register a `Fill` component in our global
223
+ [`index.js`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/webpack/index.js)
224
+ file.
225
+
226
+ Example slot [foreman](https://github.com/theforeman/foreman/blob/6ed930afb09f340ccc0106512df53e2874ba37a5/webpack/assets/javascripts/react_app/components/HostDetails/index.js#L140) code:
227
+
228
+ ``` jsx
229
+ <div className="host-details-tab-item">
230
+ <Slot
231
+ response={response}
232
+ id="host-details-page-tabs"
233
+ fillID={tab}
234
+ />
235
+ </div>
236
+ ```
237
+
238
+ Later we can add a proper fill in the theme:
239
+
240
+ ``` jsx
241
+ import React from 'react';
242
+ import { addGlobalFill } from '../../common/Fill/GlobalFill';
243
+ import SatelliteDetailsTab from './Details';
244
+
245
+ export const registerCoreTabs = () => {
246
+ addGlobalFill('host-details-page-tabs', 'Details', <SatelliteDetailsTab />, 1000);
247
+ };
248
+ ```
249
+
250
+ ### Components added from ERB pages
251
+ Sometimes a component is added from an `.erb` file. Those components often pass
252
+ server data as props to the component.
253
+
254
+ It is advised to design such extension points with helper functions, to make the
255
+ process of replacing props easier.
256
+
257
+ For example in [`foreman`](https://github.com/theforeman/foreman/blob/develop/app/helpers/login_helper.rb)
258
+ we use
259
+
260
+ ``` ruby
261
+ def login_props
262
+ {
263
+ token: form_authenticity_token,
264
+ version: SETTINGS[:version].version,
265
+ caption: Setting[:login_text],
266
+ alerts: flash_inline,
267
+ logoSrc: image_path("foreman_theme_satellite/login_logo.png"),
268
+ }
269
+ end
270
+
271
+ def mount_login
272
+ react_component('LoginPage', login_props.to_json)
273
+ end
274
+ ```
275
+
276
+ to mount react login component. Once the extension point is in place, we can
277
+ override it from theme helper:
278
+
279
+ ``` ruby
280
+ module ThemeLoginHelper
281
+ def login_props
282
+ super.merge(
283
+ version: ForemanThemeSatellite::SATELLITE_VERSION,
284
+ logoSrc: image_path('foreman_theme_satellite/login_logo.svg')
285
+ )
286
+ end
287
+ end
288
+ ```
289
+
290
+ ### Change-views/layouts:
291
+
292
+ Use [deface](https://github.com/spree/deface) in order to change views,
293
+ all the deface changes are located under
294
+ [`app/overrides`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/overrides/).
295
+
296
+ For example, changing about page content
297
+
298
+ ```ruby
299
+ Deface::Override.new(:virtual_path => "about/index",
300
+ :name => "change about page content",
301
+ # div#support
302
+ :replace => "div.col-md-5 div.stats-well:nth-child(1)",
303
+ :text => " <div class=\"stats-well\"><h4><%= _(\"Support\") %></h4> <p>Visit the <%= link_to _('Customer Portal'), \"https://access.redhat.com/\",
304
+ :rel => \"external\" %> to get support, find solutions to common questions, and more.</p><h6><%= _(\"Documentation\") %></h6>
305
+ <ul>
306
+ <li><%= link_to _('Complete Product Documentation for Red Hat Satellite'),\"https://access.redhat.com/documentation/en/red_hat_satellite/#{ForemanThemeSatellite::SATELLITE_SHORT_VERSION}\", :rel => \"external\" %></li>
307
+ <li><%= link_to _('API Resources'), apipie_apipie_path, :title => _('Automate Satellite via a simple and powerful API') %></li>
308
+ </ul>
309
+ <h6><%= _(\"Blog\") %></h6>
310
+ <ul>
311
+ <li><%= link_to _('Red Hat Satellite Blog'), \"https://access.redhat.com/blogs/1169563\", :rel => \"external\" %></li>
312
+ </ul>
313
+ <h6><%= _(\"IRC\") %></h6>
314
+ <p><%= (_(\"You can find us on %{freenode} (irc.freenode.net) on #satellite6.\") % {:freenode => link_to(\"freenode\", \"http://www.freenode.net\", :rel => \"external\")}).html_safe %></p>
315
+ </div>")
316
+ ```
317
+
318
+ ## Change helpers behavior
319
+
320
+ When there is need to change HTML components rendered by a helper, they could be
321
+ overridden from theme's helpers:
322
+
323
+ ``` ruby
324
+ module ThemeApplicationHelper
325
+ def association_text()
326
+ content_tag(:p, _('When editing a Template, you must assign a list of Operating Systems with which this Template can be used. Optionally, you can restrict a template to a list of Hostgroups or Environments.')) +
327
+ content_tag(:p, _('When a Host requests a template (e.g. during provisioning), Foreman selects the optimal match from the available templates of that type, in the following order:')) +
328
+ (content_tag :ul do
329
+ content_tag(:li, _('Host group and Environment'))
330
+ content_tag(:li, _('Host group only'))
331
+ content_tag(:li, _('Environment only'))
332
+ content_tag(:li, _('Operating system default'))
333
+ end)
334
+ (_('The final entry, Operating System default, can be set by editing the %s page.') % (link_to _('Operating System'), operatingsystems_path)).html_safe
335
+ end
336
+ end
337
+ ```
338
+
339
+
340
+ ## Lists of features/components e.t.c.
341
+
342
+ When there is a need to have a list of features/components e.t.c. it's
343
+ recommended to add a method or constant in upstream foreman and override it in
344
+ the theme by using concerns or redefining consts.
345
+
346
+ [Upstream](https://github.com/theforeman/foreman/blob/e801f761eb3e709a0adc7a6e6d86f514b2f919dd/app/models/compute_resource.rb#L44):
347
+ ``` ruby
348
+ class ComputeResource < ApplicationRecord
349
+ # ...
350
+ def self.supported_providers
351
+ {
352
+ 'Libvirt' => 'Foreman::Model::Libvirt',
353
+ 'Ovirt' => 'Foreman::Model::Ovirt',
354
+ 'EC2' => 'Foreman::Model::EC2',
355
+ 'Vmware' => 'Foreman::Model::Vmware',
356
+ 'Openstack' => 'Foreman::Model::Openstack',
357
+ }
358
+ end
359
+ # ...
360
+ ```
361
+
362
+ [Theme](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/models/concerns/compute_resource_branding.rb):
363
+ ``` ruby
364
+ module ComputeResourceBranding
365
+ module ClassMethods
366
+ def supported_providers
367
+ super.except('Rackspace')
368
+ end
369
+
370
+ def providers_requiring_url
371
+ _('Libvirt, oVirt and OpenStack')
372
+ end
373
+ end
374
+ end
375
+ ```
376
+
377
+ This approach is also applicable to other plugins too, here is an example from
378
+ Katello.
379
+
380
+ [Upstream](https://github.com/Katello/katello/blob/df7286071ce42b67cf17a30cf6b201435a6354fa/app/models/katello/ping.rb#L5)
381
+ ``` ruby
382
+ module Katello
383
+ class Ping
384
+ PACKAGES = %w(katello candlepin pulp qpid foreman tfm hammer).freeze
385
+ end
386
+ end
387
+ ```
388
+
389
+ [Branding](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/models/concerns/satellite_packages.rb)
390
+ ``` ruby
391
+ module SatellitePackages
392
+ extend ActiveSupport::Concern
393
+ included do
394
+ old_packages = remove_const(:PACKAGES)
395
+ const_set(:PACKAGES, (old_packages + ['satellite']).freeze)
396
+ end
397
+ end
398
+ ```
399
+
400
+ ### Update the list of supported provisioning templates by Red Hat.
401
+ When there is a new template (supported by downstream) added in the upstream repo, please don't forget to update this [constant](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/app/controllers/concerns/provisioning_templates_controller_branding.rb#L4). You simply need to add the name of the new template to the array.
402
+
403
+ ## Theme constants and metadata fields
404
+
405
+ Currently the theme maintains a list of constants and metadata that is relevant
406
+ only to the downstream version. These constants can be used throughout the theme
407
+ and can be overridden from either `ENV` variable or by setting the constant in
408
+ a specialized yaml file.
409
+
410
+ Setting up ENV variables:
411
+ ``` bash
412
+ SATELLITE_VERSION='6.8.000'
413
+ SATELLITE_DOCUMENTATION_SERVER=http://access.redhat.com
414
+ SATELLITE_DOCUMENTATION_VERSION=6.6
415
+ ```
416
+ Setting up the metadata file:
417
+ ``` yaml
418
+ version: '6.8.000'
419
+ documentation_server: "http://access.redhat.com"
420
+ documentation_version: "6.6"
421
+ ```
422
+ the metadata file should be called `/usr/share/satellite/metadata.yml` for
423
+ production style deployments, or used from
424
+ [source](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/config/metadata.yml)
425
+ directory for development and test environments.
426
+
427
+ The mechanism resides in theme's
428
+ [`engine.rb`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/lib/foreman_theme_satellite/engine.rb#L119)
429
+
430
+ ## Testing documentation
431
+
432
+ Since the life cycle of our documentation differs from Satellite's, there is
433
+ need to test the links against different documentation version or instance.
434
+
435
+ These parameters are cofigurable by either setting `ENV` variables:
436
+
437
+ ``` sh
438
+ SATELLITE_DOCUMENTATION_SERVER=http://access.redhat.com
439
+ SATELLITE_DOCUMENTATION_VERSION=6.6
440
+ ```
441
+
442
+ Another option is to add or change keys in `/usr/share/satellite/metadata.yml`:
443
+
444
+ ``` yaml
445
+ documentation_server: "http://access.redhat.com"
446
+ documentation_version: "6.6"
447
+ ```
448
+
449
+ There is also an automatic test that tests all documentation links on each PR,
450
+ for the test to work
451
+ [`metadata.yml`](https://github.com/RedHatSatellite/foreman_theme_satellite/blob/develop/config/metadata.yml)
452
+ should be updated accordingly.
453
+
454
+ ## Tests:
455
+
456
+ Due to all the changes made by the plugin, it is possible that some of the core tests will fail,
457
+ we solve that by skipping tests and replacing them with our own.
458
+
459
+ Skipping:
460
+
461
+ ```ruby
462
+ initializer 'foreman_theme_satellite.register_plugin', :after=> :finisher_hook do |app|
463
+ Foreman::Plugin.register :foreman_theme_satellite do
464
+ requires_foreman '>= 1.10'
465
+ tests_to_skip ({
466
+ "ComputeResourceTest" => ["friendly provider name"]
467
+ })
468
+ end
469
+ end
470
+ ```
471
+
472
+ Replacing:
473
+
474
+ ```ruby
475
+ class ModelsTest < ActiveSupport::TestCase
476
+
477
+ test "check openstack friendly name" do
478
+ assert_equal Foreman::Model::Openstack::provider_friendly_name, "RHEL OpenStack Platform", "Friendly name override was unsuccessful"
479
+ end
480
+
481
+ end
482
+ ```
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'ForemanThemeSatellite'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+ task default: :test
37
+
38
+ begin
39
+ require 'rubocop/rake_task'
40
+ RuboCop::RakeTask.new
41
+ rescue
42
+ puts 'Rubocop not loaded.'
43
+ end
44
+
45
+ task :default do
46
+ Rake::Task['rubocop'].execute
47
+ end