class Retest::Setup

Public Class Methods

type() click to toggle source
# File lib/retest/setup.rb, line 3
def self.type
  new.type
end

Public Instance Methods

type() click to toggle source
# File lib/retest/setup.rb, line 7
def type
  @type ||= begin
    return :ruby unless has_lock_file?

    if rspec?
      :rspec
    elsif rails?
      :rails
    elsif rake?
      :rake
    else
      :ruby
    end
  end
end

Private Instance Methods

has_gem?(gem_name) click to toggle source
# File lib/retest/setup.rb, line 41
def has_gem?(gem_name)
  !`cat Gemfile.lock | grep #{gem_name}`.empty?
end
has_lock_file?() click to toggle source
# File lib/retest/setup.rb, line 25
def has_lock_file?
  File.exist? 'Gemfile.lock'
end
rails?() click to toggle source
# File lib/retest/setup.rb, line 33
def rails?
  has_gem? 'rails'
end
rake?() click to toggle source
# File lib/retest/setup.rb, line 37
def rake?
  has_gem? 'rake'
end
rspec?() click to toggle source
# File lib/retest/setup.rb, line 29
def rspec?
  has_gem? 'rspec'
end