macaw 0.0.1 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -16
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +27 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +82 -0
  7. data/Rakefile +132 -0
  8. data/bin/macaw +308 -0
  9. data/lib/macaw.rb +2 -3
  10. data/lib/macaw/i18n/de.yml +171 -0
  11. data/lib/macaw/i18n/en.yml +157 -0
  12. data/lib/macaw/i18n/es.yml +159 -0
  13. data/lib/macaw/i18n/fr.yml +160 -0
  14. data/lib/macaw/i18n/it.yml +157 -0
  15. data/lib/macaw/i18n/pt-BR.yml +154 -0
  16. data/lib/macaw/i18n/pt.yml +155 -0
  17. data/lib/macaw/i18n/ru.yml +159 -0
  18. data/lib/macaw/i18n/tr.yml +148 -0
  19. data/lib/macaw/rules/animate.rb +26 -0
  20. data/lib/macaw/rules/biber.rb +8 -0
  21. data/lib/macaw/rules/bibtex.rb +8 -0
  22. data/lib/macaw/rules/clean.rb +10 -0
  23. data/lib/macaw/rules/dvipdfm.rb +9 -0
  24. data/lib/macaw/rules/dvipdfmx.rb +9 -0
  25. data/lib/macaw/rules/dvips.rb +9 -0
  26. data/lib/macaw/rules/dvipsps2pdf.rb +10 -0
  27. data/lib/macaw/rules/frontespizio.rb +14 -0
  28. data/lib/macaw/rules/indent.rb +36 -0
  29. data/lib/macaw/rules/latex.rb +17 -0
  30. data/lib/macaw/rules/lmkclean.rb +13 -0
  31. data/lib/macaw/rules/lualatex.rb +17 -0
  32. data/lib/macaw/rules/lualatexmk.rb +17 -0
  33. data/lib/macaw/rules/luatex.rb +17 -0
  34. data/lib/macaw/rules/make.rb +9 -0
  35. data/lib/macaw/rules/makeglossaries.rb +9 -0
  36. data/lib/macaw/rules/makeindex.rb +16 -0
  37. data/lib/macaw/rules/nomencl.rb +17 -0
  38. data/lib/macaw/rules/pdflatex.rb +17 -0
  39. data/lib/macaw/rules/pdflatexmk.rb +17 -0
  40. data/lib/macaw/rules/pdftex.rb +16 -0
  41. data/lib/macaw/rules/ps2pdf.rb +16 -0
  42. data/lib/macaw/rules/sketch.rb +14 -0
  43. data/lib/macaw/rules/songidx.rb +8 -0
  44. data/lib/macaw/rules/sumatrapdf.rb +10 -0
  45. data/lib/macaw/rules/tex.rb +9 -0
  46. data/lib/macaw/rules/texcount.rb +9 -0
  47. data/lib/macaw/rules/xdvipdfmx.rb +9 -0
  48. data/lib/macaw/rules/xelatex.rb +16 -0
  49. data/lib/macaw/rules/xelatexmk.rb +14 -0
  50. data/lib/macaw/rules/xetex.rb +15 -0
  51. data/lib/macaw/version.rb +2 -2
  52. data/macaw.gemspec +24 -17
  53. data/test/test_macaw.rb +8 -0
  54. metadata +133 -30
