-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
48 lines (39 loc) · 1.36 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 'webrick'
Rake.add_rakelib 'lib/tasks'
task :config do |t|
CONFIG[:asciidoctor_pdf_args] = [
'--require', 'asciidoctor-mathematical', '-a', 'mathematical-format=svg',
]
CONFIG[:htmlproofer_opts] = {
ignore_urls: [
/github\.(io|com).*\/ssoo-apuntes/
]
}
end
desc 'Iniciar el servidor web de desarrollo'
task :server, [:port] => 'build:www' do |t, args|
args.with_defaults(:port => CONFIG[:server_port])
website_root = File.dirname(Rake::Task['build:www'].prerequisites.first)
server = WEBrick::HTTPServer.new :Port => args.port, :DocumentRoot => website_root
# Interceptar señales para detener el servidor.
['TERM', 'INT'].each do |signal|
trap signal do
server.shutdown
end
end
puts "=> Server starting on http://0.0.0.0:#{args.port}"
server.start
end
desc 'Publich release'
task :publish, [:yeartag] do |t, args|
if ! args[:yeartag]
raise "Argument 'yeartag' is required."
end
current_branch = `git branch --show-current`.strip!
release_branch = "curso-#{args[:yeartag]}"
release_tag = "so#{args[:yeartag]}"
sh 'git', 'rebase', 'master', release_branch
sh 'git', 'tag', '-f', release_tag, release_branch
sh 'git', 'push', '--atomic', '-f', 'origin', release_branch, release_tag
sh 'git', 'checkout', current_branch
end