Gems Dependencies
Gems dependencies in Mack application are managed through gems.rb file located in {APP_DIR}/config/initializers folder of your application.
To add gem dependencies, you will need to call gem.add method inside the require_gems block. The add method takes 2 sets of arguments, the first one is required, which is the name of the gem, and the second set is a list of options.
-
:version
Specify a specific version of the gem that will be used. If none is specified, then the latest gem installed will be used. -
:libs
Specify the files that will be required by the gem. If none is specified, then nothing will be automatically required. -
:task
Specify the task file that will be required by the gem. In the task file, you should load all the rake files available in your application; this way all the tasks associated with your application will be made available whenrake --taskscommand is invoked.
Please note that by default the gem manager will try to find a file named {main_gem_file}_task.rb, where the main_gem_file is whatever the main file specified in the :libs directive. This is a convenient way of letting developer not to have to specify the :task directive if that pattern is followed. -
:source
This tells the gem manager to install the gem from a specified source.
For example:gem.add :termios, :source => "http://gems.rubyforge.org"will tell the gem manager that you'd like to install the gem from that source.
The following is an example on how to specify gem dependencies for your application:
Let's say we want to addmack-data_mapper and mack-data_factory as dependencies, then here's what the gems.rb file will look like:
require_gems do |gem| gem.add "mack-data_mapper", :version => "0.7.0", :libs => "mack-data_mapper" gem.add "mack-data_factory", :version => "0.7.0", :libs => "mack-data_factory" end