Skip to content

Commit

Permalink
Update actions configuration
Browse files Browse the repository at this point in the history
Also apply `standardrb --fix`
  • Loading branch information
halostatue committed Jan 31, 2024
1 parent a53c578 commit 672a063
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 57 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: CI

on:
push:
branches: [main]
pull_request:
push:
branches: [main]
workflow_dispatch:

jobs:
test:
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
- macos-11
- macos-latest
- ubuntu-20.04
ruby:
- '2.4'
Expand All @@ -34,9 +28,6 @@ jobs:
- jruby
- jruby-head
- truffleruby
- truffleruby-head
- truffleruby+graalvm
- truffleruby+graalvm-head
include:
- ruby: head
continue-on-error: true
Expand All @@ -51,16 +42,27 @@ jobs:
continue-on-error: true
- os: ubuntu-22.04
ruby: head
continue-on-error: true
- os: ubuntu-22.04
ruby: '3.1'
- os: ubuntu-22.04
ruby: '3.2'
- os: ubuntu-22.04
ruby: '3.3'
standardrb: true

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
rubygems: latest
bundler-cache: true
- name: Run tests
run: bundle exec ruby -S rake test --trace

- run: bundle exec ruby -S rake test --trace

- if: matrix.standardrb == true
run: bundle exec standardrb
11 changes: 5 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# frozen_string_literal: true

# NOTE: This file is present to keep Travis CI happy. Edits to it will not
# be accepted.

source "https://rubygems.org/"

if RUBY_VERSION < "1.9"
Expand All @@ -14,15 +11,17 @@ if RUBY_VERSION < "1.9"
end

if RUBY_VERSION >= "2.0"
gem "standardrb"
gem "fasterer"

if RUBY_ENGINE == "ruby"
gem "simplecov", "~> 0.18"
gem "byebug"
end
end

if RUBY_VERSION >= "3.0"
gem "standardrb"
gem "fasterer"
end

gemspec

# vim: ft=ruby
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ _spec = Hoe.spec "diff-lcs" do

self.history_file = "History.md"
self.readme_file = "README.rdoc"
self.licenses = ["MIT", "Artistic-2.0", "GPL-2.0+"]
self.licenses = ["MIT", "Artistic-2.0", "GPL-2.0-or-later"]

spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }

extra_dev_deps << ["hoe", ">= 4.0", "< 5"]
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
extra_dev_deps << ["hoe-git", "~> 1.6"]
extra_dev_deps << ["hoe-git2", "~> 1.7"]
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
extra_dev_deps << ["rspec", ">= 2.0", "< 4"]
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
Expand Down
41 changes: 14 additions & 27 deletions diff-lcs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,33 @@

Gem::Specification.new do |s|
s.name = "diff-lcs".freeze
s.version = "1.5.0"
s.version = "1.5.0".freeze

