Project

require

0.0
No commit activity in last 3 years
No release in over 3 years
Manage your project's dependencies with a pretty DSL
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Require

Manage your project's dependencies with a pretty DSL.

  • Gem activation
  • Require calls
  • Load paths
  • Gemspec configuration

Install

sudo gem install require

Example

Create require.rb in your project's root directory:

require 'rubygems'
gem 'require'
require 'require'

Require do

  gem(:sinatra, '=0.9.4') { require 'sinatra/base' }
  gem(:haml, '=2.2.16') { require %w(haml sass) }

  lib do
    gem :sinatra
    gem :haml
    load_path 'vendor/authlogic/lib'
    require 'authlogic'
  end
end

Then in your library file (lib/whatever.rb):

require File.expand_path("#{File.dirname(__FILE_)}/../require")
Require.lib!
  • Activates sinatra and haml gems
  • Requires sinatra, haml, and sass
  • Adds vendor/authlogic/lib to the load paths
  • Requires authlogic

Gemspec

You can also use Require to generate a Gem::Specification instance.

require 'rubygems'
gem 'require'
require 'require'

Require do

  gem(:sinatra, '=0.9.4') { require 'sinatra/base' }

  gemspec do
    author 'Your Name'
    dependencies do
      gem :sinatra
    end
    email 'your@email.com'
    name 'my_project'
    homepage "http://github.com/your_name/#{name}"
    summary ""
    version '0.1.0'
  end
end

Then use it in your rakefile:

require File.dirname(__FILE_) + "/require"

desc "Package gem"
Rake::GemPackageTask.new(Require.gemspec) do |pkg|
  pkg.gem_spec = Require.gemspec
end