From c1897848a72e9ac8d2add6d98007515cfc769991 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Sun, 25 Oct 2026 15:37:25 -0400 Subject: [PATCH] Upgrade rack-server-pages and version website assets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .rubocop_todo.yml | 8 +-- CHANGELOG.md | 1 + Gemfile | 3 +- Gemfile.lock | 7 ++- README.md | 6 ++ config/initializers/slack_ruby_bot_server.rb | 3 + public/index.html.erb | 16 +++--- public/partials/_head.html.erb | 10 ++-- public/{styles.css => styles.css.erb} | 2 +- spec/integration/index_spec.rb | 7 +++ .../api/middleware_spec.rb | 56 ++++++++++++++++++- spec/spec_helper.rb | 4 +- 12 files changed, 97 insertions(+), 26 deletions(-) rename public/{styles.css => styles.css.erb} (97%) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8da2f71..7389ddc 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2026-10-25 15:08:27 UTC using RuboCop version 1.92.1. +# on 2026-10-25 21:03:15 UTC using RuboCop version 1.92.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -72,7 +72,7 @@ RSpec/ContextWording: - 'spec/models/team_spec.rb' - 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb' -# Offense count: 13 +# Offense count: 15 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 11 @@ -94,7 +94,7 @@ RSpec/LetSetup: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 29 +# Offense count: 35 RSpec/MultipleExpectations: Max: 6 @@ -128,7 +128,7 @@ RSpec/SpecFilePathFormat: - 'spec/commands/whoami_spec.rb' - 'spec/version_spec.rb' -# Offense count: 11 +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https diff --git a/CHANGELOG.md b/CHANGELOG.md index 192f87c..c4cff5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### Changelog +* 2026/10/25: [#88](https://github.com/slack-ruby/slack-shellbot/pull/88): Upgrade slack-ruby-bot-server to 2.3.0 and rack-server-pages to 0.3.0, version website assets by content, and configure template revalidation centrally to prevent stale browser assets after deployments - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent). * 2026/10/25: [#87](https://github.com/slack-ruby/slack-shellbot/pull/87): Redesign the Shell website with shared responsive layouts, charcoal ribbon artwork, a black-bordered animated demo, an "Is this a joke?" FAQ linked from the homepage, and recommendations with original logos for Slava, Strada, Gamebot, and S'Up above Open source while preserving Slack installation and status flows - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent). * 2026/10/24: [#86](https://github.com/slack-ruby/slack-shellbot/pull/86): Upgrade slack-ruby-bot-server to 2.2.1 to fix Grape error handling for unsupported requests and failing health checks - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent). * 2026/10/23: Upgrade to Ruby 4.0.9 and refresh dependencies and CI browser tooling - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent). diff --git a/Gemfile b/Gemfile index 1baaf8e..7a41cf8 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,8 @@ gem 'mongoid-scroll' gem 'newrelic_rpm' gem 'puma' gem 'rack-robotz' -gem 'rack-server-pages' +gem 'rack-server-pages', '~> 0.3.0' +gem 'slack-ruby-bot-server', '~> 2.3.0' gem 'slack-ruby-bot-server-events' gem 'slack-ruby-bot-server-mailchimp' diff --git a/Gemfile.lock b/Gemfile.lock index c2b5509..f549509 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM rack-rewrite (1.5.1) rack-robotz (0.0.4) rack - rack-server-pages (0.2.1) + rack-server-pages (0.3.0) rack rack-test (2.3.0) rack (>= 1.3) @@ -282,7 +282,7 @@ GEM logger (~> 1.4) rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) - slack-ruby-bot-server (2.2.1) + slack-ruby-bot-server (2.3.0) async foreman grape @@ -345,7 +345,7 @@ DEPENDENCIES newrelic_rpm puma rack-robotz - rack-server-pages + rack-server-pages (~> 0.3.0) rack-test rackup rake @@ -355,6 +355,7 @@ DEPENDENCIES rubocop-rake rubocop-rspec selenium-webdriver + slack-ruby-bot-server (~> 2.3.0) slack-ruby-bot-server-events slack-ruby-bot-server-mailchimp vcr diff --git a/README.md b/README.md index 007274a..154b2ae 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ The website follows the shared Slava, Strata, and Strada layout with a terminal- The bot recommendations use local copies of the original logos: `bot-slava.png` and `bot-strada.png` from their respective projects' `public/img/icon.png`, `bot-gamebot.png` from slack-gamebot2's `public/img/game.png`, and `bot-sup.png` from slack-sup2's `public/img/icon.png`. Preserve their original colors rather than applying the Shell website's monochrome styling. +## Website assets and caching + +The website uses `rack-server-pages` 0.3.0's `asset_path` helper for content-versioned CSS, JavaScript, images, and favicon URLs. Use the helper for new local asset references rather than fixed URLs or manual version strings. `public/styles.css.erb` is served at `/styles.css` and versions the background image reference too. + +The `config.server_pages` block in `config/initializers/slack_ruby_bot_server.rb`, supported by `slack-ruby-bot-server` 2.3.0, sets `Cache-Control: private, no-cache` for templates, including HTML and the generated stylesheet, requiring revalidation before reuse. This lets the stylesheet pick up a changed background image even when its own source is unchanged. Static files use the library's default content-based `ETag` and timestamp validation. Versioned URLs serve current files rather than archived versions; do not add `immutable` or long freshness lifetimes. Existing cached pages need to fetch fresh HTML before they can use the new URLs. + ## Copyright and License Copyright (c) 2016-2025, Daniel Doubrovkine, Artsy and [Contributors](CHANGELOG.md). diff --git a/config/initializers/slack_ruby_bot_server.rb b/config/initializers/slack_ruby_bot_server.rb index 9472353..cf59135 100644 --- a/config/initializers/slack_ruby_bot_server.rb +++ b/config/initializers/slack_ruby_bot_server.rb @@ -1,4 +1,7 @@ SlackRubyBotServer.configure do |config| config.oauth_version = :v2 config.oauth_scope = ['chat:write', 'im:history', 'mpim:history', 'channels:history', 'groups:history'] + config.server_pages do |pages| + pages.cache_control = 'private, no-cache' + end end diff --git a/public/index.html.erb b/public/index.html.erb index 31d3f68..caabb89 100644 --- a/public/index.html.erb +++ b/public/index.html.erb @@ -3,8 +3,8 @@ Shell: A Unix Shell in Every Slack Channel <%= partial 'public/partials/_head.html.erb' %> - - + + @@ -13,7 +13,7 @@
- +

Shell for Slack

Whoa, a bash shell inside Slack!

@@ -28,7 +28,7 @@
- Shell running Unix commands inside a Slack channel + Shell running Unix commands inside a Slack channel
A little command line, right where your team works.
@@ -47,25 +47,25 @@

A little more play, a little more connection.