macaw-ruby 0.0.18 → 0.0.19
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 +22 -13
- 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: c924522b0283dc29571bc610015ed14f39a88024
|
4
|
+
data.tar.gz: 4350884eaf96add772061ee3b8f7cecec9c6cbc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a37bdfbaecbe3bf47e4d0f3af81c00de84dd742dd121168908dfa1fd349c4eec3e082361fbbca97f8e97cb80d8e70108b93c9ab8b45178347db4d805e0028ec
|
7
|
+
data.tar.gz: 422d2e6cca6dee464f04d2978e64c1fe15b14eb11e7e6b1713a9343f55cb9b9f63c6bc2fbf7eb1b57780b5842427d2984057f0418f27c3ff788682643947cd40
|
data/Gemfile.lock
CHANGED
data/bin/macaw
CHANGED
@@ -11,9 +11,11 @@ require 'shellwords'
|
|
11
11
|
require 'optparse'
|
12
12
|
require 'timeout'
|
13
13
|
require 'i18n'
|
14
|
+
require 'open3'
|
14
15
|
|
15
16
|
def error(msg)
|
16
|
-
puts msg
|
17
|
+
puts "\n\n#{msg}"
|
18
|
+
Macaw.log.close if Macaw.log
|
17
19
|
exit 1
|
18
20
|
end
|
19
21
|
|
@@ -160,7 +162,7 @@ class Macaw
|
|
160
162
|
|
161
163
|
Macaw.load_rules
|
162
164
|
macaw = Macaw.new(tex)
|
163
|
-
@@log = File.open(
|
165
|
+
@@log = File.open(macaw.base + '.log', 'w') if @@options[:log]
|
164
166
|
|
165
167
|
IO.readlines(tex).each{|line|
|
166
168
|
next unless line =~ /^% arara: /
|
@@ -198,25 +200,32 @@ class Macaw
|
|
198
200
|
}
|
199
201
|
end
|
200
202
|
|
203
|
+
def self.log
|
204
|
+
@@log
|
205
|
+
end
|
206
|
+
|
201
207
|
def self.system(cmd)
|
202
208
|
cmd = cmd.compact.join(' ') if cmd.is_a?(Array)
|
203
209
|
puts cmd
|
204
210
|
|
205
211
|
output = ''
|
206
212
|
begin
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
213
|
+
Timeout::timeout(@@options[:timeout] || 0) {
|
214
|
+
Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
|
215
|
+
while line = stdout_err.gets
|
216
|
+
puts line if @@options[:verbose]
|
217
|
+
@@log.write(line) if @@log
|
218
|
+
output += line + "\n"
|
219
|
+
end
|
220
|
+
|
221
|
+
exit_status = wait_thr.value
|
222
|
+
error "cmd failed: #{cmd}" unless exit_status.success?
|
223
|
+
end
|
224
|
+
}
|
212
225
|
rescue Timeout::Error
|
213
|
-
|
226
|
+
error "#{cmd}: timed out after #{@@options[:timeout]} seconds"
|
214
227
|
end
|
215
|
-
|
216
|
-
@@log.write(output) if @@log
|
217
|
-
print output if @@options[:verbose]
|
218
|
-
return output if $?.to_i == 0
|
219
|
-
throw "#{cmd}: #{$?}"
|
228
|
+
return output
|
220
229
|
end
|
221
230
|
|
222
231
|
def self.load_rules
|
data/lib/macaw/version.rb
CHANGED