From 092408d4bb01e4ad49d540e346284211a15bce31 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Tue, 10 Sep 2024 22:00:27 -0400 Subject: [PATCH] Update policy and workflow --- .github/FUNDING.yml | 6 ++ .github/workflows/ci.yml | 150 +++++++++++++++++++++++++++++-------- .hoerc | 44 ++++++----- Code-of-Conduct.md | 156 ++++++++++++++++++++++++++------------- Contributing.md | 83 ++++++++------------- Gemfile | 20 +---- Rakefile | 51 ++----------- SECURITY.md | 8 +- diff-lcs.gemspec | 5 +- 9 files changed, 300 insertions(+), 223 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d1b7e69 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,6 @@ +# These are supported funding model platforms + +github: halostatue +buy_me_a_coffee: halostatue +ko_fi: halostatue +tidelift: rubygems/diff-lcs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3203a28..ec3784b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Ruby CI on: pull_request: @@ -7,62 +7,150 @@ on: workflow_dispatch: jobs: - test: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + rubygems: latest + bundler: 2 + bundler-cache: true + + - run: bundle exec standardrb + + required-ubuntu: name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} + strategy: fail-fast: false matrix: os: - - macos-latest - ubuntu-20.04 + - ubuntu-22.04 + - ubuntu-24.04 ruby: - - '2.4' - - '2.5' - '2.6' - '2.7' - - '3.0' - '3.1' - '3.2' - '3.3' - - head - jruby - - jruby-head - truffleruby include: - - ruby: head - continue-on-error: true - - ruby: jruby-head + - ruby: jruby + os: ubuntu-22.04 continue-on-error: true - - os: windows-latest - ruby: mingw - - os: windows-latest - ruby: mswin - - os: windows-latest - ruby: jruby + - ruby: truffleruby + os: ubuntu-22.04 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 }} + continue-on-error: ${{ matrix.continue-on-error }} + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: latest + bundler: 2 + bundler-cache: true + + - run: bundle exec ruby -S rake test --trace + + required-macos: + name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - macos-12 + - macos-13 + - macos-14 + ruby: + - '2.6' + - '2.7' + - '3.1' + - '3.2' + - '3.3' + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: latest + bundler: 2 + bundler-cache: true + + - run: bundle exec ruby -S rake test --trace + + required-windows: + name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - windows-2019 + - windows-2022 + ruby: + - '2.6' + - '2.7' + - '3.0' + - '3.1' + - '3.2' + - '3.3' + - mswin + - ucrt + include: + - ruby: mingw + os: windows-2022 + + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} rubygems: latest + bundler: 2 bundler-cache: true - run: bundle exec ruby -S rake test --trace - - if: matrix.standardrb == true - run: bundle exec standardrb + ruby-head-optional: + name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} (optional) + + strategy: + fail-fast: false + + matrix: + ruby: + - head + os: + - macos-latest + - ubuntu-latest + - windows-latest + + continue-on-error: true + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: latest + bundler: 2 + bundler-cache: true + + - run: bundle exec ruby -S rake test --trace diff --git a/.hoerc b/.hoerc index 26951da..17059ec 100644 --- a/.hoerc +++ b/.hoerc @@ -6,14 +6,14 @@ exclude: !ruby/regexp '/ )$ | \.(?: - bundle| - git| - github| - hg| - idea| - svn| - vagrant - )\/ + bundle | + git | + github | + hg | + idea | + svn | + vagrant + )\/ | [gG]emfile(?:\.lock)? | @@ -22,31 +22,29 @@ exclude: !ruby/regexp '/ research )\/ | + \b(?i:TAGS)$ + | \.(?: appveyor | coveralls | fasterer | pullreview | - rubocop.* | + rubocop* | travis | unused - )\.yml$ - | - (?i:TAGS)$ + )\.yml$ | \.(?: - DS_Store | - autotest | - byebug_history | - gemtest | - gitattributes | - gitignore | - hoerc | - minitest.rb | - simplecov-prelude.rb + DS_Store | + autotest | + byebug_history | + gemtest | + gitattributes | + gitignore | + hoerc | + minitest.rb | + simplecov-prelude.rb )$ | \.gemspec$ - | - ^Vagrantfile$ /x' diff --git a/Code-of-Conduct.md b/Code-of-Conduct.md index d05f4bc..184b5fb 100644 --- a/Code-of-Conduct.md +++ b/Code-of-Conduct.md @@ -2,73 +2,127 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. -Examples of unacceptable behavior by participants include: +## Our Standards -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +## Enforcement Responsibilities -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. ## Scope -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at [INSERT EMAIL ADDRESS]. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. +reported to the community leaders responsible for enforcement at [INSERT CONTACT +METHOD]. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +. Translations are available at +. -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ +[homepage]: https://www.contributor-covenant.org +[Mozilla CoC]: https://github.com/mozilla/diversity diff --git a/Contributing.md b/Contributing.md index 611cffc..76406c9 100644 --- a/Contributing.md +++ b/Contributing.md @@ -1,69 +1,44 @@ -## Contributing +# Contributing -I value any contribution to Diff::LCS you can provide: a bug report, a -feature request, or code contributions. Code contributions to Diff::LCS are -especially welcomeencouraged. Because Diff::LCS is a complex -codebase, there are a few guidelines: +I value any contribution to diff-lcs you can provide: a bug report, a feature +request, or code contributions. -- Code changes _will not_ be accepted without tests. The test suite is - written with [RSpec][]. +Code contributions to Diff::LCS are especially welcomeencouraged. +Because Diff::LCS is a complex codebase, there are a few guidelines: + +- Code changes _will_ _not_ be accepted without tests. The test suite is written + with [RSpec][RSpec]. - Match my coding style. -- Use a thoughtfully-named topic branch that contains your change. Rebase - your commits into logical chunks as necessary. -- Use [quality commit messages][]. -- Do not change the version number; when your patch is accepted and a release - is made, the version will be updated at that point. +- Use a thoughtfully-named topic branch that contains your change. Rebase your + commits into logical chunks as necessary. +- Use [quality commit messages][quality commit messages]. +- Do not change the version number; when your patch is accepted and a release is + made, the version will be updated at that point. - Submit a GitHub pull request with your changes. -- New or changed behaviours require appropriate documentation. - -### Test Dependencies - -Diff::LCS uses Ryan Davis’s [Hoe][] to manage the release process, and it -adds a number of rake tasks. You will mostly be interested in: - -```sh -$ rake -``` - -which runs the tests the same way that: +- New or changed behaviours require new or updated documentation. -```sh -$ rake spec -``` +## Test Dependencies -will do. +diff-lcs uses Ryan Davis’s [Hoe][Hoe] to manage the release process, and it adds +a number of rake tasks. You will mostly be interested in `rake`, which runs +tests in the same way that `rake spec` does. -To assist with the installation of the development dependencies, I have -provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file. This -will permit you to do: - -```sh -$ bundle install -``` - -to get the development dependencies. If you already have `hoe` installed, you -can accomplish the same thing with: - -```sh -$ rake newb -``` - -This task will install any missing dependencies, run the tests/specs, and +To assist with the installation of the development dependencies for diff-lcs, I +have provided a Gemfile pointing to the (generated) `diff-lcs.gemspec` file. If +you already have `hoe` installed, you can accomplish the same thing with +`rake newb`. This task will install any missing dependencies, run the specs, and generate the RDoc. -You can run tests with code coverage analysis by running: - -```sh -$ rake spec:coverage -``` +You can run tests with code coverage analysis by running `rake spec:coverage`. -### Workflow +## Workflow Here's the most direct way to get your work merged into the project: - Fork the project. - Clone down your fork (`git clone git://github.com//diff-lcs.git`). -- Create a topic branch to contain your change (`git checkout -b my_awesome_feature`). +- Create a topic branch to contain your change + (`git checkout -b my_awesome_feature`). - Hack away, add tests. Not necessarily in that order. - Make sure everything still passes by running `rake`. - If necessary, rebase your commits into logical chunks, without errors. @@ -71,11 +46,11 @@ Here's the most direct way to get your work merged into the project: - Create a pull request against halostatue/diff-lcs and describe what your change does and the why you think it should be merged. -### Contributors +## Contributors -- Austin Ziegler created Diff::LCS. +- Austin Ziegler created diff-lcs. -Thanks to everyone else who has contributed code or bug reports to Diff::LCS: +Thanks to everyone else who has contributed to diff-lcs over the years: - @ginriki - @joshbronson diff --git a/Gemfile b/Gemfile index 13a4998..016d5cd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,9 @@ -# frozen_string_literal: true +# NOTE: This file is not the canonical source of dependencies. Edit the +# Rakefile, instead. source "https://rubygems.org/" -if RUBY_VERSION < "1.9" - gem "hoe", "~> 3.20" - gem "rake", "< 11" - gem "rdoc", "< 4" - - gem "ruby-debug" -end - -if RUBY_VERSION >= "2.0" - if RUBY_ENGINE == "ruby" - gem "simplecov", "~> 0.18" - gem "byebug" - end -end +gem "debug", platforms: [:mri_31] if RUBY_VERSION >= "3.0" gem "standardrb" @@ -23,5 +11,3 @@ if RUBY_VERSION >= "3.0" end gemspec - -# vim: ft=ruby diff --git a/Rakefile b/Rakefile index e755637..c047913 100644 --- a/Rakefile +++ b/Rakefile @@ -1,49 +1,14 @@ -# frozen_string_literal: true - require "rubygems" require "rspec" require "rspec/core/rake_task" require "hoe" +require "rake/clean" -# This is required until https://github.com/seattlerb/hoe/issues/112 is fixed -class Hoe - def with_config - config = Hoe::DEFAULT_CONFIG - - rc = File.expand_path("~/.hoerc") - homeconfig = load_config(rc) - config = config.merge(homeconfig) - - localconfig = load_config(File.expand_path(File.join(Dir.pwd, ".hoerc"))) - config = config.merge(localconfig) - - yield config, rc - end - - def load_config(name) - File.exist?(name) ? safe_load_yaml(name) : {} - end - - def safe_load_yaml(name) - return safe_load_yaml_file(name) if YAML.respond_to?(:safe_load_file) - - data = IO.binread(name) - YAML.safe_load(data, permitted_classes: [Regexp]) - rescue - YAML.safe_load(data, [Regexp]) - end - - def safe_load_yaml_file(name) - YAML.safe_load_file(name, permitted_classes: [Regexp]) - rescue - YAML.safe_load_file(name, [Regexp]) - end -end - -Hoe.plugin :bundler +Hoe.plugin :cov Hoe.plugin :doofus Hoe.plugin :gemspec2 -Hoe.plugin :git +Hoe.plugin :git2 +Hoe.plugin :rubygems if RUBY_VERSION < "1.9" class Array # :nodoc: @@ -70,16 +35,16 @@ end _spec = Hoe.spec "diff-lcs" do developer("Austin Ziegler", "halostatue@gmail.com") - require_ruby_version ">= 1.8" - self.history_file = "History.md" self.readme_file = "README.rdoc" self.licenses = ["MIT", "Artistic-1.0-Perl", "GPL-2.0-or-later"] - spec_extras[:metadata] = ->(val) do + require_ruby_version ">= 1.8" + + spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" val["changelog_uri"] = "https://github.com/halostatue/diff-lcs/blob/main/History.md" - end + } extra_dev_deps << ["hoe", ">= 3.0", "< 5"] extra_dev_deps << ["hoe-doofus", "~> 1.0"] diff --git a/SECURITY.md b/SECURITY.md index 253446e..f4744f4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,3 +1,7 @@ -# Security contact information +# diff-lcs Security -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). Tidelift will +coordinate the fix and disclosure. diff --git a/diff-lcs.gemspec b/diff-lcs.gemspec index 7a0254d..0ed0e6c 100644 --- a/diff-lcs.gemspec +++ b/diff-lcs.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.metadata = { "bug_tracker_uri" => "https://github.com/halostatue/diff-lcs/issues", "changelog_uri" => "https://github.com/halostatue/diff-lcs/blob/main/History.md", "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 = "2024-02-02" + s.date = "2024-08-22" 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 = ["halostatue@gmail.com".freeze] s.executables = ["htmldiff".freeze, "ldiff".freeze] @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.licenses = ["MIT".freeze, "Artistic-1.0-Perl".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.5.3".freeze + s.rubygems_version = "3.5.17".freeze s.summary = "Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm".freeze s.specification_version = 4 @@ -32,4 +32,5 @@ Gem::Specification.new do |s| s.add_development_dependency(%q.freeze, [">= 2.0".freeze, "< 4".freeze]) s.add_development_dependency(%q.freeze, [">= 10.0".freeze, "< 14".freeze]) s.add_development_dependency(%q.freeze, [">= 6.3.1".freeze, "< 7".freeze]) + s.add_development_dependency(%q.freeze, ["~> 0.21".freeze]) end