Releases: sleepingkingstudios/cuprum
Version 1.3.1
Added support for Ruby 4.0.
Version 1.3.0
The "A Dream Given Form" Update
As of version 1.3.0, Cuprum will no longer support Ruby 3.0.
Commands
Updated Cuprum::ExceptionHandling to re-raise the exception if the ENV['CUPRUM_RERAISE_EXCEPTIONS'] flag is set.
Implemented Command.subclass, allowing partial application of constructor parameters (including the implementation block).
Refactored Command.new(&block), which no longer overwrites the #process method directly. Commands can now use super in the #process method to wrap a block implementation (or the parent class implementation if the parent class overrides #process).
Breaking Change: The private method Command#process_block is now reserved and used to handle commands with block implementations.
Parameter Validation
Implemented Cuprum::ParameterValidation, which provides a DSL for validating a command's parameters prior to evaluating #process.
Errors
Breaking Change: Corrected the namespace for Cuprum::Errors::UncaughtException::TYPE to remove a reference to cuprum-collections. If this causes an issue, update your application to reference the constant, rather than a hard-coded value.
RSpec
Implemented Cuprum::RSpec::Deferred::ParameterValidationExamples, which provide a shortcut for testing commands that use parameter validation.
Version 1.2.0
The "Straight On Till Morning" Update
As of version 1.2.0, Cuprum will no longer support Ruby 2.7.
Results
Added the #properties method (aliased as #to_h) that wraps the result's #value, #status, and #error. Collecting the properties in one method supports defining results with additional or custom properties, such as a checksum or metadata.
The Cuprum::Result#== method was updated to compare the result's properties.
- A result can now be matched against a hash with
:value,:status, and:errorkeys. - Matching a result against a non-result object with its own
#value,#status, and#errormethods is now deprecated. Define a#to_hmethod on that object to wrap its properties for comparison with a result.
RSpec
Updated the Cuprum::RSpec::BeAResultMatcher to accept an optional result class.
Version 1.1.0
The "Second Star To The Right" Update
Extracted the documentation from the README to a dedicated Jekyll site at http://sleepingkingstudios.github.io/cuprum (or see the /docs directory).
Commands
Implemented Cuprum::MapCommand, which calls its implementation once for each item in the given collection and returns a ResultList (see below) containing the results of each call.
Errors
Added the Cuprum::Errors::MultipleErrors error class, which is used when converting a ResultList to a singular Result.
Results
Implemented Cuprum::ResultList, which implements the Cuprum::Result interface and aggregates an ordered list of results (such as the results of running a bulk action).
Version 1.1.0 Release Candidate 0
Pre-release for Version 1.1.0.
Version 1.0.0.
The "Look On My Works, Ye Mighty, and Despair" Update
Steps
Removed calling #step with a method name.
Version 0.11.0
The "One Giant Leap" Update
Note: This will be the last feature update before 1.0.
Commands
Implemented the #to_proc method, which allows for constructs such as array.map(&command).
Removed the deprecated chaining mechanic.
Currying
Added support for currying block parameters.
Exception Handling
Defined Cuprum::ExceptionHandling to rescue uncaught errors in commands.
Exception handling is not included by default - add include Cuprum::ExceptionHandling to your command classes to use this feature.
Middleware
Defined Cuprum::Middleware to define a wrapper that calls other commands.
Steps
Deprecated calling #step with a method name.
The error type and message when calling #steps without a block has changed.
Errors
Errors can now define their comparable properties by passing additional keywords to the constructor (or super for error subclasses).
Added the #type method and property.
Added serialization via the #as_json method.
Matchers
Implemented Cuprum::Matcher, which provides a way to handle different result cases.
RSpec
Added the #be_callable macro, which is a wrapper for #respond_to that references the #process method.
RSpec matchers are no longer automatically included when the macro is required. To use the Cuprum matchers, add config.include Cuprum::RSpec::Matchers to your RSpec configuration, or add include Cuprum::RSpec::Matchers to your example groups.
Version 0.10.0
The "One Small Step" Update
Note: This update may have backwards incompatible changes for versions of Ruby before 2.7 when creating commands whose last parameter is an arguments Hash. See separation of positional and keyword arguments for more information.
Commands
Implemented the #curry method, which performs partial application of arguments or keywords.
Chaining
Added deprecation warnings to all chaining methods, and Cuprum::Command no longer includes Cuprum::Chaining by default. The Cuprum::Chaining module will be removed in version 1.0.
Steps
Implemented the #step method, which extracts the value of the called command (on a success) or halts execution (on a failure).
Implemented the #steps method, which wraps a series of steps and returns first failing result, or the the last result if all steps are passing.
Version 0.9.1
Operations
Delegate Operation#status to the most recent result.
RSpec
The #be_a_passing_result macro now automatically adds a with_error(nil) expectation.
- This causes the error (if any) to be displayed when matching a failing result.
- This may break some cases when expecting a passing result that still has an error; in these cases, add an error expectation to the call, e.g.
expect().to be_a_passing_result.with_error(some_error).
Improve failure message of BeAResultMatcher under some circumstances.
Version 0.9.0
The "'Tis Not Too Late To Seek A Newer World" Update
Major refactoring of Command processing and the Result object. This update is not backwards compatible.
Commands
Removed the #success and #failure chaining helpers.
Permanently removed the deprecated ResultHelpers mixin.
Errors
Added Cuprum::Error, which encapsulates the failure state of a result. It is recommended, but not required, that when creating a failing Result, the :error property be set to an instance of Cuprum::Error.
Results
Results are now nominally immutable objects. All mutator methods have been removed, including #failure!, #success!, and #update. The #empty? predicate has also been removed.
Updated the constructor to take the following keyword arguments: :value, :error, and :status.
- The status can now be overridden on a new Result by passing in the
:status. - Resolves an issue when attempting to instantiate a result with a Hash value.
- Note: The value must now be passed in as a keyword.
- Note: The
:errorskeyword has been renamed to:error.
Removed the :halted status.
Other Changes
Removed the Cuprum#warn functionality.
Upgrade Notes
Anywhere a new Cuprum::Result is created directly, update the arguments to match the new value: and error: keywords.
Anywhere the #result is referenced inside a command, instead return the desired value directly, or return a result with the desired error.
Anywhere a command is chained with the #success or #failure shorthand, use the full chain(on: :success) or chain(on: :failure) format.