diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc23ef3..bdc8225 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,12 +2,15 @@ name: tests on: push: + branches: + - "master" + pull_request: jobs: rubocop: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -18,10 +21,10 @@ jobs: tests: strategy: matrix: - ruby-version: [2.6, 2.7, 3.0, 3.1] + ruby-version: ["3.0", "3.1", "3.2", "3.3"] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.rubocop.yml b/.rubocop.yml index 9c3710a..e03ee47 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,7 @@ require: - rubocop-rspec AllCops: + NewCops: enable Exclude: - vendor/**/* TargetRubyVersion: 3.1 diff --git a/.ruby-version b/.ruby-version index ef538c2..15a2799 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 +3.3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index c85d52f..e2ea1f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,33 @@ +# 6.0.0 - 2024-01-09 + +- Drop support for Ruby 2.6 and 2.7. +- Add support for Ruby 3.2 and 3.3. + # 5.0.0 -* Ensure Prius#load raises an error when unexpected options are passed +- Ensure Prius#load raises an error when unexpected options are passed # 4.1.0 -* Add support for coercing to a date. +- Add support for coercing to a date. # 4.0.0 -* Add support for Ruby 3.0 -* Enforce Ruby 2.6 as minimum required version -* Drop support for Ruby 2.2, 2.3, 2.4, 2.5 -* Drop support for JRuby versions < 9.3.x (implicity enforced by C Ruby version 2.6 as minimum) +- Add support for Ruby 3.0 +- Enforce Ruby 2.6 as minimum required version +- Drop support for Ruby 2.2, 2.3, 2.4, 2.5 +- Drop support for JRuby versions < 9.3.x (implicity enforced by C Ruby version 2.6 as minimum) # 3.0.0 -* Enforce Ruby 2.2 as minimum required version -* Use CircleCI instead of Travis for CI builds -* Add Dependabot support -* Some development dependency updates +- Enforce Ruby 2.2 as minimum required version +- Use CircleCI instead of Travis for CI builds +- Add Dependabot support +- Some development dependency updates # 2.0.0 -* Drop support for Ruby versions 1.9, 2.0, 2.1, and add support for 2.3 and 2.4 +- Drop support for Ruby versions 1.9, 2.0, 2.1, and add support for 2.3 and 2.4 # 1.0.0 diff --git a/Gemfile b/Gemfile index be173b2..e49facd 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,10 @@ source "https://rubygems.org" gemspec + +group :development do + gem "gc_ruboconfig", "~> 4.4" + gem 'pry' + gem "rspec", "~> 3.12" + gem "rspec-github", "~> 2.4.0" +end diff --git a/lib/prius/registry.rb b/lib/prius/registry.rb index 275a350..d4c815b 100644 --- a/lib/prius/registry.rb +++ b/lib/prius/registry.rb @@ -16,7 +16,7 @@ def initialize(env) # See Prius.load for documentation. def load(name, env_var: nil, type: :string, required: true) - env_var = env_var.nil? ? name.to_s.upcase : env_var + env_var = name.to_s.upcase if env_var.nil? @registry[name] = case type when :string then load_string(env_var, required) when :int then load_int(env_var, required) diff --git a/lib/prius/version.rb b/lib/prius/version.rb index 2155d22..4b616da 100644 --- a/lib/prius/version.rb +++ b/lib/prius/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Prius - VERSION = "5.0.0" + VERSION = "6.0.0" end diff --git a/prius.gemspec b/prius.gemspec index 208bb9a..3cdb368 100644 --- a/prius.gemspec +++ b/prius.gemspec @@ -1,30 +1,30 @@ -# coding: utf-8 # frozen_string_literal: true -require "English" - -lib = File.expand_path("lib", __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "prius/version" +require_relative "lib/prius/version" Gem::Specification.new do |spec| spec.name = "prius" spec.version = Prius::VERSION spec.authors = ["GoCardless Engineering"] spec.email = ["engineering@gocardless.com"] - spec.description = "Environmentally-friendly config" - spec.summary = spec.description + spec.summary = "Environmentally-friendly config. Validate and enforce the presence " \ + "and correct types of environment variables." + spec.description = <<~MSG.strip.tr("\n", " ") + Prius is a powerful and versatile gem designed to simplify the management of environment variables + in your application. With Prius, you can guarantee that your environment variables are not only + present but also valid, ensuring a smoother and more reliable app experience. + MSG spec.homepage = "https://github.com/gocardless/prius" spec.license = "MIT" - - spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.6" + spec.required_ruby_version = ">= 3.0" + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ + .git .circleci appveyor]) + end + end - spec.add_development_dependency "gc_ruboconfig", "~> 3.6.0" - spec.add_development_dependency "rspec", "~> 3.1" - spec.add_development_dependency "rspec-github", "~> 2.4.0" spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/spec/prius/registry_spec.rb b/spec/prius/registry_spec.rb index bf10d49..2ff930d 100644 --- a/spec/prius/registry_spec.rb +++ b/spec/prius/registry_spec.rb @@ -2,7 +2,7 @@ require "prius/registry" -describe Prius::Registry do +RSpec.describe Prius::Registry do let(:env) do { "NAME" => "Harry",