Hiding the Git adapter banner on unregistered projects (optional)

By default, the Git adapter banner is shown on all pages of a registered Gitweb or Gerrit server. You might have some Git projects that are not associated with Rational Team Concert™ project areas, and you do not want the Git adapter banner to show on those pages.

Before you begin

The Gitweb or Gerrit server is registered with the adapter.

The Git adapter banner script sync_rules.pl, which you can use to show the Git adapter banner for all registered projects, requires the Perl 5.10.1 software and these Perl modules:
  • LWP 6.04
  • LWP::Protocol::https 6.03
  • JSON 2.15
  • Term::ReadKey 2.30
Important: Some Linux distributions do not include some Perl core modules in their default Perl installation. You must install the full Perl core. The Git adapter banner script depends on the JSON and Term::ReadKey packages. Although these packages are not included by default in the RHEL 6 distribution, you can add them using these commands:
yum install perl-JSON
yum install perl-TermReadKey

About this task

By default, the Git adapter banner is shown on all pages of a registered Gitweb or Gerrit server. You can edit the banner_display_rules.js file in your Gitweb or Gerrit installation to customize the pages on which the Git adapter banner shows.

The variable bannerDisplayRulesDefault in the banner_display_rules.js file determines the default behavior for the banner. A value of "D" (the default value) means that the banner shows on all pages, except for Git projects where you explicitly hide the banner. A value of "H" means that the banner is hidden on all pages, except for Git projects where you explicitly show the banner.

The variable bannerDisplayRules in the banner_display_rules.js file is where you override the default behavior, indicating individual Git projects for which you want to show or hide the banner.

For more information about how to set these variables and the example syntax, including how to use wildcards in your specified Git project names to show or hide the banner on all matching Git projects, see the banner_display_rules.js file.

To make it easy to show the Git adapter banner on all registered Git projects, a script sync_rules.pl is provided to gather the names of all registered Git projects and add them to the generatedBannerDisplayRules variable in the banner_display_rules.js file.

Tips:
  • The rules in the bannerDisplayRules variable override the generated rules in the generatedBannerDisplayRules variable.
  • Include the .git extension when you add Gitweb projects to the banner_display_rules.js file to ensure that the rule matches the Gitweb project.
  • In adapter software 1.1 or earlier, the ./rlia folder that is referenced in the following steps was named ./static in the Gitweb server directory.

In this procedure, you follow the steps to show the Git adapter banner on registered Git projects only.

Procedure

  1. Find the banner_display_rules.js file on the Gitweb or Gerrit server.

    On the Gitweb server, find gitweb_server_root/rlia/banner_display_rules.js

    On the Gerrit server, find gerrit_server_root/static/banner_display_rules.js

  2. Set the default rule in the banner show rules file to hide the Git adapter banner on all pages. To hide the banner for all pages, set the bannerDisplayRulesDefault variable to H.
    var bannerDisplayRulesDefault = "H";
  3. Save the banner_display_rules.js file.
  4. Run the sync_rules.pl script.
    ./folder/sync_rules.pl  
    The folder variable is either static or rlia.
    When the script runs it:
    • Prompts you for your Jazz™ Team Server URL, user ID, and password.
    • Lists each project that was added to the banner_display_rules.js file. Each project is added to the generatedBannerDisplayRules varible.
    • Shows a successful completion message.
    • Creates a backup file in the banner_display_rules_backup folder.
  5. If you are using the Gerrit server, restart it.
  6. Check that the Git adapter banner shows only on registered Git project pages.
    Tips:
    • If you show only the Git adapter banner on registered Git projects, you cannot register new Git projects with the adapter directly from those Git project pages. You must enter the new Git project names into the Git adapter administration page for registering new Git projects. If you follow a naming convention when you create Git projects that you intend to register with the Git adapter, you can use a wildcard entry in the bannerDisplayRules variable to automatically show the Git adapter banner on any new projects that match the wildcard entry. You can then register the new Git project with the Git adapter directly from the Git project, which prevents you from having to rerun the sync_rules.pl script every time you register a new Git project.
    • If you are using Internet Explorer, you might need to clear your cache and refresh to see the changes that were made to the banner rules.

Results

The Git adapter banner shows only on registered Git project pages.

What to do next

Use the adapter, see Using the Git adapter.

Feedback