Skip to content

Commit

Permalink
Add support for Phlex 2, drop support for Phlex 1
Browse files Browse the repository at this point in the history
  • Loading branch information
benpickles committed Feb 23, 2025
1 parent 121a264 commit 69c14cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ jobs:
strategy:
matrix:
ruby:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
Expand All @@ -31,5 +28,5 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.2'
ruby-version: '3.4'
- run: bundle exec rubocop
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 2.7
TargetRubyVersion: 3.2

Layout:
Enabled: false
Expand Down
8 changes: 4 additions & 4 deletions lib/phlex-sinatra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def initialize(obj)

module SGMLOverrides
def helpers
@_view_context
context
end

def url(...)
helpers.url(...)
context.url(...)
end
end

Expand All @@ -51,10 +51,10 @@ def phlex(

if stream
self.stream do |out|
obj.call(out, view_context: self)
obj.call(out, context: self)
end
else
output = obj.call(view_context: self)
output = obj.call(context: self)

if layout
render(layout_engine, layout, { layout: false }) { output }
Expand Down
4 changes: 2 additions & 2 deletions phlex-sinatra.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.description = 'A Phlex adapter for Sinatra'
spec.homepage = 'https://github.com/benpickles/phlex-sinatra'
spec.license = 'MIT'
spec.required_ruby_version = '>= 2.7' # Match Phlex.
spec.required_ruby_version = '>= 3.2' # Match Phlex.

spec.metadata['changelog_uri'] = 'https://github.com/benpickles/phlex-sinatra/blob/main/CHANGELOG.md'
spec.metadata['homepage_uri'] = spec.homepage
Expand All @@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'phlex', '>= 1.7.0'
spec.add_dependency 'phlex', '>= 2'
spec.add_dependency 'sinatra'
end

0 comments on commit 69c14cc

Please sign in to comment.