tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
753 stars 123 forks source link

Modularisation of a gem? #175

Open skatkov opened 4 years ago

skatkov commented 4 years ago

This gem is jam packed with amazing features and great support. I'm personally very impressed with how this gem offers a way to manage stripe configuration!

I'm working on a Rails app that already has stripe support and stripe configuration management is the only biggest pain we have right now.

I'd love to use stripe-rails for exactly this feature, but I don't think that bringing such a huge dependency into the project just for that is a right way to go.

@tansengming have you considered splitting this gem into smaller gems? If you do, I'd be happy to consider moving configuration feature into stripe-config-rails (or something similar).

tansengming commented 4 years ago

Hi @skatkov this is great idea! However instead of splitting this to a separate gem how about loading it the way ActiveSupport does it? https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support

tldr, to load just one extension on activesupport:

require 'active_support'
require 'active_support/core_ext/object/blank'

to load all the extentions on active support:

require 'active_support'
require 'active_support/all'

this way all the code still lives on the same gem while you get to load exactly the code you need. What do you think?

I'm not sure what needs to be done for this to work but I'd be grateful if you'd like to look into it.