macaw-ruby 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/bin/macaw +20 -16
  4. data/lib/macaw/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 446ef5fb36b1bb4005c7cceee32160c34ee012d6
4
- data.tar.gz: a438e36438422d961cd96efe281440d6b976bccf
3
+ metadata.gz: f6b3e2f788757673145ade623bb24d5e7d38b21d
4
+ data.tar.gz: b1e51aa42b192db8da4cb0c0b0f2801815317fae
5
5
  SHA512:
6
- metadata.gz: 59fe508c6659a6772c96c220927919b732350a0785ae5a883d7d1a6f770711ae29a2ca53a561e5d23aa075200d5cca50390ca6bc1cdf63aadb8a30760c69c77b
7
- data.tar.gz: 3f90abef21b7baa8d917d046e7d4dc0d3f2e4f74260de6ce1119f0456a2d1d034f222716958c71325325f6ea4512c05f5cda8a232ceb778adf832f3e6111fff0
6
+ metadata.gz: ad71d481842a195f1ab73e57f888696e5d745cf1d93939a40f914d46e11d42ab4b2a72a2b8daecfa9c000d1a7580d0bec9315b4a4c73f37c2f4b9e4196458779
7
+ data.tar.gz: 77d4bcb565cfb7626c21f665bcb46b547eee19d81650b761c45d5d74147accd29bc159e99d0495d2e61808ddae4d0e6db1726622e1bd4593c85f47aa02da6029
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- macaw-ruby (0.0.17)
4
+ macaw-ruby (0.0.18)
5
5
  i18n
6
6
  json_pure
7
7
  os
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.run(file)
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(file)
159
- @@log = File.open(@base + '.log') if OPTS[:log]
162
+ macaw = Macaw.new(tex)
163
+ @@log = File.open(@base + '.log') if @@options[:log]
160
164
 
161
- IO.readlines(file).each{|line|
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 OPTS[:timeout]
204
- Timeout::timeout(OPTS[:timeout]) { output = `#{cmd}` }
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 #{OPTS[:timeout]} seconds"
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 OPTS[:verbose]
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(TEX)
227
+ Macaw.run
data/lib/macaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Macaw
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macaw-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns