Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
--color
--format progress
--order random
--require spec_helper
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [UNRELEASED]

### Added
- Add `CMDx::Resolver` class to manage result transitions

## [1.21.0] - 2026-04-09

### Added
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
cmdx (1.21.0)
cmdx (3.0.0)
bigdecimal
logger
zeitwerk
Expand Down
43 changes: 20 additions & 23 deletions lib/cmdx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,32 @@ module CMDx
EMPTY_STRING = ""
private_constant :EMPTY_STRING

extend self

# Returns the path to the CMDx gem.
#
# @return [Pathname] the path to the CMDx gem
#
# @example
# CMDx.gem_path # => Pathname.new("/path/to/cmdx")
# @return [Pathname]
#
# @rbs return: Pathname
def gem_path
# @rbs () -> Pathname
def self.gem_path
@gem_path ||= Pathname.new(__dir__).parent
end

# @return [Configuration]
#
# @rbs () -> Configuration
def self.configuration
@configuration ||= Configuration.new
end

# @rbs () { (Configuration) -> void } -> void
def self.configure
yield configuration
end

# @rbs () -> void
def self.reset_configuration!
@configuration = Configuration.new
end

end

# Set up Zeitwerk loader for the CMDx gem
loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect("cmdx" => "CMDx", "json" => "JSON")
loader.ignore("#{__dir__}/cmdx/configuration")
Expand All @@ -54,26 +63,14 @@ def gem_path
loader.ignore("#{__dir__}/locales")
loader.setup

# Pre-load configuration to make module methods available
# This is acceptable since configuration is fundamental to the framework
require_relative "cmdx/configuration"

# Pre-load exceptions to make them available at the top level
# This ensures CMDx::Error and its descendants are always available
require_relative "cmdx/exception"

# Pre-load fault classes to make them available at the top level
# This ensures CMDx::FailFault and CMDx::SkipFault are always available
require_relative "cmdx/fault"

# Conditionally load Rails components if Rails is available
if defined?(Rails::Generators)
require_relative "generators/cmdx/install_generator"
require_relative "generators/cmdx/locale_generator"
require_relative "generators/cmdx/task_generator"
require_relative "generators/cmdx/workflow_generator"
end

# Load the Railtie last after everything else is required so we don't
# need to load any CMDx components when we use this Railtie.
require_relative "cmdx/railtie" if defined?(Rails::Railtie)
Binary file removed lib/cmdx/.DS_Store
Binary file not shown.
Loading
Loading