rake4latex 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ #
2
+ #Test index
3
+ #
4
+ Dir.chdir('../../lib'){ require 'rake4latex'}
5
+
6
+ #Prepeare longtable-content
7
+ #~ 6.times{
8
+ #~ puts "%10i & " % (rand(10).to_s * (rand(9) + 1)) +
9
+ #~ "%10i & " % (rand(10).to_s * (rand(9) + 1)) +
10
+ #~ "\\blindtext\\\\\\\hline"
11
+ #~ }
12
+ #~ exit
13
+
14
+ #~ deps = [
15
+ #~ 'testdocument.tex'
16
+ #~ ]
17
+ #~ file 'testdocument.dvi' => deps
18
+ #~ file 'testdocument.pdf' => deps
19
+
20
+ #~ file 'testdocument.dvi' => LaTeXRunner.find_included_files( 'testdocument.tex' ).flatten.uniq
21
+
22
+ task :basefile => 'testdocument.tex'
23
+ task :touch => 'testdocument.tex' #Zeitstempel anpassen/Kompilation erzwingen
24
+
25
+ file '*.tex'
26
+
27
+ task :default => :touch
28
+ #~ task :default => 'testdocument.dvi'
29
+ task :default => 'testdocument.pdf'
30
+ task :default => :clean
31
+
32
+ desc "Testtask for Unittest"
33
+ task :test => [ :touch, 'testdocument.pdf' ]
34
+ task :test_statistic => [ :statistic ]
35
+
36
+ #~ task :clean do
37
+ #~ puts CLEAN.inspect
38
+ #~ puts CLOBBER.inspect
39
+ #~ end
40
+
41
+ if $0 == __FILE__
42
+ app = Rake.application
43
+ app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
44
+ #~ app[:default].invoke
45
+ app[:test].invoke
46
+ app[:test_statistic].invoke
47
+ app[:clobber].invoke
48
+ end
@@ -0,0 +1,23 @@
1
+ \documentclass[10pt,ngerman]{scrartcl}
2
+ \usepackage{babel}
3
+ \usepackage[ansinew]{inputenc}
4
+ \usepackage{blindtext}
5
+ \usepackage{hyperref}
6
+ \usepackage{supertabular}
7
+ % ----------------------------------------------------------------
8
+ \begin{document}
9
+ \blindtext
10
+
11
+ {\small
12
+ \begin{supertabular}{llp{0.3\textwidth}}
13
+ 4444444 & 33333 & \blindtext\\\hline
14
+ 0 & 222 & \blindtext\\\hline
15
+ 6666 & 222222 & \blindtext\\\hline
16
+ 111111111 & 777777 & \blindtext\\\hline
17
+ 333 & 8888888 & \blindtext\\\hline
18
+ 4444 & 99 & \blindtext\\\hline
19
+ \end{supertabular}
20
+ }
21
+
22
+ \end{document}
23
+ % ----------------------------------------------------------------
@@ -0,0 +1,16 @@
1
+ \documentclass[10pt,ngerman]{scrartcl}
2
+ \usepackage{babel}
3
+ \usepackage[ansinew]{inputenc}
4
+ \usepackage{blindtext}
5
+ \usepackage{hyperref}
6
+ % ----------------------------------------------------------------
7
+ \title{Testdocument}
8
+ % ----------------------------------------------------------------
9
+ \begin{document}
10
+ \maketitle
11
+ \tableofcontents
12
+ \blinddocument
13
+
14
+ %\input{testdocument_input}
15
+ \end{document}
16
+ % ----------------------------------------------------------------
@@ -0,0 +1,116 @@
1
+ require 'test/unit'
2
+ require 'assert_equal_filecontent'
3
+
4
+ Dir.chdir('../lib'){ require 'rake4latex'}
5
+
6
+ class Test_LaTeXRunner < Test::Unit::TestCase
7
+ def test_initialize()
8
+ #~ texrunner = LaTeXRunner.new( :main_file => 'testdocument.tex' )
9
+
10
+ #Avoid messages
11
+ LaTeXRunner::DEFAULT_SETTINGS[:loglevel] = Log4r::FATAL
12
+
13
+ #exception Unknown option
14
+ assert_raise(ArgumentError){ LaTeXRunner.new( :main_file => 'testdocument.tex', :unknown_option => 'a' ) }
15
+
16
+ #exception main file not found/missing
17
+ assert_raise(ArgumentError){ LaTeXRunner.new( ) }
18
+ assert_raise(LaTeXRunner::MainfileError){ LaTeXRunner.new( :main_file => nil) }
19
+ assert_raise(LaTeXRunner::MainfileError){ LaTeXRunner.new( :main_file => 'unknown_document.tex') }
20
+
21
+ #exception maxrun
22
+ assert_raise(ArgumentError){ LaTeXRunner.new( :main_file => 'testdocument.tex', :maxruns => 'a' ) }
23
+ assert_raise(ArgumentError){ LaTeXRunner.new( :main_file => 'testdocument.tex', :maxruns => 1.2 ) }
24
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :maxruns => LaTeXRunner::Infinity ) }
25
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :maxruns => 1.0/0 ) }
26
+
27
+ #exception program
28
+ assert_raise(ArgumentError){ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => :unknown ) }
29
+ assert_raise(ArgumentError){ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => 'latex' ) }
30
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => :latex ) }
31
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => :pdflatex ) }
32
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => :lualatex ) }
33
+ assert_nothing_raised{ LaTeXRunner.new( :main_file => 'testdocument.tex', :program => :xelatex ) }
34
+
35
+ end
36
+ end
37
+ class Test_LaTeXDependencies < Test::Unit::TestCase
38
+ def test_initialize()
39
+
40
+ assert_raise(ArgumentError){ LaTeXDependencies.new( 'not_existing_document.tex' ) }
41
+
42
+ end
43
+ def test_find_included_files()
44
+
45
+ Dir.chdir('includes'){
46
+ testfile = LaTeXDependencies.new( 'testdocument.tex' )
47
+ assert_equal(['testdocument.tex'], testfile.get_dependecies())
48
+ assert_raise(ArgumentError){testfile.get_dependecies(:undefined)}
49
+
50
+ assert_equal([
51
+ 'testdocument.tex',
52
+ 'testincludes/testinclude1.tex', 'testincludes/testinclude2.tex',
53
+ ], testfile.get_dependecies(:inputs, :flat))
54
+
55
+ #~ assert_equal(testfile.get_dependecies(:inputs).first, testfile.find_included_files )
56
+
57
+ assert_equal(['testdocument.tex', [
58
+ 'testincludes/testinclude1.tex', ['testincludes/testinclude2.tex'],
59
+ 'testincludes/testinclude1.tex', ['testincludes/testinclude2.tex'],
60
+ ]], testfile.get_dependecies(:inputs))
61
+
62
+ assert_equal([
63
+ 'testincludes/testinclude1.tex', ['testincludes/testinclude2.tex'],
64
+ 'testincludes/testinclude1.tex', ['testincludes/testinclude2.tex'],
65
+ ], testfile.find_included_files )
66
+ } #dir includes
67
+ #More checks:
68
+ #Exception on recursive include
69
+ end
70
+ end
71
+
72
+ class Test_testdocument < Test::Unit::TestCase
73
+ #Test all testcases.
74
+ def mytest_testcase( dir )
75
+ assert_equal( true, File.directory?(dir))
76
+ Dir.chdir(dir){
77
+ assert_equal( true, File.exist?('rakefile.rb'), "No rakefile in #{dir}")
78
+ #clean and check if test directory is empty in advance.
79
+ `call rake clobber`
80
+ assert_equal( true, Dir['*.{aux,log}'].empty?, "<#{dir}> contains old testdata")
81
+
82
+ #Logger umh�ngen auf file
83
+ #~ LaTeXRunner.logger.outputters = Log4r::FileOutputter.new("#{dir}.log4r")
84
+
85
+ LaTeXRunner::DEFAULT_SETTINGS[:loglevel] = Log4r::INFO
86
+ #testcases: test (test1 test2 ...)
87
+ testcase = nil
88
+ File.open('rakefile.rb'){|rakefile|
89
+ rakefile_content = rakefile.read
90
+ assert_match(/^\s*task\s*:basefile\s*=>/, rakefile_content, "Missing basefile-task in Test #{dir}")
91
+ rakefile_content.scan(/^task\s*:(test\S*)\s*=>/){|hit|
92
+ testcase = hit.first
93
+ stdout = `call rake #{testcase}`
94
+ stdout.sub!(/\(in .*?$/,'') #delete first line from rake (depends on directory the test runs).
95
+ assert_equal_filecontent( "../_expected/#{dir}_#{testcase}.txt", stdout,
96
+ "../_failure#{Date.today}"
97
+ )
98
+ }#loop on test-tasks
99
+ }#File rakefile
100
+ assert_not_nil(testcase, "No testcase found in <#{dir}>")
101
+
102
+ #~ `call rake clean`
103
+ `call rake clobber` #PDFs not really needed after the test.
104
+ }
105
+ end
106
+ Dir['*/'].each{|dir| #get all directories
107
+ next if dir =~ /^_/ #files for assert_equal_filecontent
108
+ dir.chop! #delete trailing /
109
+ class_eval <<code
110
+ def test_#{dir}
111
+ mytest_testcase( '#{dir}')
112
+ end
113
+ code
114
+ }
115
+ end
116
+
@@ -0,0 +1,59 @@
1
+ #
2
+ #Test Complex example
3
+ #
4
+ #* tableofcontents
5
+ #* Bibtex
6
+ #* Makeindex with splitindex
7
+ #
8
+ #
9
+ #
10
+ Dir.chdir('../../lib'){ require 'rake4latex'}
11
+
12
+ dependecies = [
13
+ 'testdocument.tex',
14
+ ]
15
+
16
+ #Aditional dependecy to recognize bib-changes
17
+ dependecies << 'testdocument.bib'
18
+ file 'testdocument.bbl' => 'testdocument.bib'
19
+
20
+ #Define dependecies
21
+ #~ file 'testdocument.dvi' => dependecies
22
+ file 'testdocument.pdf' => dependecies
23
+
24
+ #
25
+ #~ file 'testdocument.dvi' => LaTeXRunner.find_included_files( 'testdocument.tex' ).flatten.uniq
26
+
27
+ task :basefile => 'testdocument.tex'
28
+ CLEAN.add("testdocument-*") #splitidx-helpfiles, Not detected by set4clean
29
+ task :touch => 'testdocument.tex' #Zeitstempel anpassen/Kompilation erzwingen
30
+
31
+ task :default => :touch
32
+ #~ task :default => 'testdocument.dvi'
33
+ task :default => 'testdocument.pdf'
34
+ task :default => :statistic
35
+ #~ task :default => :clean
36
+
37
+ #~ task :clean do
38
+ #~ puts CLEAN.inspect
39
+ #~ puts CLOBBER.inspect
40
+ #~ end
41
+
42
+ desc "Testtask for Unittest"
43
+ task :test => [ :touch, 'testdocument.pdf' ]
44
+
45
+ #
46
+ #There are errors
47
+ #
48
+ #~ Rake.application.set_latexrunner_default(:texerrors_allowed, true)
49
+
50
+ if $0 == __FILE__
51
+ app = Rake.application
52
+ #~ app.set_latexrunner_default(:maxruns, 1)
53
+ #~ app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
54
+ #~ app.set_latexrunner_default(:texerrors_allowed, true)
55
+ app[:default].invoke
56
+ #~ app[:clean].invoke
57
+ app[:statistic].invoke
58
+ #~ app[:test].invoke
59
+ end
@@ -0,0 +1,26 @@
1
+ %
2
+ % Literaturdatenbank
3
+ %
4
+
5
+ % Remark for testing:
6
+ % If you want to test, if changes in the bibfile force a new bibtex and
7
+ %
8
+
9
+ @Article{ dtk00.4:lickert:blindtext,
10
+ author = {Knut Lickert},
11
+ title = {blindtext.sty: Viel {T}ext um {N}ichts},
12
+ journal = dtk,
13
+ year = 2000,
14
+ volume = {4/00},
15
+ altvolume = 4,
16
+ altnumber = 12,
17
+ month = nov,
18
+ pages = {47--50},
19
+ annote = bretter,
20
+ keywords = {},
21
+ abstract = {Mit dem hier beschriebenen Paket \texttt{blindtext.sty}
22
+ kann man schnell Text erzeugen, um Klassen und Pakete zu
23
+ testen. Das Paket ist im CTAN unter
24
+ \texttt{tex\_archive/macros/latex/contrib/supported/minutes/blindtext.dtx}
25
+ verf{\"u}gbar. }
26
+ }
@@ -0,0 +1,58 @@
1
+ \documentclass[english]{scrartcl}
2
+ \usepackage{babel}
3
+ \usepackage[ansinew]{inputenc}
4
+ \usepackage{splitidx}\makeindex
5
+ \usepackage{blindtext}
6
+ \usepackage{hyperref}
7
+ % ----------------------------------------------------------------
8
+ \title{Test document}
9
+ % ----------------------------------------------------------------
10
+ % ----------------------------------------------------------------
11
+ \newindex[GeneralIndex]{idx} % Nameandshortcutofthe1stindex
12
+ \newindex[Index of Animals]{ani} % ...2ndindex
13
+ \newindex[Index of Fruits]{fru} % ...3rdindex
14
+ \newindex[Index of Vegetables]{veg} % ...4thindex
15
+ % ----------------------------------------------------------------
16
+ % ----------------------------------------------------------------
17
+ \begin{document}
18
+ \maketitle
19
+
20
+ \begin{abstract}
21
+ \blindtext
22
+
23
+ This text was is generated by blindtext.sty, see \cite{dtk00.4:lickert:blindtext}
24
+ \end{abstract}
25
+
26
+ \tableofcontents
27
+
28
+ % ----------------------------------------------------------------
29
+ \blinddocument
30
+ % ----------------------------------------------------------------
31
+
32
+ \section{Some index entries}
33
+ Apples\sindex[fru]{apple} and oranges\sindex[fru]{orange}
34
+ are fruits\sindex{fruits}.
35
+
36
+ \blindtext
37
+
38
+ Tomatoes\sindex[veg]{tomato} are vegetables\index{vegetables}.
39
+ Cats\sindex[ani]{cat} are animals\sindex[idx]{animals}.
40
+
41
+ \sindex[xxx]{undefined index}
42
+
43
+ \section{Index entries}
44
+ This blind text in this document is generated by blindtext.sty, see \cite{dtk00.4:lickert:blindtext}.
45
+
46
+ This citation does not exist: \cite{irgendwas}
47
+
48
+
49
+ % ----------------------------------------------------------------
50
+ \printindex
51
+ \printindex[ani]
52
+ \printindex[fru]
53
+ \printindex[veg]
54
+
55
+ \bibliographystyle{plain}
56
+ \bibliography{testdocument}
57
+ \end{document}
58
+ % ----------------------------------------------------------------
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake4latex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Knut Lickert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-03 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: more_unit_test
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: |
26
+ Rake4LaTeX contains rake-tasks to compile LaTeX-projects.
27
+ Necessary makeindex or bibliography-calls are done.
28
+
29
+ email: knut@lickert.net
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - lib/call_rake4latex.rb
38
+ - lib/rake4latex.rb
39
+ - lib/rake4latex/latexdependencies.rb
40
+ - lib/rake4latex/latexrunner.rb
41
+ - lib/rake4latex/splitindex.rb
42
+ - lib/rake4latex/rules.rb
43
+ - lib/rake4latex/tex_statistic.rb
44
+ - readme.txt
45
+ - readme.html
46
+ has_rdoc: true
47
+ homepage: http://www.rubypla.net/rake4latex-0.0.1
48
+ licenses: []
49
+
50
+ post_install_message:
51
+ rdoc_options:
52
+ - --main
53
+ - lib/rake4latex.rb
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements:
69
+ - A (La)TeX-system
70
+ rubyforge_project:
71
+ rubygems_version: 1.3.5
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Rake4LaTeX contains rake-tasks to compile TeX-Documents.
75
+ test_files:
76
+ - test/bibtex/rakefile.rb
77
+ - test/bibtex/testdocument.bib
78
+ - test/bibtex/testdocument.tex
79
+ - test/includes/rakefile.rb
80
+ - test/includes/testdocument.tex
81
+ - test/includes/testincludes/testinclude1.tex
82
+ - test/includes/testincludes/testinclude2.tex
83
+ - test/index/rakefile.rb
84
+ - test/index/testdocument.tex
85
+ - test/longtable/rakefile.rb
86
+ - test/longtable/testdocument.tex
87
+ - test/minitoc/rakefile.rb
88
+ - test/minitoc/testdocument.tex
89
+ - test/rail/rakefile.rb
90
+ - test/rail/testrail.tex
91
+ - test/splitindex/rakefile.rb
92
+ - test/splitindex/testdocument.tex
93
+ - test/supertabular/rakefile.rb
94
+ - test/supertabular/testdocument.tex
95
+ - test/testdocument.tex
96
+ - test/testdocument.tex
97
+ - test/unittest_rake4latex.rb
98
+ - test/unittest_rake4latex.rb
99
+ - test/z_complex/rakefile.rb
100
+ - test/z_complex/testdocument.bib
101
+ - test/z_complex/testdocument.tex