be9-rubbr 1.1.4.1 → 1.1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -20,6 +20,7 @@ lib/rubbr/runner/pdflatex.rb
20
20
  lib/rubbr/runner/latex.rb
21
21
  lib/rubbr/runner/dvips.rb
22
22
  lib/rubbr/runner/bibtex.rb
23
+ lib/rubbr/scm/git.rb
23
24
  lib/rubbr/scm/subversion.rb
24
25
  lib/rubbr/scm/mercurial.rb
25
26
  lib/rubbr/viewer/ps.rb
data/lib/rubbr/builder.rb CHANGED
@@ -29,10 +29,14 @@ module Rubbr
29
29
 
30
30
  notice "Entering build loop. Press Ctrl-C to break out."
31
31
 
32
+ forced_first_time = Rubbr.options[:force]
33
+
32
34
  while true
33
- if Rubbr::Change.d?
35
+ if Rubbr::Change.d? || forced_first_time
34
36
  notice "Change detected, building"
35
37
 
38
+ forced_first_time = false
39
+
36
40
  do_build
37
41
  end
38
42
 
@@ -56,6 +60,8 @@ module Rubbr
56
60
  Rubbr::Builder::Ps.build
57
61
  end
58
62
  end
63
+ rescue Rubbr::Runner::GotErrors
64
+ notice "There were errors, processing stopped."
59
65
  end
60
66
 
61
67
  class Base
data/lib/rubbr/runner.rb CHANGED
@@ -4,6 +4,8 @@ module Rubbr
4
4
  # information if input files are missing and also cleans up the output of
5
5
  # these utilities.
6
6
  module Runner
7
+ class GotErrors < ::StandardError; end
8
+
7
9
  class Base
8
10
  include Rubbr::Cli
9
11
 
@@ -81,7 +83,8 @@ module Rubbr
81
83
  @errors.each do |message|
82
84
  error message
83
85
  end
84
- exit
86
+
87
+ raise GotErrors
85
88
  end
86
89
  end
87
90
  end
@@ -0,0 +1,32 @@
1
+ module Rubbr
2
+
3
+ # Extracts changeset stats from various SCM systems. This info can be
4
+ # included in the title page of the latex document and is especially helpful
5
+ # when working with draft versions.
6
+ module Scm
7
+ class Git < Base
8
+
9
+ def initialize
10
+ super
11
+
12
+ @name = 'Git'
13
+ @executable = valid_executable :git
14
+
15
+ @revision, @date = parse_scm_stats
16
+
17
+ yield self if block_given?
18
+ end
19
+
20
+ def parse_scm_stats
21
+ return [nil, nil] unless @executable
22
+
23
+ raw_stats = `#@executable show --abbrev-commit --pretty=medium HEAD`
24
+ revision = raw_stats.scan(/^commit ([0-9a-f]+)/).first.first
25
+ date = raw_stats.scan(/^Date: +(.+)/).first.first
26
+
27
+ [revision, date]
28
+ end
29
+ end
30
+ end
31
+ end
32
+
data/lib/rubbr/scm.rb CHANGED
@@ -24,14 +24,20 @@ module Rubbr
24
24
  end
25
25
 
26
26
  def self.stats(dir)
27
- if File.exists? File.join(dir, '.svn')
28
- Rubbr::Scm::Subversion.new.collect_scm_stats
29
- elsif File.exists? File.join(dir, '.hg')
30
- Rubbr::Scm::Mercurial.new.collect_scm_stats
27
+ {
28
+ '.svn' => Rubbr::Scm::Subversion,
29
+ '.hg' => Rubbr::Scm::Mercurial,
30
+ '.git' => Rubbr::Scm::Git
31
+ }.each do |ext, klass|
32
+ if File.exists? File.join(dir, ext)
33
+ return klass.new.collect_scm_stats
34
+ end
31
35
  end
36
+
37
+ nil
32
38
  end
33
39
 
34
- %w(mercurial subversion).each do
40
+ %w(mercurial subversion git).each do
35
41
  |f| require File.dirname(__FILE__) + "/scm/#{f}"
36
42
  end
37
43
  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.1.4.1'
5
+ VERSION = '1.1.4.2'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
8
  autoload :Cli, 'rubbr/cli'
@@ -40,6 +40,10 @@ module Rubbr
40
40
  @@cmd_opts[:engine] = engine
41
41
  end
42
42
 
43
+ opts.on('-n', '--distribution-name NAME', String, 'Set distribution name') do |name|
44
+ @@cmd_opts[:distribution_name] = name
45
+ end
46
+
43
47
  opts.on('-d', '--display', 'Display the document') do
44
48
  @@cmd_opts[:view] = true
45
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: be9-rubbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.1
4
+ version: 1.1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eivind Uggedal
@@ -9,17 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-20 00:00:00 -08:00
12
+ date: 2009-04-30 00:00:00 -07:00
13
13
  default_executable: rubbr
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hoe
17
+ type: :development
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.8.2
23
+ version: 1.12.2
23
24
  version:
24
25
  description: Build LaTeX documents.
25
26
  email: eu@redflavor.com
@@ -54,6 +55,7 @@ files:
54
55
  - lib/rubbr/runner/latex.rb
55
56
  - lib/rubbr/runner/dvips.rb
56
57
  - lib/rubbr/runner/bibtex.rb
58
+ - lib/rubbr/scm/git.rb
57
59
  - lib/rubbr/scm/subversion.rb
58
60
  - lib/rubbr/scm/mercurial.rb
59
61
  - lib/rubbr/viewer/ps.rb
@@ -84,7 +86,7 @@ requirements: []
84
86
  rubyforge_project: rubbr
85
87
  rubygems_version: 1.2.0
86
88
  signing_key:
87
- specification_version: 2
89
+ specification_version: 3
88
90
  summary: LaTeX builder
89
91
  test_files: []
90
92