This commit is contained in:
John Bintz 2012-02-28 17:18:35 -05:00
parent 4351bdf54d
commit 31aad8d7a2
1 changed files with 11 additions and 6 deletions

View File

@ -7,7 +7,7 @@ require 'builder'
module Hollandaise module Hollandaise
class << self class << self
attr_accessor :url attr_accessor :url, :browsers
def configure def configure
yield self yield self
@ -52,19 +52,24 @@ module Hollandaise
end end
begin begin
load 'hollandaise.rb' load File.join(Dir.pwd, 'hollandaise.rb')
rescue LoadError => e rescue LoadError => e
end end
class Hollandaise::CLI < Thor class Hollandaise::CLI < Thor
desc "sauce URL BROWSER BROWSER...", "Take screenshots of a URL on Sauce Labs" desc "sauce URL BROWSER BROWSER...", "Take screenshots of a URL on Sauce Labs"
method_options :delay => 0 method_options :delay => 0
def sauce(url, *browsers) def sauce(*browsers)
if Hollandaise.url if browsers.first && browsers.first[%r{^http}]
browsers.unshift(url) url = browsers.shift
else
url = Hollandaise.url url = Hollandaise.url
end end
if Hollandaise.browsers && browsers.empty?
browsers = Hollandaise.browsers
end
threads = [] threads = []
FileUtils.rm_rf(dir) if File.directory?(dir) FileUtils.rm_rf(dir) if File.directory?(dir)
@ -141,7 +146,7 @@ class Hollandaise::CLI < Thor
File.open('index.html', 'wb') { |fh| fh.print html.to_s } File.open('index.html', 'wb') { |fh| fh.print html.to_s }
end end
default_task :snapshot default_task :sauce
no_tasks do no_tasks do
def dir def dir