escargot
escargot copied to clipboard
Make gem bundler compatible and remove dependency on activerecord
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.
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?
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.
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
Would love to see this happen :-)
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.
hi @mid9commander
could give me your email? And i explain to you how to configured the project for testing.
Thanks
check my github profile, I just updated it to have my email address visible. Thank you.
@jeroig Would it be possible for you to add the testing instructions as a wiki-page in the repository?
hi @pfeiffer,
No problem, i have never use the wiki - page but i will try now
https://github.com/jeroig/escargot/wiki/How-i-set-up-Escargot-for-testing