README.md in solidus_support-0.4.0 vs README.md in solidus_support-0.4.1
- old
+ new
@@ -1,18 +1,20 @@
# SolidusSupport
-This gem holds some common functionality for Solidus Extensions.
+This gem contains common runtime functionality for Solidus extensions.
-It has some utilities to make it easier to support multiple versions of Solidus.
+If you are looking for development tools instead, see
+[solidus_dev_support](https://github.com/solidusio-contrib/solidus_dev_support).
## Usage
### `SolidusSupport::Migration`
-Rails >= 5 introduced the concept of specifying what rails version your migration was written for, like `ActiveRecord::Migration[5.0]`.
-Not specifying a version is deprecated in Rails 5.0 and removed in rails 5.1.
-This wasn't backported to Rails 4.2, but Rails 4.2 _is_ Rails 4.2. So we provide this helper.
+Rails >= 5 introduced the concept of specifying what Rails version your migration was written for,
+like `ActiveRecord::Migration[5.0]`. Not specifying a version is deprecated in Rails 5.0 and removed
+in Rails 5.1. This wasn't backported to Rails 4.2, so we provide this helper to return the right
+parent class:
``` ruby
# On Rails 4.2
SolidusSupport::Migration[4.2] # returns `ActiveRecord::Migration`
SolidusSupport::Migration[5.0] # errors
@@ -20,33 +22,32 @@
# On Rails 5.0
SolidusSupport::Migration[4.2] # same as `ActiveRecord::Migration[4.2]`
SolidusSupport::Migration[5.0] # same as `ActiveRecord::Migration[5.0]`
```
-There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but it is provided.
+There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but
+it is provided.
-### Engine Extensions
+### Engine extensions
-This extension provides a module that extends `Rails::Engine` functionalities
-to support loading correctly the decorators class created into an extension
-both for development and production enviroments.
+This extension provides a module that decorates `Rails::Engine` to seamlessly support autoloading
+decorators both with the classic autoloader and with Zeitwerk on Rails 6. In order to use it, just
+include the provided module in your `Engine` class:
-To use it just include the provided module in the Engine as follow:
-
```ruby
module SolidusExtensionName
class Engine < Rails::Engine
engine_name 'solidus_extension_name'
include SolidusSupport::EngineExtensions::Decorators
+
# ...
end
end
```
-To make it work, be sure to remove the previous implementation from the
-Engine, that should be something like:
+If needed, also ensure to remove the original implementation of `.activate`:
```ruby
def self.activate
Dir.glob(File.join(root, "app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
@@ -56,12 +57,13 @@
config.to_prepare(&method(:activate).to_proc)
```
## Development
-After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
-
-To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+To install this gem onto your local machine, run `bundle exec rake install`. To release a new
+version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
+will create a git tag for the version, push git commits and tags, and push the `.gem` file to
+[rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/solidusio/solidus_support.