-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
38 lines (32 loc) · 993 Bytes
/
Rakefile
File metadata and controls
38 lines (32 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true
$LOAD_PATH << "./lib"
require "rspec/core/rake_task"
require "watir"
require "masterview_scraper"
require "mini_magick"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc "Take a screenshots of all the council sites to embed in the documentation"
task :screenshots do
browser = Watir::Browser.new :firefox
MasterviewScraper::AUTHORITIES.each do |k, v|
next if File.exist?("screenshots/#{k}.png")
puts "Opening #{k}..."
browser.goto v[:url]
browser.screenshot.save "screenshots/#{k}.png"
end
# Now combine the screenshots into one
MiniMagick::Tool::Montage.new do |montage|
montage.mode "unframe"
montage.background "#000000"
montage.geometry "600x355+20+20"
MasterviewScraper::AUTHORITIES.each do |k, _v|
montage << "screenshots/#{k}.png"
end
montage << "screenshots/all.jpg"
end
# Clean up
MasterviewScraper::AUTHORITIES.each do |k, _v|
File.delete("screenshots/#{k}.png")
end
end