be9-rubbr 1.1.5.1 → 1.1.6

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0b57872d6ba8780b0229d9879dab0eed67355b78
4
+ data.tar.gz: 96a580184bf479f509cfb222bb579133d6ca4ba9
5
+ SHA512:
6
+ metadata.gz: 8433e6b380a2798f2792687135ea730dcdcd27bf209d05bf5b9d88b1ec79219f1fdc9538f748fe15b5150f6035d346a4ce29010cab651e9bcc912ab94c696bff
7
+ data.tar.gz: 1e628b53adc71e2ca0b17d289b37af3c30eab064a0738abf9caa4446ed58467fdcd917730cab51d8df9a0972f1c5f80ab35b6ac001f6384030ea4f643623d5a4
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+
2
+ == 1.1.6 / 2013-05-03 (by be9)
3
+
4
+ * Windows support (cypok)
5
+ * Modern Ruby support (cypok)
6
+ * Support force rebuild in a build loop (cypok)
7
+ * Remove duplication of warnings (cypok)
8
+
1
9
  == 1.1.5 / 2010-08-05 (by be9)
2
10
 
3
11
  * Consider .sty files as source, .pdf files as graphics source.
data/lib/rubbr/builder.rb CHANGED
@@ -18,30 +18,57 @@ module Rubbr
18
18
  elsif Rubbr.options[:force]
19
19
  notice "No changes in #{Rubbr.options[:build_dir]} since last build, building anyway (--force)"
20
20
  do_build
21
- else
21
+ else
22
22
  notice "No changes in #{Rubbr.options[:build_dir]} since last build"
23
23
  true
24
24
  end
25
25
  end
26
26
 
27
27
  def self.build_in_a_loop
28
+ # single interrupt to rebuild, double to break
29
+ # inspired by autotest
30
+ interrupted = false
31
+ wants_to_break = false
32
+ force_rebuild = false
33
+ trap 'INT' do
34
+ if interrupted
35
+ wants_to_break = true
36
+ else
37
+ interrupted = true
38
+ notice "Press Ctrl-C a second time to break out."
39
+ Kernel.sleep 1
40
+ end
41
+ raise Interrupt, nil
42
+ end
43
+
28
44
  delay = Rubbr.options[:loop_delay]
29
45
  delay = 0.5 if delay == 0.0
30
46
 
31
- notice "Entering build loop. Press Ctrl-C to break out."
47
+ notice "Entering build loop. Press Ctrl-C to force rebuild, double Ctrl-C to break out."
32
48
 
33
49
  forced_first_time = Rubbr.options[:force]
34
50
 
35
- while true
36
- if Rubbr::Change.d? || forced_first_time
37
- notice "Change detected, building"
51
+ loop do
52
+ begin
53
+ if Rubbr::Change.d? || forced_first_time || force_rebuild
54
+ notice "Building..."
38
55
 
39
- forced_first_time = false
56
+ forced_first_time = false
57
+ force_rebuild = false
40
58
 
41
- do_build
42
- end
59
+ do_build
60
+ end
43
61
 
44
- sleep delay
62
+ sleep delay
63
+ rescue Interrupt
64
+ if wants_to_break
65
+ break
66
+ else
67
+ interrupted = false
68
+ wants_to_break = false
69
+ force_rebuild = true
70
+ end
71
+ end
45
72
  end
46
73
  end
47
74
 
data/lib/rubbr/cli.rb CHANGED
@@ -2,6 +2,8 @@ module Rubbr
2
2
 
3
3
  # Handles command line output and input.
4
4
  module Cli
5
+ include Rubbr::OS
6
+
5
7
  def notice(message)
6
8
  puts color?(message, "\e[32m") if Rubbr.options[:verbose]
7
9
  end
@@ -20,28 +22,28 @@ module Rubbr
20
22
 
21
23
  def disable_stdout
22
24
  old_stdout = STDOUT.dup
23
- STDOUT.reopen('/dev/null')
25
+ STDOUT.reopen(null_file)
24
26
  yield
25
27
  STDOUT.reopen(old_stdout)
26
28
  end
27
29
 
28
30
  def disable_stderr
29
31
  old_stderr = STDERR.dup
30
- STDERR.reopen('/dev/null')
32
+ STDERR.reopen(null_file)
31
33
  yield
32
34
  STDERR.reopen(old_stderr)
33
35
  end
34
36
 
35
37
  def disable_stdinn
36
38
  old_stdinn = STDIN.dup
37
- STDIN.reopen('/dev/null')
39
+ STDIN.reopen(null_file)
38
40
  yield
