Module: Rubbr

Defined in:
lib/rubbr.rb,
lib/rubbr/cli.rb,
lib/rubbr/scm.rb,
lib/rubbr/spell.rb,
lib/rubbr/change.rb,
lib/rubbr/runner.rb,
lib/rubbr/viewer.rb,
lib/rubbr/builder.rb,
lib/rubbr/options.rb,
lib/rubbr/viewer/ps.rb,
lib/rubbr/builder/ps.rb,
lib/rubbr/viewer/dvi.rb,
lib/rubbr/viewer/pdf.rb,
lib/rubbr/builder/dvi.rb,
lib/rubbr/builder/tex.rb,
lib/rubbr/runner/dvips.rb,
lib/rubbr/runner/latex.rb,
lib/rubbr/runner/bibtex.rb,
lib/rubbr/runner/ps2pdf.rb,
lib/rubbr/scm/mercurial.rb,
lib/rubbr/scm/subversion.rb,
lib/rubbr/runner/pdflatex.rb

Defined Under Namespace

Modules: Builder, Cli, Runner, Scm, Viewer Classes: Change, Options, Spell

Constant Summary collapse

VERSION =
'1.1.4'
@@cmd_opts =
{}

Class Method Summary collapse

Class Method Details

.optionsObject



20
21
22
# File 'lib/rubbr.rb', line 20

def options
  @@global_opts ||= Rubbr::Options.setup.merge(@@cmd_opts)
end

.run(args = ARGV) ⇒ Object



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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/rubbr.rb', line 24

def run(args = ARGV)
  opts = OptionParser.new do |opts|
    opts.version = Rubbr::VERSION
    opts.banner = 'Usage: rubbr [options]'

    opts.on('-f', '--format [FORMAT]', [:dvi, :ps, :pdf],
      'Select output format (dvi, ps, pdf)') do |format|
      @@cmd_opts[:format] = format
    end

    opts.on('-e', '--engine [ENGINE]', [:pdflatex, :ps, :pdf],
      'Select processing engine (latex, pdflatex)') do |engine|
      @@cmd_opts[:engine] = engine
    end

    opts.on('-d', '--display', 'Display the document') do
      @@cmd_opts[:view] = true
    end

    opts.on('-s', '--spell', 'Spell check source files') do
      @@cmd_opts[:spell] = true
    end

    opts.on('-v', '--verbose', 'Enable verbose feedback') do
      @@cmd_opts[:verbose] = true
    end

    opts.on('-V', '--verboser', 'Enable verbose feedback for hboxes') do
      @@cmd_opts[:verbose] = true
      @@cmd_opts[:verboser] = true
    end

    opts.on('-c', '--color', 'Enable colorized feedback') do
      @@cmd_opts[:color] = true
    end

    opts.on('-h', '--help', 'Show this help message') do
      puts opts
      exit 1
    end
  end

  begin
    opts.parse!(args)
  rescue OptionParser::ParseError
    puts opts
    exit 1
  end

  if @@cmd_opts[:spell]
    Rubbr::Spell.new.check
  elsif @@cmd_opts[:view]
    Rubbr::Builder.build
    Rubbr::Viewer.view
  else
    Rubbr::Builder.build
  end
end