Skip to content

Commit

Permalink
Bring Ruby dependencies up to date (#715)
Browse files Browse the repository at this point in the history
* Bump Sinatra and associates to v4.0
* Bump minimum required Ruby version to Ruby 2.7
* Misc. updates to the Ruby side of dev environment
  • Loading branch information
ashmaroli authored Oct 28, 2024
1 parent 36fe05b commit b7fe789
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby_version: ["2.7"]
ruby_version: ["2.7", "3.3"]
jekyll_version:
- "~> 3.9"
- "~> 4.0"
Expand Down
31 changes: 22 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@

source "https://rubygems.org"

# Specify the gem's dependencies in jekyll-admin.gemspec
# Specify the gem's runtime dependencies in jekyll-admin.gemspec
gemspec

# To allow testing with specific Jekyll versions
gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"
group :development do
gem "gem-release", "~> 0.7"

# Fixture site dependencies
gem "jekyll-redirect-from"
# Fixture site dependencies
gem "jekyll-redirect-from"
gem "sinatra-cross_origin", "~> 0.3"
end

# Site dependencies
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
group :docs do
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
end

group :test do
# To allow testing with specific Jekyll versions
gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"

gem "rack-test", "~> 2.0"
gem "rake", ">= 10.0"
gem "rspec", "~> 3.4"
gem "rubocop-jekyll", "~> 0.14.0"
end
28 changes: 7 additions & 21 deletions jekyll-admin.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "jekyll-admin/version"
require_relative "lib/jekyll-admin/version"

Gem::Specification.new do |spec|
spec.name = "jekyll-admin"
Expand All @@ -17,28 +15,16 @@ Gem::Specification.new do |spec|

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "https://rubygems.org"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end
spec.metadata["allowed_push_host"] = "https://rubygems.org"

spec.files = Dir.glob("lib/**/*").concat(%w(LICENSE README.md))
spec.bindir = "exe"
spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.3.0"
spec.required_ruby_version = ">= 2.7.0"
spec.required_rubygems_version = ">= 2.7.0"

spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
spec.add_dependency "sinatra", ">= 1.4"
spec.add_dependency "sinatra-contrib", ">= 1.4"

spec.add_development_dependency "bundler", ">= 1.7"
spec.add_development_dependency "gem-release", "~> 0.7"
spec.add_development_dependency "rack-test", "~> 1.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.4"
spec.add_development_dependency "rubocop-jekyll", "~> 0.10.0"
spec.add_development_dependency "sinatra-cross_origin", "~> 0.3"
spec.add_dependency "rackup", "~> 2.0"
spec.add_dependency "sinatra", "~> 4.0"
spec.add_dependency "sinatra-contrib", "~> 4.0"
end
6 changes: 4 additions & 2 deletions lib/jekyll/commands/serve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def start_up_webrick(opts, destination)
end

def jekyll_admin_monkey_patch
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
@server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
Jekyll::External.require_with_graceful_fail "rackup"

@server.mount "/admin", Rackup::Handler::WEBrick, JekyllAdmin::StaticServer
@server.mount "/_api", Rackup::Handler::WEBrick, JekyllAdmin::Server
Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/jekyll-admin/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
context "Jekyll site" do
let(:path) { "/" }

it "serves the Jekyll site", :skip => Gem.win_platform? do
it "serves the Jekyll site", :skip => skip_integration_condition do
expect(response.code).to eql("200")
expect(response.body).to match("You're probably looking for")
end
Expand All @@ -32,7 +32,7 @@
context "Admin site" do
let(:path) { "/admin" }

it "serves the Jekyll site", :skip => Gem.win_platform? do
it "serves the Jekyll site", :skip => skip_integration_condition do
with_index_stubbed do
expect(response.code).to eql("200")
expect(response.body).to match("Jekyll Admin")
Expand All @@ -43,14 +43,14 @@
context "API" do
let(:path) { "/_api" }

it "serves the Jekyll site", :skip => Gem.win_platform? do
it "serves the Jekyll site", :skip => skip_integration_condition do
expect(response.code).to eql("200")
expect(response.body).to match("collections_api")
end
end

context "watching" do
it "Jekyll isn't watching", :skip => Gem.win_platform? do
it "Jekyll isn't watching", :skip => skip_integration_condition do
File.open(File.join(source, "page.md"), "a") do |f|
f.puts "peek-a-boo"
end
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def write_file(path, content = "---\n---\n\n# test")
path
end

def skip_integration_condition
Gem.win_platform? || ENV["CI"]
end

RSpec::Matchers.define :be_an_existing_file do
match do |path|
path = in_source_dir(path)
Expand Down

0 comments on commit b7fe789

Please sign in to comment.