rubbr 1.0.0 → 1.0.1

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.
data/History.txt CHANGED
@@ -1,5 +1,7 @@
1
- == 1.0.0 / 2008-02-01
1
+ == 1.0.1 / 2008-02-10
2
+
3
+ * Many small bugfixes and code refactorings
2
4
 
3
- * 1 major enhancement
4
- * Birthday!
5
+ == 1.0.0 / 2008-02-01
5
6
 
7
+ * First public release
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
- rubbr
2
- by Eivind Uggedal
3
- http://rubbr.rubyforge.org
1
+ = rubbr
2
+
3
+ * http://rubbr.rubyforge.org
4
4
 
5
5
  == DESCRIPTION:
6
6
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- # -*- ruby -*-
2
-
3
1
  require 'rubygems'
4
2
  require 'hoe'
3
+ require 'spec/rake/spectask'
5
4
  require './lib/rubbr.rb'
6
5
 
7
6
  Hoe.new('rubbr', Rubbr::VERSION) do |p|
@@ -15,4 +14,8 @@ Hoe.new('rubbr', Rubbr::VERSION) do |p|
15
14
  p.remote_rdoc_dir = ''
16
15
  end
17
16
 
18
- # vim: syntax=Ruby
17
+ desc "Run all specs"
18
+ Spec::Rake::SpecTask.new('specs') do |t|
19
+ t.spec_opts = ["--format", "specdoc", "--colour"]
20
+ t.spec_files = Dir['specs/*_spec.rb'].sort
21
+ end
data/lib/rubbr.rb CHANGED
@@ -2,7 +2,7 @@ require 'optparse'
2
2
  $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  module Rubbr
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
8
  autoload :Cli, 'rubbr/cli'
@@ -74,7 +74,7 @@ module Rubbr
74
74
  end
75
75
 
76
76
  def spell
77
- Rubbr::Spell.check
77
+ Rubbr::Spell.new.check
78
78
  end
79
79
  end
80
80
  end
data/lib/rubbr/cli.rb CHANGED
@@ -34,5 +34,21 @@ module Rubbr
34
34
  yield
35
35
  STDIN.reopen(old_stdinn)
36
36
  end
37
+
38
+ def executable?(executable)
39
+ disable_stdout do
40
+ @existing = system("which #{executable}")
41
+ end
42
+ @existing
43
+ end
44
+
45
+ def valid_executable(executable)
46
+ if executable?(executable)
47
+ executable
48
+ else
49
+ error "Missing executable #{executable}"
50
+ exit
51
+ end
52
+ end
37
53
  end
38
54
  end
data/lib/rubbr/runner.rb CHANGED
@@ -24,11 +24,7 @@ module Rubbr
24
24
 
25
25
  def initialize(input_file, silent, executable)
26
26
  @input_file = input_file
27
- disable_stdout do
28
- disable_stderr do
29
- @executable = executable if system "which #{executable}"
30
- end
31
- end
27
+ @executable = valid_executable executable
32
28
  @silent = silent
33
29
  @errors = []
34
30
 
@@ -10,11 +10,7 @@ module Rubbr
10
10
  super
11
11
 
12
12
  @name = 'Mercurial'
13
- disable_stdout do
14
- disable_stderr do
15
- @executable = 'hg' if system 'which hg'
16
- end
17
- end
13
+ @executable = valid_executable :hg
18
14
 
19
15
  @revision, @date = parse_scm_stats
20
16
 
@@ -24,7 +20,7 @@ module Rubbr
24
20
  def parse_scm_stats
25
21
  return [nil, nil] unless @executable
26
22
 
27
- raw_stats = `hg tip`
23
+ raw_stats = `#@executable tip`
28
24
  revision = raw_stats.scan(/^changeset: +(.+)/).first.first
29
25
  date = raw_stats.scan(/^date: +(.+)/).first.first
30
26
 
@@ -10,11 +10,7 @@ module Rubbr
10
10
  super
11
11
 
12
12
  @name = 'Subversion'
13
- disable_stdout do
14
- disable_stderr do
15
- @executable = 'svn' if system 'which svn'
16
- end
17
- end
13
+ @executable = valid_executable :svn
18
14
 
19
15
  @revision, @date = parse_scm_stats
20
16
 
@@ -24,7 +20,7 @@ module Rubbr
24
20
  def parse_scm_stats
25
21
  return [nil, nil] unless @executable
26
22
 
27
- raw_stats = `svn info`
23
+ raw_stats = `#@executable info`
28
24
  revision = raw_stats.scan(/^Revision: (\d+)/).first.first
29
25
  date = raw_stats.scan(/^Last Changed Date: (.+)/).first.first
30
26
 
data/lib/rubbr/spell.rb CHANGED
@@ -1,14 +1,19 @@
1
1
  module Rubbr
2
2
  class Spell
3
- def self.check
3
+ include Rubbr::Cli
4
+
5
+ def check
6
+ base_file_path = File.join(Rubbr.options[:source_dir],
7
+ Rubbr.options[:base_latex_file])
4
8
  source_files = Dir["#{Rubbr.options[:source_dir]}/*.tex"]
5
- source_files.delete(File.join(Rubbr.options[:source_dir],
6
- Rubbr.options[:base_latex_file]))
9
+ source_files.delete base_file_path
7
10
 
8
11
  dictionary_path = File.join(Rubbr.options[:spell_dir],
9
12
  Rubbr.options[:spell_file])
13
+ executable = valid_executable(:ispell)
14
+
10
15
  source_files.each do |file|
11
- system "ispell -t -x -p #{dictionary_path} #{file}"
16
+ system "#{executable} -t -x -p #{dictionary_path} #{file}"
12
17
  end
13
18
  end
14
19
  end
data/lib/rubbr/viewer.rb CHANGED
@@ -33,17 +33,13 @@ module Rubbr
33
33
 
34
34
  def find_viewer
35
35
  @executables.each do |executable|
36
- disable_stdout do
37
- disable_stderr do
38
- return executable if system "which #{executable}"
39
- end
40
- end
36
+ return executable if executable? executable
41
37
  end
42
38
  end
43
39
 
44
40
  def launch
45
41
  return unless viewer = find_viewer
46
- system "#{viewer} #{distribution_file}"
42
+ fork { exec "#{viewer} #{distribution_file}" }
47
43
  notice "Display of #@view_name completed for: #{@distribution_name}" +
48
44
  ".#@view_name in #{Rubbr.options[:distribution_dir]}"
49
45
  end
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.0
4
+ version: 1.0.1
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-02-04 00:00:00 +01:00
12
+ date: 2008-02-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -59,7 +59,7 @@ files:
59
59
  - lib/rubbr/viewer/pdf.rb
60
60
  - lib/rubbr/viewer/dvi.rb
61
61
  has_rdoc: true
62
- homepage: Build LaTeX documents.
62
+ homepage: http://rubbr.rubyforge.org
63
63
  post_install_message:
64
64
  rdoc_options:
65
65
  - --main