39
41
  STDIN.reopen(old_stdinn)
40
42
  end
41
43
 
42
44
  def executable?(executable)
43
45
  disable_stdout do
44
- @existing = system("which #{executable}")
46
+ @existing = system("#{which_cmd} #{executable}")
45
47
  end
46
48
  @existing
47
49
  end
@@ -54,5 +56,25 @@ module Rubbr
54
56
  exit
55
57
  end
56
58
  end
59
+
60
+ private
61
+
62
+ def null_file
63
+ case os
64
+ when :windows
65
+ 'NUL'
66
+ when :unix
67
+ '/dev/null'
68
+ end
69
+ end
70
+
71
+ def which_cmd
72
+ case os
73
+ when :windows
74
+ 'where'
75
+ when :unix
76
+ 'which'
77
+ end
78
+ end
57
79
  end
58
80
  end
data/lib/rubbr/os.rb ADDED
@@ -0,0 +1,13 @@
1
+ module Rubbr
2
+
3
+ # Detection of OS.
4
+ module OS
5
+ def os
6
+ if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM)
7
+ :windows
8
+ else
9
+ :unix
10
+ end
11
+ end
12
+ end
13
+ end
data/lib/rubbr/runner.rb CHANGED
@@ -45,7 +45,7 @@ module Rubbr
45
45
 
46
46
  run = `#@executable #@input_file`
47
47
  lines = run.split("\n")
48
- @warnings = run.grep(messages).sort
48
+ @warnings = lines.grep(messages).sort.uniq
49
49
 
50
50
  if Rubbr.options[:verboser]
51
51
 
@@ -83,7 +83,7 @@ module Rubbr
83
83
  @errors.each do |message|
84
84
  error message
85
85
  end
86
-
86
+
87
87
  raise GotErrors
88
88
  end
89
89
  end
data/lib/rubbr.rb CHANGED
@@ -2,9 +2,10 @@ require 'optparse'
2
2
  $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  module Rubbr
5
- VERSION = '1.1.5.1'
5
+ VERSION = '1.1.6'
6
6
 
7
7
  autoload :Options, 'rubbr/options'
8
+ autoload :OS, 'rubbr/os'
8
9
  autoload :Cli, 'rubbr/cli'
9
10
  autoload :Config, 'rubbr/config'
10
11
  autoload :Scm, 'rubbr/scm'
metadata CHANGED
@@ -1,36 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: be9-rubbr
3
- version: !ruby/object:Gem::Version
4
- hash: 65
5
- prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 5
10
- - 1
11
- version: 1.1.5.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.6
12
5
  platform: ruby
13
- authors:
6
+ authors:
14
7
  - Eivind Uggedal
15
8
  - Oleg Dashevskii
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2011-04-14 00:00:00 +07:00
21
- default_executable:
12
+ date: 2013-06-03 00:00:00.000000000 Z
22
13
  dependencies: []
23
-
24
14
  description: Build LaTeX documents.
25
- email:
15
+ email:
26
16
  - olegdashevskii@gmail.com
27
- executables:
17
+ executables:
28
18
  - rubbr
29
19
  extensions: []
30
-
31
20
  extra_rdoc_files: []
32
-
33
- files:
21
+ files:
34
22
  - .gitignore
35
23
  - Gemfile
36
24
  - History.txt
@@ -46,6 +34,7 @@ files:
46
34
  - lib/rubbr/change.rb
47
35
  - lib/rubbr/cli.rb
48
36
  - lib/rubbr/options.rb
37
+ - lib/rubbr/os.rb
49
38
  - lib/rubbr/runner.rb
50
39
  - lib/rubbr/runner/bibtex.rb
51
40
  - lib/rubbr/runner/dvips.rb
@@ -62,39 +51,27 @@ files:
62
51
  - lib/rubbr/viewer/pdf.rb
63
52
  - lib/rubbr/viewer/ps.rb
64
53
  - rubbr.gemspec
65
- has_rdoc: true
66
54
  homepage: http://github.com/be9/rubbr
67
55
  licenses: []
68
-
56
+ metadata: {}
69
57
  post_install_message:
70
58
  rdoc_options: []
71
-
72
- require_paths:
59
+ require_paths:
73
60
  - lib
74
- required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
92
71
  requirements: []
93
-
94
72
  rubyforge_project: rubbr
95
- rubygems_version: 1.6.2
73
+ rubygems_version: 2.0.3
96
74
  signing_key:
97
- specification_version: 3
75
+ specification_version: 4
98
76
  summary: LaTeX builder
99
77
  test_files: []
100
-