escargot icon indicating copy to clipboard operation
escargot copied to clipboard

Make gem bundler compatible and remove dependency on activerecord

Open rubish opened this issue 13 years ago • 10 comments

Thanks for the wonderful gem. I am using it with the mongoid on rails 3.0.4, by including include Escargot::ActiveRecordExtensions in my model and defining table_exists? and find_in_batches method for my models. I also had to include the rake tasks manually and copy the init file to initializers. Till now its working perfectly fine.

There are only few changes required to make the gem compatible with Rails 3.0.4 and MongoID:

  • Make the init file bundler compatible
  • Only do ActiveRecord::Base.class_eval if ActiveRecord::Base is defined
  • Define workaround methods for MongoID(This will only be place holders and might be a little slow as compared to there ActiveRecord counterparts.)

I would love to contribute to the gem, but am currently busy with a project. Let me know if you would like me to work on it.

rubish avatar Mar 29 '11 01:03 rubish

Thanks you to use it.

Of course you can assist in the development of the gem. We would be grateful.

Only you have to do is : Fork, code, send pull request of your changes.

I remember, in order to maintain the robustness of the gem, any pull request need to pass the test suite. We accepts changes more quickly if it's coming with his own test passed.

Anything you need, let us know.

ps: Sometimes we don't realize the benefits of the change, so (and not always) we ask to you explications Why this change of the new code?, Which are the adventages?

jeroig avatar Mar 31 '11 13:03 jeroig

Thanks for the reply.

Benifits are simple:

  • anyone using rails3 would be able to use the gem, without hacking anything
  • removing ActiveRecord as dependency will make the gem more adaptable by people who are using other ORMs as they only have to figure out how to get it working with there ORM and not how to get rid of activerecord

I would first attempt to get it working with rails3, by making following modifications:

  • move lib/escargot.rb to lib/escargot/escargot.rb
  • copy rails/init.rb to lib/escargot.rb, this is required as the bundler requires lib/.rb instead of rails/init.rb
  • make changes in init.rb and escargot.rb to correctly reference moved files
  • only hook to ActiveRecord if ActiveRecord::Base is defined, to avoid errors if there is no ActiveRecord
  • use Railtie to load rake tasks on rails3

Let me know if it sounds good or I can approach it in a different manner.

PS: I have never worked with gems and plugins and would very much appreciate if you can guide me from where should I start? How to setup my own gem for testing? or point me towards right resources.

rubish avatar Apr 01 '11 03:04 rubish

Hi rubish,

I'm agree with the changes. could give me your email? And i explain to you how to configured the project for testing.

Thanks

jeroig avatar Apr 04 '11 19:04 jeroig

Would love to see this happen :-)

pfeiffer avatar Apr 18 '11 04:04 pfeiffer

I have it working for rails 3 and MongoMapper, I am a bit swamped at the moment to create test for it, if anyone has some time on their hand, they are more than welcome to take what I have in my fork and create test for it.

mid9commander avatar Apr 20 '11 05:04 mid9commander

hi @mid9commander

could give me your email? And i explain to you how to configured the project for testing.

Thanks

jeroig avatar Apr 20 '11 11:04 jeroig

check my github profile, I just updated it to have my email address visible. Thank you.

mid9commander avatar Apr 20 '11 14:04 mid9commander

@jeroig Would it be possible for you to add the testing instructions as a wiki-page in the repository?

pfeiffer avatar Apr 20 '11 14:04 pfeiffer

hi @pfeiffer,

No problem, i have never use the wiki - page but i will try now

jeroig avatar Apr 20 '11 14:04 jeroig

https://github.com/jeroig/escargot/wiki/How-i-set-up-Escargot-for-testing

jeroig avatar Apr 20 '11 17:04 jeroig