Created
September 13, 2009 00:34
-
-
Save maxim/186030 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install | |
# | |
# Move this file into config/preinitializer.rb | |
# | |
# Usage | |
# | |
# This line: | |
# config.github_gem "mislav-will_paginate" | |
# is equivalent to this line: | |
# config.gem "mislav-will_paginate", :lib => "will_paginate", :source => "http://gem.github.com" | |
# | |
# You can pass in options to override defaults such as this: | |
# config.github_gem "mislav-will_paginate", :source => "http://example.com", :version => "~ 2.1" | |
# | |
# which will be equivalent to this: | |
# config.gem "mislav_will_paginate", :lib => "will_paginate", :source => "http://example.com", :version => "~ 2.1" | |
# | |
# Lastly you can pass in multiple options | |
# config.github_gem "mislav-will_paginate", "josevalim-inherited_resources" | |
# | |
# Using options in latter case makes no sense, since they will be apply to every gem. | |
class Rails::Configuration | |
def github_gem(*gem_options) | |
overrides = gem_options.last.is_a?(Hash) ? gem_options.pop : {} | |
gem_options.each do |gem_name| | |
self.gem(gem_name, { :lib => gem_name.split('-')[1], :source => "http://gems.github.com" }.merge(overrides)) | |
end | |
end | |
alias :github_gems :github_gem | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment