-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
48 lines (41 loc) · 1.01 KB
/
Rakefile
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
39
40
41
42
43
44
45
46
47
48
require 'html-proofer'
class String
def shuffle
split('').shuffle.join
end
def shuffle!
replace shuffle
end
end
desc 'Generate an obfuscated email address to stop spammers'
task :email do
puts 'Please type in an email address then press ENTER/RETURN'
address = STDIN.gets.chomp.downcase
key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
key.shuffle!
puts "\nInstallation:\nUpdate _config.yml with the following pairs.\n\nemail-key: #{key}"
scrambled = ''
shift = address.length
(0..shift-1).each do |i|
if key.index(address[i]) == nil
scrambled += address[i]
else
chr = (key.index(address[i]) + shift) % key.length
scrambled += key[chr]
end
end
puts "email-encoded: #{scrambled}\n"
end
namespace :site do
task :build do
system "bundle exec jekyll build"
end
task :test do
HTMLProofer.check_directory("./www", {
:typhoeus => {
:ssl_verifypeer => false,
:ssl_verifyhost => 0
}
}).run
end
end