@@ -0,0 +1,26 @@
1
+ # Make animated .gif file from .pdf
2
+ # author: Chris Hughes
3
+ # last edited by: cmh, June 6th 2013
4
+ # requires arara 3.0+
5
+ #
6
+ # Sample usage:
7
+ #
8
+ # % arara: animate
9
+ # % arara: animate: {density: 200}
10
+ # % arara: animate: {density: 200, delay: 20}
11
+ #
12
+ # This rule is really just a shortcut for commands like the following
13
+ #
14
+ # convert -delay 10 -loop 0 -density 300 myfile.pdf myfile.gif
15
+ #
16
+ # which will output myfile.gif
17
+ #
18
+ class Macaw
19
+ def animate(delay=nil, loop=nil, density=nil)
20
+ delay ||= 10
21
+ loop ||= 0
22
+ density ||= 300
23
+
24
+ Macaw.system "convert -delay #{delay} -loop #{loop} -density #{density} #{~"#{@base}.pdf"} #{~"#{@base}.gif"}"
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ # Biber rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def biber(options=nil)
6
+ Macaw.system "biber #{options} #{~@base}"
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # BibTeX rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def bibtex(options=nil)
6
+ Macaw.system "bibtex #{options} #{~"#{@base}.aux"}"
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # Clean rule for arara
2
+ # author: Paulo Cereda
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def clean(files)
6
+ files.reject{|f| f.downcase == @file.downcase}.each{|f|
7
+ File.unlink(f)
8
+ }
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # DVIPS rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def dvipdfm(options=nil, output=nil)
6
+ output ||= @base
7
+ Macaw.system "dvipdfm #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # DVIPS rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def dvipdfmx(options=nil, output=nil)
6
+ output ||= @base
7
+ Macaw.system "dvipdfmx #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # DVIPS rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def dvips(options=nil, output=nil)
6
+ output ||= @base
7
+ Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{options}"
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # DVIPS rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def dvipsps2pdf(options=nil, output=nil)
6
+ output ||= @base
7
+ Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{@base}.ps"} #{options}"
8
+ Macaw.system "ps2pdf #{options} #{~"#{@base}.ps"} #{~"#{output}.pdf"}"
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ # Frontespizio rule for arara
2
+ # author: Francesco Endrici
3
+ # author: Enrico Gregorio
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def frontespizio(engine)
7
+ engine ||= 'pdflatex'
8
+
9
+ Macaw.system "#{engine} #{~@base}"
10
+ Macaw.system "#{engine} #{~"#{@base}-frn"}"
11
+ Macaw.system "dvips -o #{~"#{@base}-frn.eps"} #{~"#{@base}-frn"}" if engine == 'latex'
12
+ Macaw.system "#{engine} #{~@base}"
13
+ end
14
+ end
@@ -0,0 +1,36 @@
1
+ require 'os'
2
+ # indent rule for arara
3
+ # author: Paulo Cereda, Chris Hughes
4
+ # last updated: 11/9/2013
5
+ # requires arara 3.0+
6
+ #
7
+ # Sample usage:
8
+ #
9
+ # % arara: indent
10
+ # % arara: indent: {overwrite: yes}
11
+ # % arara: indent: {output: myfile.tex, silent: no}
12
+ # % arara: indent: {output: myfile.tex, silent: yes, overwrite: yes}
13
+ # % arara: indent: {trace: true}
14
+ # % arara: indent: {localSettings: true}
15
+ # % arara: indent: {onlyDefault: on}
16
+ # % arara: indent: { cruft: /home/cmhughes/Desktop }
17
+ #
18
+ # Directories with spaces will cause issues in the cruft call.
19
+ #
20
+ # Note: output will take priority above overwrite
21
+ class Macaw
22
+ def indent(overwrite=nil, silent=nil, trace=nil, localSettings=nil, output=nil, onlyDefault=nil, cruft=nil)
23
+ cmd = ["latexindent.#{OS.windows? ? 'exe' : 'pl'}"]
24
+ cmd << '-s' if silent
25
+ cmd << '-t' if trace
26
+ cmd << '-l' if localSettings
27
+ cmd << "-c=#{~cruft}" if cruft
28
+ cmd << '-w' if overwrite
29
+ cmd << '-d' if onlyDefault
30
+ cmd << "-o #{~output}" if output
31
+ cmd << ~@file
32
+ cmd << ~output if output
33
+
34
+ Macaw.system cmd
35
+ end
36
+ end
@@ -0,0 +1,17 @@
1
+ # LaTeX rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def latex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
7
+ cmd = ['latex']
8
+ cmd << "--interaction=#{action}" if action
9
+ cmd << '--draftmode' if draft
10
+ cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
+ cmd << "--synctex=#{synctex ? 1 : 0}"
12
+ cmd << options
13
+ cmd << ~@file
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # Clean rule for arara, via latexmk
2
+ # author: Brent Longborough
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def lmkclean(include=nil)
6
+ include ||= '-c'
7
+
8
+ cmd = ['latexmk']
9
+ cmd << include.downcase if include && %w{all -c}.include(include.downcase)
10
+ cmd << ~@file
11
+ Macaw.system cmd
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # LuaLaTeX rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def lualatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
7
+ cmd = ['lualatex']
8
+ cmd << "--interaction=#{action}" if action
9
+ cmd << '--draftmode' if draft
10
+ cmd << "--#{shell ? '' : 'no-'}shell-escape"
11
+ cmd << "--synctex=#{synctex ? 1 : 0}"
12
+ cmd << options
13
+ cmd << ~@file
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # LaTeXmk with LuaLaTeX rule for arara
2
+ # author: Brent Longborough
3
+ # requires: arara 3.0+
4
+ class Macaw
5
+ def lualatexmk(action=nil, shell=nil, synctex=nil, options=nil, style=nil)
6
+ cmd = []
7
+ cmd << "latexmk -e '$pdflatex=q/lualatex%O%S/'"
8
+ cmd << "--interaction=#{action}" if action
9
+ cmd << "--synctex=#{synctex ? 1 : 0}"
10
+ cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
+ cmd << options
12
+ cmd << "$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/" if style
13
+ cmd << "-pdf #{~@file}"
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # LuaTeX rule for arara
2
+ # author: Paulo Cereda
3
+ # requires arara 3.0+
4
+
5
+ class Macaw
6
+ def luatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
7
+ cmd = ['luatex']
8
+ cmd << "--interaction=#{action}" if action
9
+ cmd << '--draftmode' if draft
10
+ cmd << "--#{shell ? '' : 'no-'}shell-escape"
11
+ cmd << "--synctex=#{synctex ? 1 : 0}"
12
+ cmd << options
13
+ cmd << ~@file
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ # Make rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def make(task=nil)
7
+ Macaw.system ['make', task]
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # MakeGlossaries rule for arara
2
+ # author: Marco Daniel
3
+ # requres arara 3.0+
4
+ class Macaw
5
+ def makeglossaries(options=nil)
6
+
7
+ Macaw.system ['makeglossaries', options, ~@base]
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # MakeIndex rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def makeindex(style=nil, german=nil, options=nil, extension=nil)
7
+ extension ||= 'idx'
8
+
9
+ cmd = ['makeindex']
10
+ cmd << '-g' if german
11
+ cmd << "-s #{style}" if style
12
+ cmd << ~"#{@base}.#{extension}"
13
+
14
+ Macaw.system cmd
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # Nomencl rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def nomencl(style=nil, options=nil)
7
+ style ||= nomencl
8
+
9
+ cmd = ['makeindex']
10
+ cmd << options
11
+ cmd << ~"#{@base}.nlo"
12
+ cmd << '-s ' + ~"#{style}.ist" if style
13
+ cmd << '-o ' + ~"#{@base}.nls"
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # PDFLaTeX rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def pdflatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
7
+ cmd = ['pdflatex']
8
+ cmd << "--interaction=#{action}" if action
9
+ cmd << '--draftmode' if draft
10
+ cmd << shell ? '--shell-escape' : '--no-shell-escape'
11
+ cmd << "--synctex=#{synctex ? 1 : 0}"
12
+ cmd << options
13
+ cmd << ~@file
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # LaTeXmk with pdfLaTeX rule for arara
2
+ # author: Brent Longborough
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def pdflatexmk(action=nil, shell=nil, synctex=nil, options=nil, style=nil)
6
+ cmd = ["latexmk -e '$pdflatex=q/pdflatex%O%S/'"]
7
+ cmd << "--interaction=#{action}" if action
8
+ cmd << "--synctex=#{synctex ? 1 : 0}"
9
+ cmd << "--#{shell ? '' : 'no-'}shell-escape"
10
+ cmd << options
11
+ cmd << "-e '$makeindex=q/makeindex %O -s #{~"#{style}.ist"} -o %D %S/'" if style
12
+ cmd << '-pdf'
13
+ cmd << ~@file
14
+
15
+ Macaw.system cmd
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ # PDFTeX rule for arara
2
+ # author: Paulo Cereda
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def pdftex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
6
+ cmd = ['pdftex']
7
+ cmd << "--interaction=#{action}" if action
8
+ cmd << '--draftmode' if draft
9
+ cmd << "--#{shell ? '' : 'no-'}shell-escape"
10
+ cmd << "--synctex=#{synctex ? 1 : 0}"
11
+ cmd << options
12
+ cmd << ~@file
13
+
14
+ Macaw.system cmd
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # PS2PDF rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def ps2pdf(options=nil, output=nil)
7
+ output ||= @base
8
+
9
+ cmd = ['ps2pdf']
10
+ cmd << options
11
+ cmd << ~"#{@base}.ps"
12
+ cmd << ~"#{output}.pdf"
13
+
14
+ Macaw.system cmd
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ # Sketch rule for arara
2
+ # author: Sergey Ulyanov
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def sketch(options=nil)
6
+ cmd = ['sketch']
7
+ cmd << options
8
+ cmd << ~@file
9
+ cmd << '-o'
10
+ cmd << ~"#{@base}.tex"
11
+
12
+ Macaw.system cmd
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ # songidx rule for arara
2
+ # author: Francesco Endrici
3
+ # requires arara 3.0
4
+ class Macaw
5
+ def songidx(input)
6
+ Macaw.system "songidx " + ~"#{input}.sxd"
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # sumatrapdf rule for arara
2
+ class Macaw
3
+ def sumatrapdf(pdf=nil)
4
+ pdf ||= "#{@base}.pdf"
5
+
6
+ Macaw.log('spawning sumatrapdf...')
7
+ pdf = ~pdf
8
+ Process.spawn "sumatrapdf -reuse-instance #{pdf}"
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # TeX rule for arara
2
+ # author: Marco Daniel
3
+ # last edited by: Paulo Cereda
4
+ # requires arara 3.0+
5
+ class Macaw
6
+ def tex(action, shell=nil, options=nil)
7
+ Macaw.system ['tex', action ? "--interaction=#{action}" : nil, "--#{shell ? '' : 'no-'}shell-escape", options, ~@file]
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # texcount rule for arara
2
+ # author: Francesco Endrici
3
+ # requires arara 3.0
4
+ class Macaw
5
+ # this probably needs to be a lot fancier, but I can't be arsed about it right now.
6
+ def texcount(parameters)
7
+ Macaw.system ['texcount'] + parameters
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # DVIPS rule for arara
2
+ # author: Marco Daniel
3
+ # requires arara 3.0+
4
+ class Macaw
5
+ def dvipdfmx(output=nil, options=nil)
6
+ output ||= base
7
+ Macaw.system ['xdvipdfmx', ~"#{@base}.dvi", '-o', ~"#{output}.ps", options]
8
+ end
9
+ end