Skip to content

Commit

Permalink
Simplify Rails Integration
Browse files Browse the repository at this point in the history
This allows easy inclusion within a Rails application by
auto-loading the engine if Rails is defined. This is a
given as apps require rails before doing Bundler.setup
  • Loading branch information
zacheryph authored and patbenatar committed Feb 23, 2024
1 parent 8c3c4a6 commit 08fc0b1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ gem "rbexy"

_From 1.0 onward, we only support Rails 6. If you're using Rails 5, use the 0.x releases._

In `config/application.rb`:

```ruby
require "rbexy/rails/engine"
```

_Not using Rails? See "Usage outside of Rails" below._

Create your first component at `app/components/hello_world_component.rb`:
Expand Down
7 changes: 3 additions & 4 deletions lib/rbexy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
require "active_support/inflector"
require "active_support/concern"
require "active_support/core_ext/enumerable"
require "action_view/helpers/output_safety_helper"
require "action_view/helpers/capture_helper"
require "action_view/helpers/tag_helper"
require "action_view/context"
require "action_view"

require "rbexy/rails/engine" if defined?(::Rails)

module Rbexy
autoload :Lexer, "rbexy/lexer"
Expand Down
1 change: 0 additions & 1 deletion lib/rbexy/component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "action_view"
require "active_support/core_ext/class/attribute"

module Rbexy
Expand Down
4 changes: 1 addition & 3 deletions spec/rbexy_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require "active_support/core_ext/string/strip"
require "active_support/all"
require "action_view/helpers"
require "action_view/context"
require "action_view/buffers"
require "action_view"

RSpec.describe Rbexy do
it "has a version number" do
Expand Down

0 comments on commit 08fc0b1

Please sign in to comment.