Commit 3add7662 authored by Eduardo de Santana Medeiros Alexandre's avatar Eduardo de Santana Medeiros Alexandre
Browse files

Gerando nova versão

parent 49c610c3
...@@ -6,7 +6,7 @@ require 'open3' ...@@ -6,7 +6,7 @@ require 'open3'
task :default => [:wip] task :default => [:wip]
SOURCE_FILES = FileList['livro/livro.asc', 'livro/capitulos/*'] SOURCE_FILES = FileList['livro/livro.asc', 'livro/*']
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`.strip CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`.strip
@RELEASE_DIR = "releases/#{CURRENT_BRANCH}" @RELEASE_DIR = "releases/#{CURRENT_BRANCH}"
@BOOK_SOURCE_DIR = 'livro' @BOOK_SOURCE_DIR = 'livro'
...@@ -54,13 +54,11 @@ namespace "wip" do ...@@ -54,13 +54,11 @@ namespace "wip" do
Rake::Task["wip:new"].invoke Rake::Task["wip:new"].invoke
end end
EDITORA_PDF = "#{@BOOK_SOURCE_DIR}/editora/editora.pdf"
desc "build book from #{@RELEASE_DIR}" desc "build book from #{@RELEASE_DIR}"
task :build => [WIP_ADOC, :sync] do task :build => [WIP_ADOC, :sync] do
DRAFT_COMMAND = "--dblatex-opts '-P draft.mode=yes'" DRAFT_COMMAND = "--dblatex-opts '-P draft.mode=yes'"
prefacio_code_att = "" prefacio_code_att = ""
PREFACIO_CODE_DIR = "#{@RELEASE_DIR}/#{@BOOK_SOURCE_DIR}/capitulos/code/prefacio" PREFACIO_CODE_DIR = "#{@RELEASE_DIR}/#{@BOOK_SOURCE_DIR}/code/prefacio"
if Dir.exist?(PREFACIO_CODE_DIR) then if Dir.exist?(PREFACIO_CODE_DIR) then
Dir.chdir(PREFACIO_CODE_DIR) do Dir.chdir(PREFACIO_CODE_DIR) do
prefacio_code_file = Dir.glob("*").first prefacio_code_file = Dir.glob("*").first
...@@ -185,13 +183,13 @@ namespace "tag" do ...@@ -185,13 +183,13 @@ namespace "tag" do
date = Date.today.strftime "%d/%m/%Y" date = Date.today.strftime "%d/%m/%Y"
history, s = Open3.capture2("git log --reverse --format='- %s. ' #{args.tag}..HEAD") history, s = Open3.capture2("git log --reverse --format='- %s. ' #{args.tag}..HEAD")
revision = "\n revision = "\n
<revision> <revision>
<revnumber>#{edition}</revnumber> <revnumber>#{edition}</revnumber>
<date>#{date}</date> <date>#{date}</date>
<authorinitials>#{authors}</authorinitials> <authorinitials>#{authors}</authorinitials>
<revremark> <revremark>
#{history} </revremark> #{history} </revremark>
</revision>\n\n" </revision>\n\n"
puts revision puts revision
end end
...@@ -234,18 +232,6 @@ FileList['livro/images/**/*.R'].each do |source| ...@@ -234,18 +232,6 @@ FileList['livro/images/**/*.R'].each do |source|
task :r => rpdf task :r => rpdf
end end
desc "Build images from dot files"
task :dot
task :sync => :dot
FileList['livro/images/**/*.dot'].each do |source|
epsfile = source.ext('eps')
file epsfile => source do |t|
sh "dot -Teps -o #{t.name} #{t.source}"
end
task :dot => epsfile
end
namespace "github" do namespace "github" do
desc "List issues from github milestone. Default milestone state is closed, can also be all." desc "List issues from github milestone. Default milestone state is closed, can also be all."
task :issues, [:milestone] do |t,args| task :issues, [:milestone] do |t,args|
...@@ -321,25 +307,31 @@ namespace "release" do ...@@ -321,25 +307,31 @@ namespace "release" do
@RELEASE_DIR = "releases/#{args.tag}" @RELEASE_DIR = "releases/#{args.tag}"
release_dir = "releases/#{args.tag}" release_dir = "releases/#{args.tag}"
target_file = "releases/#{PROJECT_NAME}-#{@tag}.pdf" target_file = "releases/#{PROJECT_NAME}-#{@tag}.pdf"
editora_file = "#{release_dir}/livro/editora/editora.pdf" ficha_file = "#{release_dir}/livro/editora/ficha-#{args.tag}.pdf"
if File.exist?(ficha_file) then
editora_file = ficha_file
else
puts "Using 'editora.pdf' instead of ficha-#{args.tag}.pdf"
editora_file = "#{release_dir}/livro/editora/editora.pdf"
end
livro_source = "#{release_dir}/livro/livro.asc" livro_source = "#{release_dir}/livro/livro.asc"
livro_pdf = "#{release_dir}/livro/livro.pdf" livro_pdf = "#{release_dir}/livro/livro.pdf"
prefacio_code_att = ""
PREFACIO_CODE_DIR = "#{@RELEASE_DIR}/#{@BOOK_SOURCE_DIR}/code/prefacio"
if Dir.exist?(PREFACIO_CODE_DIR) then
Dir.chdir(PREFACIO_CODE_DIR) do
prefacio_code_file = Dir.glob("*").first
if (prefacio_code_file) then
prefacio_code_att = "-a prefacio-code=#{prefacio_code_file}"
end
end
end
directory release_dir directory release_dir
file livro_source => [release_dir] file livro_source => [release_dir]
file livro_pdf => [livro_source] do file livro_pdf => [livro_source] do
Dir.chdir(@RELEASE_DIR) do Dir.chdir(@RELEASE_DIR) do
prefacio_code_att = ""
PREFACIO_CODE_DIR = "#{@BOOK_SOURCE_DIR}/capitulos/code/prefacio"
if Dir.exist?(PREFACIO_CODE_DIR) then
Dir.chdir(PREFACIO_CODE_DIR) do
prefacio_code_file = Dir.glob("*").first
if (prefacio_code_file) then
prefacio_code_att = "-a prefacio-code=#{prefacio_code_file}"
end
end
end
@A2X_COMMAND="-v -k -f pdf --icons -a docinfo1 -a edition=#{@tag} -a lang=pt-BR -d book --dblatex-opts '-T computacao -P latex.babel.language=brazilian' -a livro-pdf #{prefacio_code_att}" @A2X_COMMAND="-v -k -f pdf --icons -a docinfo1 -a edition=#{@tag} -a lang=pt-BR -d book --dblatex-opts '-T computacao -P latex.babel.language=brazilian' -a livro-pdf #{prefacio_code_att}"
system "#{@A2X_BIN} #{@A2X_COMMAND} livro/livro.asc" system "#{@A2X_BIN} #{@A2X_COMMAND} livro/livro.asc"
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment