Sha256: efe008d1c4cfbf6123b11f6f5961ba975b7ea5e546add7038a6ea1b2e2404c3f

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

#!/usr/bin/env ruby

require 'chauffeur'
require 'pp'

# puts "THE ARGUMENTS ARE: '#{ARGV}'"

def all_options
  %w[
    driver_versions
    init
    upgrade_driver
    upgrade_driver_all_platforms
    install_driver
    install_driver_all_platforms
    help
  ]
end

def browsers
  %w[chrome firefox edge ie]
end

def browser_error(text)
  Exception.new("Unknown browser'#{text}'. must be one of #{browsers}")
end

case ARGV[0]
when 'driver_versions'
  pp Chauffeur.driver_versions
when 'init'
  Chauffeur.initialize_chauffeur
when 'upgrade_driver'
  raise browser_error(ARGV[1]) unless browsers.include?(ARGV[1])
  Chauffeur.upgrade_driver(ARGV[1], ARGV[2])
when 'upgrade_driver_all_platforms'
  raise browser_error(ARGV[1]) unless browsers.include?(ARGV[1])
  Chauffeur.upgrade_driver_all_platforms(ARGV[1])
when 'install_driver'
  raise browser_error(ARGV[1]) unless browsers.include?(ARGV[1])
  Chauffeur.install_driver(ARGV[1], ARGV[2], ARGV[3])
when 'install_driver_all_platforms'
  raise browser_error(ARGV[1]) unless browsers.include?(ARGV[1])
  Chauffeur.install_driver_all_platforms(ARGV[1], ARGV[2])
when 'help'
  help_contents = File.read("#{File.dirname(__FILE__)}/../lib/chauffeur/help.txt")
  puts help_contents
else
  help_contents = File.read("#{File.dirname(__FILE__)}/../lib/chauffeur/help.txt")
  puts help_contents
  raise "Unknown option '#{ARGV[0]}' must be one of #{all_options}."
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chauffeur-0.0.7 bin/chauffeur
chauffeur-0.0.6 bin/chauffeur
chauffeur-0.0.5 bin/chauffeur
chauffeur-0.0.4 bin/chauffeur
chauffeur-0.0.3 bin/chauffeur
chauffeur-0.0.2 bin/chauffeur