Skip to content

Add rackup gem for visual spec checks#2232

Closed
larouxn wants to merge 1 commit intorouge-ruby:mainfrom
larouxn:add_rackup_for_visual_spec
Closed

Add rackup gem for visual spec checks#2232
larouxn wants to merge 1 commit intorouge-ruby:mainfrom
larouxn:add_rackup_for_visual_spec

Conversation

@larouxn
Copy link
Copy Markdown
Contributor

@larouxn larouxn commented Feb 27, 2026

Description

Adds rackup gem so we can perform visual spec checks. I think this used to be unnecessary when we had webrick built into Ruby but in modern Ruby trying bundle exec rackup simply errors out.

For a long time, rackup (the executable and implementation) was part of rack, and webrick was the default server, included with Ruby. It made it easy to run a Rack application without having to worry about the details of the server - great for documentation and demos.
https://github.com/rack/rackup/blob/f3fa1d6ada90e9e7aa1f712488ddde87ea2a2075/readme.md?plain=1#L47

rouge on  main [$] via 💎 v4.0.1 bundle exec rackup
bundler: failed to load command: rackup (/home/larouxn/.gem/ruby/4.0.1/bin/rackup)
/home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/rubygems_integration.rb:236:in 'block in Gem.replace_bin_path': can't find executable rackup for gem rack (Gem::Exception)
        from /home/larouxn/.rubies/ruby-4.0.1/lib/ruby/site_ruby/4.0.0/rubygems.rb:238:in 'Gem.find_and_activate_spec_for_exe'
        from /home/larouxn/.rubies/ruby-4.0.1/lib/ruby/site_ruby/4.0.0/rubygems.rb:283:in 'Gem.activate_and_load_bin_path'
        from /home/larouxn/.gem/ruby/4.0.1/bin/rackup:25:in '<top (required)>'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli/exec.rb:61:in 'Kernel.load'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli/exec.rb:61:in 'Bundler::CLI::Exec#kernel_load'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli/exec.rb:24:in 'Bundler::CLI::Exec#run'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli.rb:500:in 'Bundler::CLI#exec'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/cli.rb:29:in 'Bundler::CLI.start'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/exe/bundle:28:in 'block in <top (required)>'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/lib/bundler/friendly_errors.rb:118:in 'Bundler.with_friendly_errors'
        from /home/larouxn/.gem/ruby/4.0.1/gems/bundler-4.0.6/exe/bundle:20:in '<top (required)>'
        from /home/larouxn/.rubies/ruby-4.0.1/lib/ruby/site_ruby/4.0.0/rubygems.rb:304:in 'Kernel#load'
        from /home/larouxn/.rubies/ruby-4.0.1/lib/ruby/site_ruby/4.0.0/rubygems.rb:304:in 'Gem.activate_and_load_bin_path'
        from /home/larouxn/.gem/ruby/4.0.1/bin/bundle:25:in '<main>'

How?

Simply adds rackup to development gems.

Testing

image

@jneen
Copy link
Copy Markdown
Member

jneen commented Feb 27, 2026

Are there still docs that recommend rackup? We do have puma in the Gemfile, I've been meaning to replace those.

@larouxn
Copy link
Copy Markdown
Contributor Author

larouxn commented Feb 27, 2026

Hmm, maybe I'm just running the wrong thing but I can't seem to get to the visual spec without using rackup. Tried running ruby spec/visual/app.rb as well but that fails at the Sinatra level.

Screenshot From 2026-02-27 09-46-05

As for the rackup messaging, the following message appears when running tests.

rouge on  main via 💎 v4.0.1 bundle exec rake

============
Run `rackup` and visit localhost:9292/:lexer_name to visually test a lexer.
============

Run options: --seed 26675

# Running:

............................................................

# -*- coding: utf-8 -*- #
# frozen_string_literal: true
puts <<-MSG
============
Run `rackup` and visit localhost:9292/:lexer_name to visually test a lexer.
============
MSG

rackup appears in the README as well.

rouge/README.md

Lines 315 to 317 in 6a4ae1d

To test a lexer visually, run `rackup` from the top-level working directory and
you should have a web server running and ready to go. Visit
<http://localhost:9292> to see the full list of Rouge's lexers.

@jneen
Copy link
Copy Markdown
Member

jneen commented Feb 27, 2026

I'll update those. bundle exec puma should do the trick.

@larouxn larouxn closed this Feb 27, 2026
@larouxn larouxn deleted the add_rackup_for_visual_spec branch February 27, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants