Add Remarkable to your Gemfile:sudo gem install remarkable_activerecord --pre
In spec/spec_helper.rb add:group :test do
gem 'rspec', '>= 2.0.0.alpha7'
gem 'rspec-rails', '>= 2.0.0.alpha7'
gem 'remarkable', '>=4.0.0.alpha2'
gem 'remarkable_activemodel', '>=4.0.0.alpha2'
gem 'remarkable_activerecord', '>=4.0.0.alpha2'
If you just want Remarkable core, use:require 'rspec/rails'
If you just want Remarkable::ActiveModel, use:require 'remarkable/core'
All locales inside the gem are now automatically loaded. So if anyone wants to provide a translation for say, Traditional Chinese, feel free to fork and send a pull request.require 'remarkable/active_model'
This release also fixes the bug in alpha1 where the English localization was not properly loading for remarkable/active_model.
Changes for Macro DevelopersAlthough I wrote about improving macro registration, I googled around some more and found "Gem Packaging: Best Practices". The system I was proposing would overlap the functionality of Rubygems and Bundler (in so far as dependency checking). It would have been over-architected.
Requiring remarkable/active_record should automatically require remarkable/active_model, which should in turn require remarkable. The version dependencies themselves are described in the gemspec file. Further, users should just be able to require a single file without having to mess with Remarkable.include_matchers! to get things done.
By moving the files from remarkable/lib/remarkable to remarkable/lib/remarkable/core, it opens it up developers to add to the remarkable namespace. For example, we can have a require 'remarkable/foreigner' by making a lib/remarkable/foreigner.rb inside the gem and dropping the rest of the files into lib/remarkable/foreigner/.
Instead of using lines such as
we just have# Load Remarkable ActiveModel files[ src ]
dir = File.dirname(__FILE__)
require File.join(dir, 'remarkable_activemodel', 'base')
# Load Remarkable[ src ]
But how do we avoid loading the system gems when we want to run tests? We throw custom load paths into $LOAD_PATH or its alias, $:
To help load these paths, I've added a path_helpers.rb that you can take a look at.
# In spec/spec_helpers.rb
$:.unshift(File.dirname(__FILE__), '..', 'lib')
For details, see remarkable_activemodel and remarkable_activerecord for examples on how the loading is done.