Skip to content

Commit

Permalink
Improve readme wording and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed Dec 16, 2019
1 parent 59307ae commit 048712d
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# 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_extension_dev_tools](https://github.com/solidusio-contrib/solidus_extension_dev_tools).

## 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
Expand All @@ -22,29 +24,28 @@ 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.

To use it just include the provided module in the Engine as follow:
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:

```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
Expand All @@ -58,9 +59,10 @@ 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

Expand Down

0 comments on commit 048712d

Please sign in to comment.