From 1342dbc3686c1289a7c02abedf9de32508204295 Mon Sep 17 00:00:00 2001 From: David Tippett Date: Mon, 3 Jun 2024 13:50:58 -0400 Subject: [PATCH 1/5] Fixes posix spawn issue by replacing with open3 --- lib/jekyll-last-modified-at/executor.rb | 28 ++++--------------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/lib/jekyll-last-modified-at/executor.rb b/lib/jekyll-last-modified-at/executor.rb index 6136e11..ccbadbf 100644 --- a/lib/jekyll-last-modified-at/executor.rb +++ b/lib/jekyll-last-modified-at/executor.rb @@ -1,36 +1,16 @@ # frozen_string_literal: true -require 'posix/spawn' +require 'open3' module Jekyll module LastModifiedAt module Executor - extend POSIX::Spawn def self.sh(*args) - r, w = IO.pipe - e, eo = IO.pipe - pid = spawn(*args, - :out => w, r => :close, - :err => eo, e => :close) - - if pid.positive? - w.close - eo.close - out = r.read - err = e.read - ::Process.waitpid(pid) - "#{out} #{err}".strip if out - end - ensure - [r, w, e, eo].each do |io| - begin - io.close - rescue StandardError - nil - end - end + stdout_str, stderr_str, status = Open3.capture3(*args) + return "#{stdout_str} #{stderr_str}".strip if status.success? end + end end end From 65db67b6b71b00aa7b39081c7d5ad6db0d655bba Mon Sep 17 00:00:00 2001 From: David Tippett Date: Mon, 3 Jun 2024 14:02:43 -0400 Subject: [PATCH 2/5] GH actions CI --- .github/test.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/test.yml diff --git a/.github/test.yml b/.github/test.yml new file mode 100644 index 0000000..028a2d2 --- /dev/null +++ b/.github/test.yml @@ -0,0 +1,26 @@ +--- +name: test +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + entry: + - { ruby: '2.7', allowed-failure: false } + - { ruby: '3.0', allowed-failure: false } + - { ruby: '3.1', allowed-failure: false } + - { ruby: '3.2', allowed-failure: false } + - { ruby: 'ruby-head', allowed-failure: true } + - { ruby: 'truffleruby-head', allowed-failure: true } + - { ruby: 'jruby-head', allowed-failure: true } + name: test (${{ matrix.entry.ruby }}) + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.entry.ruby }} + - run: bundle install --jobs=3 --retry=3 --path=vendor/bundle + - run: bundle exec rake spec + continue-on-error: ${{ matrix.entry.allowed-failure }} From 4b7db182e388c6e0fca3fe736fa2ce312995ed7b Mon Sep 17 00:00:00 2001 From: David Tippett Date: Mon, 3 Jun 2024 14:03:05 -0400 Subject: [PATCH 3/5] Removing depencendy on posix-spawn --- jekyll-last-modified-at.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/jekyll-last-modified-at.gemspec b/jekyll-last-modified-at.gemspec index 38146a4..aa889e0 100644 --- a/jekyll-last-modified-at.gemspec +++ b/jekyll-last-modified-at.gemspec @@ -11,7 +11,6 @@ Gem::Specification.new do |s| s.files = Dir['lib/**/*.rb'] s.add_dependency 'jekyll', '>= 3.7', ' < 5.0' - s.add_dependency 'posix-spawn', '~> 0.3.9' s.add_development_dependency 'rake' s.add_development_dependency 'rspec', '~> 3.4' From 6ed0fd6132b584c270b707399a84f4bfe5a74513 Mon Sep 17 00:00:00 2001 From: David Tippett Date: Tue, 4 Jun 2024 11:43:53 -0400 Subject: [PATCH 4/5] added badge and allowed failures on ruby versions. --- .github/test.yml | 8 ++++---- README.md | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/test.yml b/.github/test.yml index 028a2d2..4111848 100644 --- a/.github/test.yml +++ b/.github/test.yml @@ -8,10 +8,10 @@ jobs: fail-fast: false matrix: entry: - - { ruby: '2.7', allowed-failure: false } - - { ruby: '3.0', allowed-failure: false } - - { ruby: '3.1', allowed-failure: false } - - { ruby: '3.2', allowed-failure: false } + - { ruby: '2.7', allowed-failure: true } + - { ruby: '3.0', allowed-failure: true } + - { ruby: '3.1', allowed-failure: true } + - { ruby: '3.2', allowed-failure: true } - { ruby: 'ruby-head', allowed-failure: true } - { ruby: 'truffleruby-head', allowed-failure: true } - { ruby: 'jruby-head', allowed-failure: true } diff --git a/README.md b/README.md index bbaa445..cbb74f9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Last Modified At Plugin +![Rake Status](https://github.com/gjtorikian/jekyll-last-modified-at/actions/workflows/test.yml/badge.svg) + + A liquid tag for Jekyll to indicate the last time a file was modified. This plugin determines a page's last modified date by checking the last Git commit date of source files. In the event Git is not available, the file's `mtime` is used. From 06cdd80a325f2b89382e1e62ca4b5e89d4905506 Mon Sep 17 00:00:00 2001 From: David Tippett Date: Tue, 4 Jun 2024 11:45:31 -0400 Subject: [PATCH 5/5] updated ruby version --- .github/test.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/test.yml b/.github/test.yml index 4111848..fd315f9 100644 --- a/.github/test.yml +++ b/.github/test.yml @@ -8,13 +8,10 @@ jobs: fail-fast: false matrix: entry: - - { ruby: '2.7', allowed-failure: true } - - { ruby: '3.0', allowed-failure: true } - - { ruby: '3.1', allowed-failure: true } - - { ruby: '3.2', allowed-failure: true } - - { ruby: 'ruby-head', allowed-failure: true } - - { ruby: 'truffleruby-head', allowed-failure: true } - - { ruby: 'jruby-head', allowed-failure: true } + - { ruby: '2.7' } + - { ruby: '3.0' } + - { ruby: '3.1' } + - { ruby: '3.2' } name: test (${{ matrix.entry.ruby }}) steps: - uses: actions/checkout@v3