diff --git a/.rubocop.yml b/.rubocop.yml index 6e7b6c7f..0a4e690d 100755 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,6 +9,8 @@ Style/Documentation: Layout/LineLength: Max: 100 + Exclude: + - "**/*.gemspec" Metrics/BlockLength: Exclude: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d902108..3364b99d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.3.0] - 2023-02-15 + +### Changed + +- Replace ::Ruby::OpenAI namespace with ::OpenAI - thanks [@kmcphillips](https://github.com/kmcphillips) for this work! +- To upgrade, change `require 'ruby/openai'` to `require 'openai'` and change all references to `Ruby::OpenAI` to `OpenAI`. + ## [3.2.0] - 2023-02-13 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index 36411e01..1f80c4df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ruby-openai (3.2.0) + ruby-openai (3.3.0) httparty (>= 0.18.1) GEM diff --git a/README.md b/README.md index 254ef315..e9200426 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,7 @@ and require with: ## Upgrading -The `::Ruby::OpenAI` module has been removed and all classes have been moved under the top level `::OpenAI` module. - -However, a transitional `::Ruby::OpenAI` module has been added with aliases to the new location of the classes and constants. For now this compatibility layer is available when the gem is loaded with `require 'ruby/openai'` or by default with bundler, but are _not_ available when the gem is loaded with `require 'openai'` or `gem 'ruby-openai', require: 'openai'`. This will be removed in future versions. - +The `::Ruby::OpenAI` module has been removed and all classes have been moved under the top level `::OpenAI` module. To upgrade, change `require 'ruby/openai'` to `require 'openai'` and change all references to `Ruby::OpenAI` to `OpenAI`. ## Usage diff --git a/lib/openai/version.rb b/lib/openai/version.rb index 5dd7b023..9dab4473 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,3 +1,3 @@ module OpenAI - VERSION = "3.2.0".freeze + VERSION = "3.3.0".freeze end diff --git a/ruby-openai.gemspec b/ruby-openai.gemspec index 968745a6..8ed13aa2 100644 --- a/ruby-openai.gemspec +++ b/ruby-openai.gemspec @@ -26,4 +26,6 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "httparty", ">= 0.18.1" + + spec.post_install_message = "Note if upgrading: The `::Ruby::OpenAI` module has been removed and all classes have been moved under the top level `::OpenAI` module. To upgrade, change `require 'ruby/openai'` to `require 'openai'` and change all references to `Ruby::OpenAI` to `OpenAI`." end diff --git a/spec/compatibility_spec.rb b/spec/compatibility_spec.rb index 4a3bb1d1..04191368 100644 --- a/spec/compatibility_spec.rb +++ b/spec/compatibility_spec.rb @@ -2,31 +2,31 @@ context "for moved constants" do describe "::Ruby::OpenAI::VERSION" do it "is mapped to ::OpenAI::VERSION" do - expect(::Ruby::OpenAI::VERSION).to eq(::OpenAI::VERSION) + expect(Ruby::OpenAI::VERSION).to eq(OpenAI::VERSION) end end describe "::Ruby::OpenAI::Error" do it "is mapped to ::OpenAI::Error" do - expect(::Ruby::OpenAI::Error).to eq(::OpenAI::Error) - expect(::Ruby::OpenAI::Error.new).to be_a(::OpenAI::Error) - expect(::OpenAI::Error.new).to be_a(::Ruby::OpenAI::Error) + expect(Ruby::OpenAI::Error).to eq(OpenAI::Error) + expect(Ruby::OpenAI::Error.new).to be_a(OpenAI::Error) + expect(OpenAI::Error.new).to be_a(Ruby::OpenAI::Error) end end describe "::Ruby::OpenAI::ConfigurationError" do it "is mapped to ::OpenAI::ConfigurationError" do - expect(::Ruby::OpenAI::ConfigurationError).to eq(::OpenAI::ConfigurationError) - expect(::Ruby::OpenAI::ConfigurationError.new).to be_a(::OpenAI::ConfigurationError) - expect(::OpenAI::ConfigurationError.new).to be_a(::Ruby::OpenAI::ConfigurationError) + expect(Ruby::OpenAI::ConfigurationError).to eq(OpenAI::ConfigurationError) + expect(Ruby::OpenAI::ConfigurationError.new).to be_a(OpenAI::ConfigurationError) + expect(OpenAI::ConfigurationError.new).to be_a(Ruby::OpenAI::ConfigurationError) end end describe "::Ruby::OpenAI::Configuration" do it "is mapped to ::OpenAI::Configuration" do - expect(::Ruby::OpenAI::Configuration).to eq(::OpenAI::Configuration) - expect(::Ruby::OpenAI::Configuration.new).to be_a(::OpenAI::Configuration) - expect(::OpenAI::Configuration.new).to be_a(::Ruby::OpenAI::Configuration) + expect(Ruby::OpenAI::Configuration).to eq(OpenAI::Configuration) + expect(Ruby::OpenAI::Configuration.new).to be_a(OpenAI::Configuration) + expect(OpenAI::Configuration.new).to be_a(Ruby::OpenAI::Configuration) end end end