Skip to content

Commit 309230f

Browse files
authored
Syntax Highlight using Prism (#1091)
* Colorize using Prism * Add prism version ci matrix
1 parent f5124c5 commit 309230f

7 files changed

Lines changed: 238 additions & 208 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ jobs:
5050
run: bundle exec rake test
5151
- name: Run tests in isolation
5252
run: bundle exec rake test_in_isolation
53+
prism-version-test:
54+
needs: ruby-versions
55+
name: rake test prism-${{ matrix.prism_version }}
56+
strategy:
57+
matrix:
58+
prism_version: ['1.3.0', '1.7.0', 'latest']
59+
fail-fast: false
60+
runs-on: ubuntu-latest
61+
env:
62+
PRISM_VERSION: ${{matrix.prism_version}}
63+
timeout-minutes: 30
64+
steps:
65+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
66+
- name: Set up Ruby
67+
uses: ruby/setup-ruby@v1
68+
with:
69+
ruby-version: ${{ fromJson(needs.ruby-versions.outputs.latest) }}
70+
bundler-cache: true
71+
- name: Run tests
72+
run: bundle exec rake test
5373
debug-test:
5474
if: github.repository == 'ruby/irb' || github.event_name != 'schedule'
5575
name: Debug compatibility test

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ gem "debug", github: "ruby/debug"
2424

2525
gem "rdoc", ">= 6.11.0"
2626

27+
if ENV['PRISM_VERSION'] == 'latest'
28+
gem "prism", github: "ruby/prism"
29+
elsif ENV['PRISM_VERSION']
30+
gem "prism", ENV['PRISM_VERSION']
31+
end
32+
2733
if RUBY_VERSION >= "3.0.0" && !is_truffleruby
2834
# TODO: Remove this after rbs is released with tsort in its dependencies
2935
gem "rbs", github: "ruby/rbs" if RUBY_VERSION >= "3.2"

irb.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
3535

3636
spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
3737

38+
spec.add_dependency "prism", ">= 1.3.0"
3839
spec.add_dependency "reline", ">= 0.4.2"
3940
spec.add_dependency "rdoc", ">= 4.0.0"
4041
spec.add_dependency "pp", ">= 0.6.0"

0 commit comments

Comments
 (0)