Module: Sprinkle::Verifiers::Ruby
- Defined in:
- lib/sprinkle/verifiers/ruby.rb
Overview
Ruby Verifiers
The verifiers in this module are ruby specific.
Instance Method Summary collapse
-
#has_gem(name, version = nil) ⇒ Object
Checks if a gem exists by calling “sudo gem list” and grepping against it.
-
#ruby_can_load(*files) ⇒ Object
Checks if ruby can require the
files
given.
Instance Method Details
#has_gem(name, version = nil) ⇒ Object
Checks if a gem exists by calling “sudo gem list” and grepping against it.
19 20 21 22 |
# File 'lib/sprinkle/verifiers/ruby.rb', line 19 def has_gem(name, version=nil) version = version.nil? ? '' : "--version '#{version}'" @commands << "sudo gem list '#{name}' --installed #{version} > /dev/null" end |
#ruby_can_load(*files) ⇒ Object
Checks if ruby can require the files
given. rubygems
is always included first.
11 12 13 14 15 16 |
# 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 |