From ee2db5d891e866885d4f98bc05512bc50d450eb0 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 9 Jan 2015 10:17:16 +0100 Subject: [PATCH] Allow to set different title for different instances of the app --- lib/travis/web/app.rb | 7 +++++++ public/index.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/travis/web/app.rb b/lib/travis/web/app.rb index f440670f..39b5317a 100644 --- a/lib/travis/web/app.rb +++ b/lib/travis/web/app.rb @@ -83,6 +83,8 @@ class Travis::Web::App def response_for(file, options = {}) content = File.read(file) set_config(content, options) if config_needed?(file) + set_title(content) if index?(file) + headers = { 'Content-Length' => content.bytesize.to_s, 'Cache-Control' => cache_control(file), @@ -134,6 +136,11 @@ class Travis::Web::App Rack::Mime.mime_type File.extname(file) end + def set_title(content) + default_title = "Travis CI - Free Hosted Continuous Integration Platform for the Open Source Community" + content.gsub!(/\{\{title\}\}/, ENV['SITE_TITLE'] || default_title) + end + def set_config(string, opts = {}) string.gsub! %r(]*>) do %() diff --git a/public/index.html b/public/index.html index 6316c6f7..673b0ae0 100644 --- a/public/index.html +++ b/public/index.html @@ -17,7 +17,7 @@ - Travis CI - Free Hosted Continuous Integration Platform for the Open Source Community + {{title}}