rubbr 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 1.0.5 / 2008-03-30
2
+
3
+ * Small bugfixes and no default output on successful builds.
4
+
1
5
  == 1.0.4 / 2008-03-07
2
6
 
3
7
  * Added support for the pdflatex engine.
@@ -2,7 +2,7 @@ require 'optparse'
2
2
  $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  module Rubbr
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
8
  autoload :Cli, 'rubbr/cli'
@@ -15,34 +15,37 @@ module Rubbr
15
15
  autoload :Spell, 'rubbr/spell'
16
16
 
17
17
  class << self
18
- # Setting up an options accessor.
18
+ @@cmd_opts = {}
19
+
19
20
  def options
20
- @@options ||= Rubbr::Options.setup
21
+ @@global_opts ||= Rubbr::Options.setup.merge(@@cmd_opts)
21
22
  end
22
23
 
23
24
  def run(args = ARGV)
24
- options = {}
25
-
26
25
  opts = OptionParser.new do |opts|
27
26
  opts.version = Rubbr::VERSION
28
- opts.banner = 'Usage: rubbr [options]'
27
+ opts.banner = 'Usage: rubbr [@@cmd_opts]'
29
28
 
30
29
  opts.on('-f', '--format [FORMAT]', [:dvi, :ps, :pdf],
31
30
  'Select output format (dvi, ps, pdf)') do |format|
32
- options[:format] = format
31
+ @@cmd_opts[:format] = format
33
32
  end
34
33
 
35
34
  opts.on('-e', '--engine [ENGINE]', [:pdflatex, :ps, :pdf],
36
35
  'Select processing engine (latex, pdflatex)') do |engine|
37
- options[:engine] = engine
36
+ @@cmd_opts[:engine] = engine
38
37
  end
39
38
 
40
- opts.on('-v', '--view', 'View the document') do
41
- options[:view] = true
39
+ opts.on('-d', '--display', 'Display the document') do
40
+ @@cmd_opts[:view] = true
42
41
  end
43
42
 
44
43
  opts.on('-s', '--spell', 'Spell check source files') do
45
- options[:spell] = true
44
+ @@cmd_opts[:spell] = true
45
+ end
46
+
47
+ opts.on('-v', '--verbose', 'Enable verbose feedback') do
48
+ @@cmd_opts[:verbose] = true
46
49
  end
47
50
 
48
51
  opts.on('-h', '--help', 'Show this help message') do
@@ -58,32 +61,14 @@ module Rubbr
58
61
  exit 1
59
62
  end
60
63
 
61
- if options[:spell]
62
- spell
63
- elsif options[:view]
64
- view(options[:format], options[:engine])
64
+ if @@cmd_opts[:spell]
65
+ Rubbr::Spell.new.check
66
+ elsif @@cmd_opts[:view]
67
+ Rubbr::Builder.build
68
+ Rubbr::Viewer.view
65
69
  else
66
- build(options[:format], options[:engine])
70
+ Rubbr::Builder.build
67
71
  end
68
72
  end
69
-
70
- private
71
-
72
- def build(format, engine)
73
- if engine
74
- Rubbr::Builder.build(format, engine)
75
- else
76
- Rubbr::Builder.build(format)
77
- end
78
- end
79
-
80
- def view(format, engine)
81
- build(format, engine)
82
- Rubbr::Viewer.view(format)
83
- end
84
-
85
- def spell
86
- Rubbr::Spell.new.check
87
- end
88
73
  end
89
74
  end
@@ -11,16 +11,18 @@ module Rubbr
11
11
  module Builder
12
12
 
13
13
  # Build to the spesified format.
14
- def self.build(format = :pdf, engine = :latex)
15
- case format
16
- when :dvi
14
+ def self.build
15
+ if Rubbr.options[:engine] == :pdflatex
17
16
  Rubbr::Builder::Tex.build
18
- when :ps
19
- Rubbr::Builder::Tex.build
20
- Rubbr::Builder::Dvi.build
21
17
  else
22
- Rubbr::Builder::Tex.build(engine)
23
- if engine == :latex
18
+ case Rubbr.options[:format]
19
+ when :dvi
20
+ Rubbr::Builder::Tex.build
21
+ when :ps
22
+ Rubbr::Builder::Tex.build
23
+ Rubbr::Builder::Dvi.build
24
+ else
25
+ Rubbr::Builder::Tex.build
24
26
  Rubbr::Builder::Dvi.build
