-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathRakefile
52 lines (44 loc) · 1.54 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
49
50
51
52
require 'tmpdir'
require 'jekyll'
require 'html-proofer'
# Change your GitHub reponame
GITHUB_REPONAME = 'tadp-utn-frba/tadp-utn-frba.github.io'
desc 'Generate blog files'
task :generate do
Jekyll::Site.new(Jekyll.configuration(source: '.', destination: '_site')).process
end
desc 'Check the generated page with html proofer'
task test: :generate do
begin
proofer = HTMLProofer.check_directory('./_site',
external_only: true,
enforce_https: false,
ignore_missing_alt: true,
parallel: { in_processes: 3 },
url_ignore: [/rubymonk.com/, /tadp-utn-frba.github.io/],
typhoeus: {
:ssl_verifypeer => false,
:ssl_verifyhost => 0 })
proofer.run
rescue => e
puts 'Task :test failed'
puts "#{e.class}: #{e.message}"
end
puts 'Finished running all tests'
end
desc 'Generate and publish blog to gh-pages'
task publish: :generate do
Dir.mktmpdir do |tmp|
cp_r '_site/.', tmp
pwd = Dir.pwd
Dir.chdir tmp
system 'git init'
system 'git add .'
message = "Site updated at #{Time.now}"
system "git commit -m #{message.inspect}"
system "git remote add origin [email protected]:#{GITHUB_REPONAME}.git"
system 'git push origin master --force'
Dir.chdir pwd
end
end
task default: :generate