s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/halostatue/diff-lcs/issues", "homepage_uri" => "https://github.com/halostatue/diff-lcs", "source_code_uri" => "https://github.com/halostatue/diff-lcs" } if s.respond_to? :metadata=
s.metadata = { "bug_tracker_uri" => "https://github.com/halostatue/diff-lcs/issues", "homepage_uri" => "https://github.com/halostatue/diff-lcs", "rubygems_mfa_required" => "true", "source_code_uri" => "https://github.com/halostatue/diff-lcs" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
s.date = "2021-12-23"
s.date = "2024-01-31"
s.description = "Diff::LCS computes the difference between two Enumerable sequences using the\nMcIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities\nto create a simple HTML diff output format and a standard diff-like tool.\n\nThis is release 1.4.3, providing a simple extension that allows for\nDiff::LCS::Change objects to be treated implicitly as arrays and fixes a\nnumber of formatting issues.\n\nRuby versions below 2.5 are soft-deprecated, which means that older versions\nare no longer part of the CI test suite. If any changes have been introduced\nthat break those versions, bug reports and patches will be accepted, but it\nwill be up to the reporter to verify any fixes prior to release. The next\nmajor release will completely break compatibility.".freeze
s.email = ["[email protected]".freeze]
s.executables = ["htmldiff".freeze, "ldiff".freeze]
s.extra_rdoc_files = ["Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "License.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "docs/COPYING.txt".freeze, "docs/artistic.txt".freeze]
s.files = [".rspec".freeze, "Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "License.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "Rakefile".freeze, "bin/htmldiff".freeze, "bin/ldiff".freeze, "docs/COPYING.txt".freeze, "docs/artistic.txt".freeze, "lib/diff-lcs.rb".freeze, "lib/diff/lcs.rb".freeze, "lib/diff/lcs/array.rb".freeze, "lib/diff/lcs/backports.rb".freeze, "lib/diff/lcs/block.rb".freeze, "lib/diff/lcs/callbacks.rb".freeze, "lib/diff/lcs/change.rb".freeze, "lib/diff/lcs/htmldiff.rb".freeze, "lib/diff/lcs/hunk.rb".freeze, "lib/diff/lcs/internals.rb".freeze, "lib/diff/lcs/ldiff.rb".freeze, "lib/diff/lcs/string.rb".freeze, "spec/change_spec.rb".freeze, "spec/diff_spec.rb".freeze, "spec/fixtures/aX".freeze, "spec/fixtures/bXaX".freeze, "spec/fixtures/ds1.csv".freeze, "spec/fixtures/ds2.csv".freeze, "spec/fixtures/ldiff/output.diff".freeze, "spec/fixtures/ldiff/output.diff-c".freeze, "spec/fixtures/ldiff/output.diff-e".freeze, "spec/fixtures/ldiff/output.diff-f".freeze, "spec/fixtures/ldiff/output.diff-u".freeze, "spec/fixtures/ldiff/output.diff.chef".freeze, "spec/fixtures/ldiff/output.diff.chef-c".freeze, "spec/fixtures/ldiff/output.diff.chef-e".freeze, "spec/fixtures/ldiff/output.diff.chef-f".freeze, "spec/fixtures/ldiff/output.diff.chef-u".freeze, "spec/fixtures/ldiff/output.diff.chef2".freeze, "spec/fixtures/ldiff/output.diff.chef2-c".freeze, "spec/fixtures/ldiff/output.diff.chef2-d".freeze, "spec/fixtures/ldiff/output.diff.chef2-e".freeze, "spec/fixtures/ldiff/output.diff.chef2-f".freeze, "spec/fixtures/ldiff/output.diff.chef2-u".freeze, "spec/fixtures/new-chef".freeze, "spec/fixtures/new-chef2".freeze, "spec/fixtures/old-chef".freeze, "spec/fixtures/old-chef2".freeze, "spec/hunk_spec.rb".freeze, "spec/issues_spec.rb".freeze, "spec/lcs_spec.rb".freeze, "spec/ldiff_spec.rb".freeze, "spec/patch_spec.rb".freeze, "spec/sdiff_spec.rb".freeze, "spec/spec_helper.rb".freeze, "spec/traverse_balanced_spec.rb".freeze, "spec/traverse_sequences_spec.rb".freeze]
s.homepage = "https://github.com/halostatue/diff-lcs".freeze
s.licenses = ["MIT".freeze, "Artistic-2.0".freeze, "GPL-2.0+".freeze]
s.licenses = ["MIT".freeze, "Artistic-2.0".freeze, "GPL-2.0-or-later".freeze]
s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
s.required_ruby_version = Gem::Requirement.new(">= 1.8".freeze)
s.rubygems_version = "3.1.6".freeze
s.rubygems_version = "3.5.3".freeze
s.summary = "Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm".freeze

if s.respond_to? :specification_version then
s.specification_version = 4
end
s.specification_version = 4

if s.respond_to? :add_runtime_dependency then
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<rspec>.freeze, [">= 2.0", "< 4"])
s.add_development_dependency(%q<rake>.freeze, [">= 10.0", "< 14"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.3.1", "< 7"])
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.23"])
else
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<rspec>.freeze, [">= 2.0", "< 4"])
s.add_dependency(%q<rake>.freeze, [">= 10.0", "< 14"])
s.add_dependency(%q<rdoc>.freeze, [">= 6.3.1", "< 7"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.23"])
end
s.add_development_dependency(%q<hoe>.freeze, [">= 4.0".freeze, "< 5".freeze])
s.add_development_dependency(%q<hoe-doofus>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1".freeze])
s.add_development_dependency(%q<hoe-git2>.freeze, ["~> 1.7".freeze])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0".freeze])
s.add_development_dependency(%q<rspec>.freeze, [">= 2.0".freeze, "< 4".freeze])
s.add_development_dependency(%q<rake>.freeze, [">= 10.0".freeze, "< 14".freeze])
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.3.1".freeze, "< 7".freeze])
end
8 changes: 4 additions & 4 deletions lib/diff/lcs/hunk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def initialize(data_old, data_new, piece, flag_context, file_length_difference)
def flag_context=(context) # :nodoc: # standard:disable Lint/DuplicateMethods
return if context.nil? || context.zero?

add_start = context > @start_old ? @start_old : context
add_start = (context > @start_old) ? @start_old : context

@start_old -= add_start
@start_new -= add_start
Expand Down Expand Up @@ -306,7 +306,7 @@ def context_range(mode, op, last = false)
e -= 1 if last
e = 1 if e.zero?

s < e ? "#{s}#{op}#{e}" : e.to_s
(s < e) ? "#{s}#{op}#{e}" : e.to_s
end
private :context_range

Expand All @@ -323,8 +323,8 @@ def unified_range(mode, last)

length = e - s + (last ? 0 : 1)

first = length < 2 ? e : s # "strange, but correct"
length <= 1 ? first.to_s : "#{first},#{length}"
first = (length < 2) ? e : s # "strange, but correct"
(length <= 1) ? first.to_s : "#{first},#{length}"
end
private :unified_range

Expand Down
2 changes: 1 addition & 1 deletion spec/issues_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def diff_lines(old_lines, new_lines)
Diff::LCS.diff(old_lines, new_lines).each do |piece|
hunk = Diff::LCS::Hunk.new(old_lines, new_lines, piece, 3, file_length_difference)
file_length_difference = hunk.file_length_difference
maybe_contiguous_hunks = (previous_hunk.nil? || hunk.merge(previous_hunk))
maybe_contiguous_hunks = previous_hunk.nil? || hunk.merge(previous_hunk)

output << "#{previous_hunk.diff(:unified)}\n" unless maybe_contiguous_hunks

Expand Down

0 comments on commit 672a063

Please sign in to comment.