25
27
  Rubbr::Builder::Ps.build
26
28
  end
@@ -2,20 +2,20 @@ module Rubbr
2
2
  module Builder
3
3
  class Tex < Base
4
4
  class << self
5
- def build(engine = :latex)
5
+ def build
6
6
 
7
7
  clean_build_dir
8
8
 
9
9
  base_latex_file = Rubbr.options[:base_latex_file]
10
10
  base_bibtex_file = Rubbr.options[:base_bibtex_file]
11
11
 
12
- case engine
13
- when :latex
14
- @output_format = :dvi
15
- preprocessor = Rubbr::Runner::LaTeX
12
+ case Rubbr.options[:engine]
16
13
  when :pdflatex
17
14
  @output_format = :pdf
18
15
  preprocessor = Rubbr::Runner::PdfLaTeX
16
+ else
17
+ @output_format = :dvi
18
+ preprocessor = Rubbr::Runner::LaTeX
19
19
  end
20
20
 
21
21
  build_dir do
@@ -3,11 +3,11 @@ module Rubbr
3
3
  # Handles command line output and input.
4
4
  module Cli
5
5
  def notice(message)
6
- puts message
6
+ puts message if Rubbr.options[:verbose]
7
7
  end
8
8
 
9
9
  def warning(message)
10
- puts " - #{message}"
10
+ puts " - #{message}" if Rubbr.options[:verbose]
11
11
  end
12
12
 
13
13
  def error(message)
@@ -11,13 +11,15 @@ module Rubbr
11
11
  :source_dir => source_dir,
12
12
  :build_dir => 'tmp',
13
13
  :distribution_dir => 'dist',
14
- :template_file => 'template.erb',
15
14
  :base_file => 'base',
16
15
  :vendor_dir => source_dir + '/vendor',
17
16
  :graphics_dir => source_dir + '/graphics',
18
17
  :spell_dir => source_dir,
19
18
  :spell_file => 'dictionary.ispell',
20
- :distribution_name => distribution_name(root_dir)
19
+ :distribution_name => distribution_name(root_dir),
20
+ :verbose => false,
21
+ :format => :dvi,
22
+ :engine => :latex
21
23
  }
22
24
  end
23
25
 
@@ -49,16 +51,11 @@ module Rubbr
49
51
  end
50
52
 
51
53
  def absolute_paths(options)
52
- relatives = %w(source_dir
53
- build_dir
54
- distribution_dir
55
- template_file
56
- vendor_dir
57
- graphics_dir
58
- spell_dir)
59
- relatives.each do |key|
60
- options[key.to_sym] = File.join(options[:root_dir],
61
- options[key.to_sym])
54
+ options.each_key do |key|
55
+ if key.to_s =~ /\w+_dir/ && key != :root_dir
56
+ options[key.to_sym] = File.join(options[:root_dir],
57
+ options[key.to_sym])
58
+ end
62
59
  end
63
60
  options
64
61
  end
@@ -2,14 +2,18 @@ module Rubbr
2
2
  module Viewer
3
3
 
4
4
  # View the spesified format.
5
- def self.view(format)
6
- case format
7
- when :dvi
8
- Rubbr::Viewer::Dvi.new.launch
9
- when :ps
10
- Rubbr::Viewer::Ps.new.launch
11
- else
5
+ def self.view
6
+ if Rubbr.options[:engine] == :pdflatex
12
7
  Rubbr::Viewer::Pdf.new.launch
8
+ else
9
+ case Rubbr.options[:format]
10
+ when :dvi
11
+ Rubbr::Viewer::Dvi.new.launch
12
+ when :ps
13
+ Rubbr::Viewer::Ps.new.launch
14
+ else
15
+ Rubbr::Viewer::Pdf.new.launch
16
+ end
13
17
  end
14
18
  end
15
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eivind Uggedal
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-07 00:00:00 +01:00
12
+ date: 2008-03-29 23:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.5.0
22
+ version: 1.5.1
23
23
  version:
24
24
  description: Build LaTeX documents.
25
25
  email: eu@redflavor.com