From 4f258fab7a55666cf6e67ccd4a571b20e357b5a0 Mon Sep 17 00:00:00 2001 From: Marc Siegel Date: Tue, 4 May 2021 10:55:36 -0400 Subject: [PATCH] Remove support for EOL Rubies (< 2.6) In this PR: * Temporarily remove all YARD doc config, to be added back after migrating CI to Github Actions, to simplify config and dependencies * Remove all testing and references to < 2.6 Rubies * Simplify JRuby and TruffleRuby testing to latest stable versions NOT in this PR: * Any simplifying code changes that are now possible due to removing support for EOL Rubies Closes #58 --- .travis.yml | 19 +++++-------------- Gemfile | 7 ++----- HISTORY.md | 3 +++ README.md | 17 +++++------------ Rakefile | 16 ---------------- docile.gemspec | 19 +++---------------- lib/docile.rb | 2 +- on_what.rb | 18 ------------------ spec/spec_helper.rb | 5 +---- 9 files changed, 20 insertions(+), 86 deletions(-) delete mode 100644 on_what.rb diff --git a/.travis.yml b/.travis.yml index 4632b02..18b6222 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,25 +7,16 @@ branches: rvm: # MRI - ruby-head + - 3.0 - 2.7 - 2.6 - - 2.5 - - 2.4 - - 2.3 - - 2.2 - - 2.1 - - 1.9.3 - # JRuby - - jruby-head - - jruby-9.2 - # Truffleruby - - truffleruby-head - - truffleruby-20.3.0 + - jruby + - truffleruby jobs: allow_failures: - rvm: ruby-head - - rvm: jruby-head - - rvm: truffleruby-head + - rvm: jruby + - rvm: truffleruby fast_finish: true diff --git a/Gemfile b/Gemfile index 7eccca4..d4197fe 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,8 @@ -require File.expand_path("on_what", File.dirname(__FILE__)) source "https://rubygems.org" # Travis-only dependencies go here -if on_travis? && !on_less_than_2_3? - group :test do - gem "codecov", ">= 0.0.9", :require => false - end +if ENV["CI"] == "true" + gem "codecov", require: false, group: "test" end # Specify gem's dependencies in docile.gemspec diff --git a/HISTORY.md b/HISTORY.md index 396cc19..d58b216 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,9 @@ constructing a proxy object) when the DSL object and block context object are identical (*Sorry it took over a year to review and merge this!*) - Renamed default branch from master to main, see: https://github.com/github/renaming + - Temporarily removed YARD doc configuration, to replace after + migration to Github Actions + - Removed support for all EOL Rubies < 2.6 ## [v1.3.5 (Jan 13, 2021)](http://github.com/ms-ati/docile/compare/v1.3.4...v1.3.5) diff --git a/README.md b/README.md index 1c6211b..907738d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -## ⚠️WARNING⚠️, 🔴IMPORTANT❗🔴 -### Using Docile on an [end-of-life Ruby version (< **2.5**)](https://www.ruby-lang.org/en/downloads/branches/)? -#### Please comment on [issue #58](https://github.com/ms-ati/docile/issues/58) this month 📅! -We'll decide which Ruby versions to continue supporting on **Feb 1st 2021**. - # Docile [![Gem Version](https://img.shields.io/gem/v/docile.svg)](https://rubygems.org/gems/docile) @@ -29,7 +24,7 @@ coding a bit more docile... ## Usage -### Basic: Ruby [Array](http://ruby-doc.org/core-2.2.2/Array.html) as DSL +### Basic: Ruby [Array](http://ruby-doc.org/core-3.0.0/Array.html) as DSL Let's say that we want to make a DSL for modifying Array objects. Wouldn't it be great if we could just treat the methods of Array as a DSL? @@ -274,11 +269,11 @@ Sometimes, you want to use an object as a DSL, but it doesn't quite fit the above. Instead of methods like -[Array#push](http://www.ruby-doc.org/core-2.0/Array.html#method-i-push), which +[Array#push](http://www.ruby-doc.org/core-3.0.0/Array.html#method-i-push), which modifies the object at hand, it has methods like -[String#reverse](http://www.ruby-doc.org/core-2.0/String.html#method-i-reverse), +[String#reverse](http://www.ruby-doc.org/core-3.0.0/String.html#method-i-reverse), which returns a new object without touching the original. Perhaps it's even -[frozen](http://www.ruby-doc.org/core-2.0/Object.html#method-i-freeze) in +[frozen](http://www.ruby-doc.org/core-3.0.0/Object.html#method-i-freeze) in order to enforce [immutability](http://en.wikipedia.org/wiki/Immutable_object). Wouldn't it be great if we could just treat these methods as a DSL as well? @@ -356,7 +351,7 @@ $ gem install docile ## Status -Works on [all ruby versions since 1.9.3](https://github.com/ms-ati/docile/blob/master/.travis.yml), or so Travis CI [tells us](https://travis-ci.org/ms-ati/docile). +Works on [all currently supported ruby versions](https://github.com/ms-ati/docile/blob/master/.travis.yml), or so Travis CI [tells us](https://travis-ci.org/ms-ati/docile). Used by some pretty cool gems to implement their DSLs, notably including [SimpleCov](https://github.com/colszowka/simplecov). Keep an eye out for new gems using Docile at the [Ruby Toolbox](https://www.ruby-toolbox.com/projects/docile). @@ -382,5 +377,3 @@ Docile releases follow [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0. Copyright (c) 2012-2021 Marc Siegel. Licensed under the [MIT License](http://choosealicense.com/licenses/mit/), see [LICENSE](LICENSE) for details. - - diff --git a/Rakefile b/Rakefile index d8c6277..e4315ee 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,6 @@ require "rake/clean" require "bundler/gem_tasks" require "rspec/core/rake_task" -require File.expand_path("on_what", File.dirname(__FILE__)) # Default task for `rake` is to run rspec task :default => [:spec] @@ -11,18 +10,3 @@ RSpec::Core::RakeTask.new # Configure `rake clobber` to delete all generated files CLOBBER.include("pkg", "doc", "coverage") - -# To limit needed compatibility with versions of dependencies, only configure -# yard doc generation when *not* on Travis, JRuby, or < 2.0 -if !on_travis? && !on_jruby? && !on_less_than_2_0? - require "github/markup" - require "redcarpet" - require "yard" - require "yard/rake/yardoc_task" - - YARD::Rake::YardocTask.new do |t| - OTHER_PATHS = %w() - t.files = ["lib/**/*.rb", OTHER_PATHS] - t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md) - end -end diff --git a/docile.gemspec b/docile.gemspec index b625f50..4de5065 100644 --- a/docile.gemspec +++ b/docile.gemspec @@ -1,5 +1,4 @@ $:.push File.expand_path("../lib", __FILE__) -require File.expand_path("on_what", File.dirname(__FILE__)) require "docile/version" Gem::Specification.new do |s| @@ -25,20 +24,8 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] # Specify oldest supported Ruby version - s.required_ruby_version = ">= 1.9.3" + s.required_ruby_version = ">= 2.6.0" - # Run rspec tests from rake even on old Ruby versions - s.add_development_dependency "rake", "< 11.0" # See http://stackoverflow.com/questions/35893584/nomethoderror-undefined-method-last-comment-after-upgrading-to-rake-11 - s.add_development_dependency "rspec", "~> 3.0" - s.add_development_dependency "rspec-expectations", "!= 3.8.3" # Workaround for RSpec's issue, see: https://github.com/rspec/rspec-expectations/issues/1111 - - # To limit needed compatibility with versions of dependencies, only configure - # yard doc generation when *not* on Travis, JRuby, or < 2.3 - if !on_travis? && !on_jruby? && !on_less_than_2_3? - # Github flavored markdown in YARD documentation - # http://blog.nikosd.com/2011/11/github-flavored-markdown-in-yard.html - s.add_development_dependency "yard" - s.add_development_dependency "redcarpet" - s.add_development_dependency "github-markup" - end + s.add_development_dependency "rake", "~> 12.3.3" + s.add_development_dependency "rspec", "~> 3.9" end diff --git a/lib/docile.rb b/lib/docile.rb index 9bc5308..f91e811 100644 --- a/lib/docile.rb +++ b/lib/docile.rb @@ -124,7 +124,7 @@ def dsl_eval_with_block_return(dsl, *args, &block) def dsl_eval_immutable(dsl, *args, &block) exec_in_proxy_context(dsl, ChainingFallbackContextProxy, *args, &block) end - + ruby2_keywords :dsl_eval_immutable if respond_to?(:ruby2_keywords, true) module_function :dsl_eval_immutable end diff --git a/on_what.rb b/on_what.rb deleted file mode 100644 index aa05269..0000000 --- a/on_what.rb +++ /dev/null @@ -1,18 +0,0 @@ -# NOTE: Very simple tests for what system we are on, extracted for sharing -# between Rakefile, gemspec, and spec_helper. Not for use in actual library. - -def on_travis? - ENV["CI"] == "true" -end - -def on_jruby? - defined?(RUBY_ENGINE) && "jruby" == RUBY_ENGINE -end - -def on_less_than_2_0? - RUBY_VERSION < "2.0.0" -end - -def on_less_than_2_3? - RUBY_VERSION < "2.3.0" -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 027ab20..81f64f7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,13 @@ -require File.expand_path("on_what", File.dirname(File.dirname(__FILE__))) - # Code coverage (via SimpleCov) begin require "simplecov" SimpleCov.start do add_filter "/spec/" # exclude test code add_filter "/vendor/" # exclude gems which are vendored on Travis CI - add_filter "/on_what.rb" # exclude help used only in gemspec end # On CI we publish simplecov results to codecov.io - if on_travis? + if ENV["CI"] == "true" require "codecov" SimpleCov.formatter = SimpleCov::Formatter::Codecov end