Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make railties an optional dependency #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cllns
Copy link

@cllns cllns commented Jul 24, 2017

We'd like to use vanilla-ujs in Hanami but we can't depend on railties.

This also helps people using Sinatra, and other Ruby web frameworks. This is a first step towards freeing vanilla-ujs from Rails :)

I'm very flexible and not tied to any specific changes here. This PR:

  1. adds a guard to only load the Rails Engine if Rails is defined.
  2. changes the module definition in ujs.rb from Rails to Ujs, since that's more idiomatic.
  3. rearranges the requires to be within the module, so that this Vanilla::Ujs module is first defined in this file, and not in the version file.
  4. keeps railties as a development dependency, so contributors to this gem can test the Rails integration without any trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant