Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ruby 3.0 and up #136

Merged
merged 4 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2", "3.3"]

steps:
- uses: actions/checkout@v4
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
ruby-version: 3.3
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop -P
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AllCops:
- 'spec/dummy/bin/*'
- 'spec/dummy/db/schema.rb'
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Rails:
Enabled: true
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def themeable_javascript_include_tag(name)
javascript_include_tag "/javascripts/theme/#{name}.js" if File.exist? src
end

def render_to_string(*args, &block)
controller.send(:render_to_string, *args, &block)
def render_to_string(...)
controller.send(:render_to_string, ...)
end

def link_to_permalink(item, title,
Expand Down
4 changes: 2 additions & 2 deletions lib/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module Format
# Laxly matches an IP Address , would also pass numbers > 255 though
IP_ADDRESS = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.freeze
IP_ADDRESS = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/

# Laxly matches an HTTP(S) URI
HTTP_URI = %r{^https?://\S+$}.freeze
HTTP_URI = %r{^https?://\S+$}
end
13 changes: 6 additions & 7 deletions lib/publify_core/string_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ def to_title(item, settings, params)
end

# Strips any html markup from a string
TYPO_TAG_KEY = TYPO_ATTRIBUTE_KEY = /[\w:_-]+/.freeze
TYPO_ATTRIBUTE_VALUE = /(?:[A-Za-z0-9]+|(?:'[^']*?'|"[^"]*?"))/.freeze
TYPO_ATTRIBUTE = /(?:#{TYPO_ATTRIBUTE_KEY}(?:\s*=\s*#{TYPO_ATTRIBUTE_VALUE})?)/.freeze
TYPO_ATTRIBUTES = /(?:#{TYPO_ATTRIBUTE}(?:\s+#{TYPO_ATTRIBUTE})*)/.freeze
TAG =
%r{<[!/?\[]?(?:#{TYPO_TAG_KEY}|--)(?:\s+#{TYPO_ATTRIBUTES})?\s*(?:[!/?\]]+|--)?>}
.freeze
TYPO_TAG_KEY = TYPO_ATTRIBUTE_KEY = /[\w:_-]+/
TYPO_ATTRIBUTE_VALUE = /(?:[A-Za-z0-9]+|(?:'[^']*?'|"[^"]*?"))/
TYPO_ATTRIBUTE = /(?:#{TYPO_ATTRIBUTE_KEY}(?:\s*=\s*#{TYPO_ATTRIBUTE_VALUE})?)/
TYPO_ATTRIBUTES = /(?:#{TYPO_ATTRIBUTE}(?:\s+#{TYPO_ATTRIBUTE})*)/
TAG = %r{<[!/?\[]?(?:#{TYPO_TAG_KEY}|--)(?:\s+#{TYPO_ATTRIBUTES})?\s*(?:[!/?\]]+|--)?>}

def strip_html
gsub(TAG, "").gsub(/\s+/, " ").strip
end
Expand Down
2 changes: 1 addition & 1 deletion publify_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|

s.files = File.open("Manifest.txt").readlines.map(&:chomp)

s.required_ruby_version = ">= 2.7.0"
s.required_ruby_version = ">= 3.0.0"

s.add_dependency "aasm", "~> 5.0"
s.add_dependency "akismet", "~> 3.0"
Expand Down