Sha256: ee3974beb25309799eecc6140672af68f50b9f120878c2f0a75f18b32a1ab25b

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# redefine ` to stub the curl and git commands
module Kernel
  alias_method :real_backtick, :`
  def `(command)
    case command
    when /^curl (.+)/
      if $1 =~ /\.git\b|not-found/
        '404'
      else
        '200'
      end 

    when /^git (.+)/
      git_arguments = $1
      # git clone <url> (<dir>)
      if git_arguments =~ /^clone \S+ (.+)/
        require 'fileutils'
        FileUtils.mkdir_p $1 
      else
        puts 'delegating to git'
        real_backtick "git #{git_arguments}"
      end
    
    else
      real_backtick command
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vimmer-0.2.0 features/support/stub-commands.rb