Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Created February 26, 2010 18:10
Show Gist options
  • Select an option

  • Save baroquebobcat/315977 to your computer and use it in GitHub Desktop.

Select an option

Save baroquebobcat/315977 to your computer and use it in GitHub Desktop.
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