Created
February 26, 2010 18:10
-
-
Save baroquebobcat/315977 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Sprinkle::Installers::JRubyGem < Sprinkle::Installers::Gem | |
| protected | |
| def install_commands | |
| "jruby -S #{super}" | |
| end | |
| end | |
| module Sprinkle | |
| module Verifiers | |
| # = JRuby Verifiers | |
| # | |
| # The verifiers in this module are ruby specific. | |
| module JRuby | |
| Sprinkle::Verify.register(Sprinkle::Verifiers::JRuby) | |
| # Checks if ruby can require the <tt>files</tt> given. <tt>rubygems</tt> | |
| # is always included first. | |
| def jruby_can_load(*files) | |
| # Always include rubygems first | |
| files = files.unshift('rubygems').collect { |x| "require '#{x}'" } | |
| @commands << "jruby -e \"#{files.join(';')}\"" | |
| end | |
| # Checks if a gem exists by calling "sudo gem list" and grepping against it. | |
| def has_jruby_gem(name, version=nil) | |
| version = version.nil? ? '' : version.gsub('.', '\.') | |
| @commands << "sudo jruby -S gem list | grep -e '^#{name} (.*#{version}.*)$'" | |
| end | |
| end | |
| end | |
| end | |
| class Sprinkle::Package::Package | |
| def jruby_gem(name,options={},&block) | |
| @recommends << :jruby | |
| @recommends << :rubygems | |
| @installers << Sprinkle::Installers::JRubyGem.new(self,name,options,&block) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment