macaw-ruby 0.0.17 → 0.0.18
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 +4 -4
- data/Gemfile.lock +1 -1
- data/bin/macaw +20 -16
- data/lib/macaw/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b3e2f788757673145ade623bb24d5e7d38b21d
|
4
|
+
data.tar.gz: b1e51aa42b192db8da4cb0c0b0f2801815317fae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad71d481842a195f1ab73e57f888696e5d745cf1d93939a40f914d46e11d42ab4b2a72a2b8daecfa9c000d1a7580d0bec9315b4a4c73f37c2f4b9e4196458779
|
7
|
+
data.tar.gz: 77d4bcb565cfb7626c21f665bcb46b547eee19d81650b761c45d5d74147accd29bc159e99d0495d2e61808ddae4d0e6db1726622e1bd4593c85f47aa02da6029
|
data/Gemfile.lock
CHANGED
data/bin/macaw
CHANGED
@@ -108,13 +108,6 @@ def options!
|
|
108
108
|
options
|
109
109
|
end
|
110
110
|
|
111
|
-
OPTS=options!
|
112
|
-
|
113
|
-
error("No filename to process") if ARGV.size == 0
|
114
|
-
error("Expected exactly one filename to process #{ARGV.inspect}") if ARGV.size != 1
|
115
|
-
TEX = File.file?(ARGV[0]) ? ARGV[0] : ARGV[0] + '.tex'
|
116
|
-
error("#{ARGV[0].inspect} does not exist") if !File.exists?(TEX)
|
117
|
-
|
118
111
|
CONFIGFILE = [File.join(Dir.home, 'araraconfig.yaml'), File.join(Dir.home, '.araraconfig.yaml')].detect{|config| File.file?(config) }
|
119
112
|
CONFIG = CONFIGFILE ? YAML.load_file(CONFIGFILE) : {}
|
120
113
|
|
@@ -153,12 +146,23 @@ class Macaw
|
|
153
146
|
end
|
154
147
|
attr_reader :file, :base
|
155
148
|
|
156
|
-
def self.
|
149
|
+
def self.options
|
150
|
+
@@options ||= options!
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.run
|
154
|
+
@@options=options!
|
155
|
+
|
156
|
+
error("No filename to process") if ARGV.size == 0
|
157
|
+
error("Expected exactly one filename to process #{ARGV.inspect}") if ARGV.size != 1
|
158
|
+
tex = File.file?(ARGV[0]) ? ARGV[0] : ARGV[0] + '.tex'
|
159
|
+
error("#{ARGV[0].inspect} does not exist") if !File.exists?(tex)
|
160
|
+
|
157
161
|
Macaw.load_rules
|
158
|
-
macaw = Macaw.new(
|
159
|
-
@@log = File.open(@base + '.log') if
|
162
|
+
macaw = Macaw.new(tex)
|
163
|
+
@@log = File.open(@base + '.log') if @@options[:log]
|
160
164
|
|
161
|
-
IO.readlines(
|
165
|
+
IO.readlines(tex).each{|line|
|
162
166
|
next unless line =~ /^% arara: /
|
163
167
|
line.strip!
|
164
168
|
line.sub!(/^%\s+arara\s*:\s*/, '')
|
@@ -200,17 +204,17 @@ class Macaw
|
|
200
204
|
|
201
205
|
output = ''
|
202
206
|
begin
|
203
|
-
if
|
204
|
-
Timeout::timeout(
|
207
|
+
if @@options[:timeout]
|
208
|
+
Timeout::timeout(@@options[:timeout]) { output = `#{cmd}` }
|
205
209
|
else
|
206
210
|
output = `#{cmd}`
|
207
211
|
end
|
208
212
|
rescue Timeout::Error
|
209
|
-
throw "#{cmd}: timed out after #{
|
213
|
+
throw "#{cmd}: timed out after #{@@options[:timeout]} seconds"
|
210
214
|
end
|
211
215
|
|
212
216
|
@@log.write(output) if @@log
|
213
|
-
print output if
|
217
|
+
print output if @@options[:verbose]
|
214
218
|
return output if $?.to_i == 0
|
215
219
|
throw "#{cmd}: #{$?}"
|
216
220
|
end
|
@@ -220,4 +224,4 @@ class Macaw
|
|
220
224
|
end
|
221
225
|
end
|
222
226
|
|
223
|
-
Macaw.run
|
227
|
+
Macaw.run
|
data/lib/macaw/version.rb
CHANGED