trex 1.0.1 → 1.0.2
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/lib/trex.rb +25 -64
- metadata +14 -3
data/lib/trex.rb
CHANGED
@@ -38,6 +38,26 @@ require 'ostruct'
|
|
38
38
|
require 'date'
|
39
39
|
require 'logger'
|
40
40
|
require 'open3'
|
41
|
+
require 'term/ansicolor'
|
42
|
+
|
43
|
+
class String
|
44
|
+
include Term::ANSIColor
|
45
|
+
|
46
|
+
def error(exitValue=nil)
|
47
|
+
puts self.red.bold
|
48
|
+
exit exitValue unless exitValue.nil?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def color_terminal?
|
53
|
+
return true if STDOUT.isatty
|
54
|
+
[/linux/, /xterm.*/, /rxvt.*/].each { |m|
|
55
|
+
return true if ENV['TERM'] =~ m
|
56
|
+
}
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
|
60
|
+
Term::ANSIColor::coloring = color_terminal?
|
41
61
|
|
42
62
|
#require 'ruby-debug19'
|
43
63
|
#Debugger.start(:post_mortem => true)
|
@@ -94,7 +114,7 @@ class TReX
|
|
94
114
|
self.source! @options.source
|
95
115
|
end
|
96
116
|
return if File.exist?(@options.source)
|
97
|
-
print "File doesn't exist: ".
|
117
|
+
print "File doesn't exist: ".red.bold, @options.source, "\n"
|
98
118
|
exit 1
|
99
119
|
end
|
100
120
|
|
@@ -343,7 +363,7 @@ class TReX
|
|
343
363
|
missing.push(c) unless self.has_command? c
|
344
364
|
}
|
345
365
|
if not missing.empty?
|
346
|
-
print 'Missing commands for running the script: '.
|
366
|
+
print 'Missing commands for running the script: '.red.bold
|
347
367
|
puts missing.join(', ')
|
348
368
|
if RUBY_PLATFORM.include? "linux"
|
349
369
|
puts 'install latex with your favorite package manager'
|
@@ -589,7 +609,7 @@ class TexWarning
|
|
589
609
|
end
|
590
610
|
self.sort
|
591
611
|
limit = [@limit, @errors.size].min
|
592
|
-
str = @name.
|
612
|
+
str = @name.red.bold + " [#{@errors.size}]: "
|
593
613
|
str += "\n" #if self.size > 1 and limit > 0
|
594
614
|
limit.times { |i|
|
595
615
|
str += " #{self.format_error(@errors[i][0], @errors[i][1])}\n"
|
@@ -635,6 +655,7 @@ class TexWarning
|
|
635
655
|
end
|
636
656
|
end
|
637
657
|
|
658
|
+
# ============================================================================
|
638
659
|
class FilenameParser
|
639
660
|
|
640
661
|
def initialize
|
@@ -695,6 +716,7 @@ class FilenameParser
|
|
695
716
|
end
|
696
717
|
end
|
697
718
|
|
719
|
+
# ============================================================================
|
698
720
|
class OtherWarning < TexWarning
|
699
721
|
def initialize(limits=10)
|
700
722
|
super('Other Warnings', /LaTeX Warning:/,
|
@@ -884,66 +906,5 @@ class TexError < TexWarning
|
|
884
906
|
return "-"
|
885
907
|
end
|
886
908
|
end
|
887
|
-
# ===========================================================================
|
888
|
-
|
889
|
-
def color_terminal?
|
890
|
-
[/linux/, /xterm.*/, /rxvt.*/].each { |m|
|
891
|
-
return true if ENV['TERM'] =~ m
|
892
|
-
}
|
893
|
-
return false
|
894
|
-
end
|
895
|
-
|
896
|
-
def colorize(text, color_code)
|
897
|
-
return "\033#{color_code}#{text}\033[0m" if color_terminal?()
|
898
|
-
return text
|
899
|
-
end
|
900
|
-
|
901
|
-
class String
|
902
|
-
def error(exitValue=nil)
|
903
|
-
puts self.redb
|
904
|
-
exit exitValue unless exitValue.nil?
|
905
|
-
end
|
906
|
-
|
907
|
-
def red
|
908
|
-
colorize(self, "[31m")
|
909
|
-
end
|
910
|
-
|
911
|
-
def redb
|
912
|
-
colorize(self, "[31;1m")
|
913
|
-
end
|
914
|
-
|
915
|
-
def green
|
916
|
-
colorize(self, "[32m")
|
917
|
-
end
|
918
|
-
|
919
|
-
def greenb
|
920
|
-
colorize(self, "[32;1m")
|
921
|
-
end
|
922
|
-
|
923
|
-
def yellow
|
924
|
-
colorize(self, "[33m")
|
925
|
-
end
|
926
|
-
|
927
|
-
def yellowb
|
928
|
-
colorize(self, "[33;1m")
|
929
|
-
end
|
930
|
-
|
931
|
-
def pink
|
932
|
-
colorize(self, "[35m")
|
933
|
-
end
|
934
|
-
|
935
|
-
def pinkb
|
936
|
-
colorize(self, "[35;1m")
|
937
|
-
end
|
938
|
-
|
939
|
-
def cyan
|
940
|
-
colorize(self, "[36m")
|
941
|
-
end
|
942
|
-
|
943
|
-
def cyanb
|
944
|
-
colorize(self, "[36;1m")
|
945
|
-
end
|
946
|
-
|
947
|
-
end
|
948
909
|
|
949
910
|
# vim: set ts=4 sw=4 ts=4 :
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,18 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
date: 2012-01-20 00:00:00.000000000 Z
|
15
|
-
dependencies:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: term-ansicolor
|
18
|
+
requirement: &70175689076840 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.7
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *70175689076840
|
16
27
|
description: trex is script simplifying the compilation of latex files by creating
|
17
28
|
proper human-readable error output with repeating patterns. Unlike the original
|
18
29
|
latex output which is oververbosified.
|
@@ -44,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
55
|
version: '0'
|
45
56
|
requirements: []
|
46
57
|
rubyforge_project:
|
47
|
-
rubygems_version: 1.8.
|
58
|
+
rubygems_version: 1.8.15
|
48
59
|
signing_key:
|
49
60
|
specification_version: 3
|
50
61
|
summary: Automate compilation of LaTeX documents, making the output human-readable.
|