module Sprinkle::Verifiers::Ruby

Ruby Verifiers

The verifiers in this module are ruby specific.

Public Instance Methods

has_gem(name, version = nil) click to toggle source

Checks if a gem exists by calling “gem list” and grepping against it.

# File lib/sprinkle/verifiers/ruby.rb, line 19
def has_gem(name, version = nil)
  version = version ? "--version '#{version}'" : '' 
  @commands << "gem list '#{name}' --installed #{version} > /dev/null"
end
ruby_can_load(*files) click to toggle source

Checks if ruby can require the files given. rubygems is always included first.

# File lib/sprinkle/verifiers/ruby.rb, line 11
def ruby_can_load(*files)
  # Always include rubygems first
  files = files.unshift('rubygems').collect { |x| "require '#{x}'" }
  
  @commands << "ruby -e \"#{files.join(';')}\""
end