18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/percy/capybara/bedrock/anywhere.rb', line 18
def self.run(server, web_root, assets_base_url = nil)
if ENV['PERCY_TOKEN'].nil?
raise 'Whoops! You need to setup the PERCY_TOKEN environment variable.'
end
::Capybara.run_server = false
::Capybara.app_host = server
page = ::Capybara::Session.new(:poltergeist)
Percy::Capybara.use_loader(Loader, web_root: web_root, base_url: assets_base_url)
build = Percy::Capybara.initialize_build
yield(page)
Percy::Capybara.finalize_build
puts
puts 'Done! Percy snapshots are now processing...'
puts "--> #{build['data']['attributes']['web-url']}"
end
|