Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Manage your project's dependencies with a pretty DSL
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
MIT-LICENSE
README.markdown
Rakefile
require.rb

README.markdown

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
Something went wrong with that request. Please try again.