macaw-ruby 0.0.24 → 0.0.25

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4adb7b466883f1cbd4d365363bb0cde9d264b552
4
- data.tar.gz: 9f35d226538a731497f44f5487fcfc0ab8ba0649
3
+ metadata.gz: 9367e4ac5f8391b4cae45120b4e3a92d1dea8856
4
+ data.tar.gz: 8622c40e5e6d9955757d7a33c0a529f4883d557b
5
5
  SHA512:
6
- metadata.gz: 7dbda8a32b5ed8f294693630fa0692bc59a20d6dd2d9dfb5e0096ab302ec968fef519171c149db8f85713dd9d27793678568cc870e46d46df940a8d884377cae
7
- data.tar.gz: d843862f7bb8c1ceec30b39ece1ffba3bba868f5ed516f0170f848940b30f14b986db749a565ba16b90f09fca898e29f265f6e9103188247c2777a82b9672f38
6
+ metadata.gz: 1fc92de28198a71aa7d523e1b66f733c3db1fbb60c06ed6246c6c6191b9398822e60e639c2a98977c5fc38cd75d7858a2b780a852757ce9afdb502dee8fab240
7
+ data.tar.gz: 8444039f3f2943ef06267742daa413cc643e05af25ac57dfbdfe4cc809774bdd5421b10217ae276ab46165fd5cbf979f0cdf66e23b34e53e6dc52d6730648882
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- macaw-ruby (0.0.24)
4
+ macaw-ruby (0.0.25)
5
5
  i18n
6
6
  json_pure
7
7
  os
data/Rakefile CHANGED
@@ -20,5 +20,7 @@ task :publish do
20
20
  end
21
21
 
22
22
  task :test do
23
- require './lib/macaw'
23
+ sh "cp test/test.tex ."
24
+ sh "./bin/macaw test"
25
+ sh "rm test.*"
24
26
  end
data/bin/macaw CHANGED
@@ -7,6 +7,7 @@ require_relative '../lib/macaw'
7
7
  require_relative '../lib/macaw/version'
8
8
  require 'json/pure'
9
9
  require 'os'
10
+ require 'ostruct'
10
11
  require 'shellwords'
11
12
  require 'optparse'
12
13
  require 'timeout'
@@ -54,7 +55,7 @@ def options!
54
55
  parser.separator ""
55
56
 
56
57
  options[:language] = I18n.default_locale
57
- parser.on('-L', '--language LANG', I18n.t('help.language')){|lang|
58
+ parser.on('-L', '--language LANG', I18n.t('help.Language')){|lang|
58
59
  begin
59
60
  I18n.locale = lang.intern
60
61
  options[:language] = lang.intern
@@ -66,15 +67,18 @@ def options!
66
67
  end
67
68
  }
68
69
 
69
- parser.on('-l', '--log', I18n.t('help.log')) {|v|
70
+ parser.on('-p', '--progress', I18n.t('help.Progress')) {|v|
71
+ options[:progress] = v
72
+ }
73
+ parser.on('-l', '--log', I18n.t('help.Log')) {|v|
70
74
  options[:log] = v
71
75
  }
72
76
 
73
- parser.on('-t', '--timeout SECONDS', I18n.t('help.timeout')){|timeout|
74
- options[:timeout] = Integer(timeout)
77
+ parser.on('-t', '--timeout SECONDS', I18n.t('help.Timeout')){|timeout|
78
+ options[:timeout] = Float(timeout) / 1000
75
79
  }
76
80
 
77
- parser.on('-v', '--verbose', I18n.t('help.verbose')) {|v|
81
+ parser.on('-v', '--verbose', I18n.t('help.Verbose')) {|v|
78
82
  options[:verbose] = v
79
83
  }
80
84
 
@@ -85,7 +89,7 @@ def options!
85
89
  end
86
90
  }
87
91
 
88
- parser.on_tail('-V', '--version', I18n.t('help.version')){
92
+ parser.on_tail('-V', '--version', I18n.t('help.Version')){
89
93
  if !dryrun
90
94
  puts "macaw #{Macaw::VERSION} - #{I18n.t('header.Slogan')}\nCopyright (c) 2012, Paulo Roberto Massa Cereda\n"
91
95
  puts I18n.t('header.AllRightsReserved')
@@ -101,7 +105,7 @@ def options!
101
105
  opts.parse!
102
106
  end
103
107
  }
104
- options
108
+ OpenStruct.new(options)
105
109
  end
106
110
 
107
111
  CONFIGFILE = [File.join(Dir.home, 'araraconfig.yaml'), File.join(Dir.home, '.araraconfig.yaml')].detect{|config| File.file?(config) }
@@ -164,7 +168,7 @@ class Macaw
164
168
  end
165
169
 
166
170
  def self.run
167
- @@options=options!
171
+ @@options ||= options!
168
172
 
169
173
  error("No filename to process") if ARGV.size == 0
170
174
  error("Expected exactly one filename to process #{ARGV.inspect}") if ARGV.size != 1
@@ -173,7 +177,7 @@ class Macaw
173
177
 
174
178
  Macaw.load_rules
175
179
  macaw = Macaw.new(tex)
176
- @@log = File.open(macaw.base + '.log', 'w') if @@options[:log]
180
+ @@log = File.open(macaw.base + '.log', 'w') if @@options.log
177
181
 
178
182
  IO.readlines(tex).each{|line|
179
183
  next unless line =~ /^% arara: /
@@ -213,7 +217,7 @@ class Macaw
213
217
  end
214
218
 
215
219
  def self.log(line, force=false)
216
- puts line if @@options[:verbose] || force
220
+ print (options.progress && !force ? '.' : line + "\n") if @@options.verbose || @@options.progress || force
217
221
  @@log.write(line) if @@log
218
222
  end
219
223
 
@@ -225,7 +229,7 @@ class Macaw
225
229
 
226
230
  output = ''
227
231
  begin
228
- Timeout::timeout(@@options[:timeout] || 0) {
232
+ Timeout::timeout(@@options.timeout || 0) {
229
233
  Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
230
234
  while line = stdout_err.gets
231
235
  self.log(line)
@@ -237,7 +241,7 @@ class Macaw
237
241
  end
238
242
  }
239
243
  rescue Timeout::Error
240
- error "#{cmd}: timed out after #{@@options[:timeout]} seconds" if failonerror
244
+ error "#{cmd}: timed out after #{@@options.timeout} seconds" if failonerror
241
245
  end
242
246
  return output
243
247
  end
@@ -1,13 +1,7 @@
1
1
  ---
2
2
  en:
3
3
  help:
4
- language: set the application language
5
- log: generate a log output
6
- timeout: set execution timeout
7
- verbose: print the command output
8
- version: print the application version
9
4
  usage: Usage
10
- rights: All rights reserved.
11
5
  Version: print the application version
12
6
  Help: print the help message
13
7
  Log: generate a log output
@@ -16,6 +10,7 @@ en:
16
10
  Language: set the application language
17
11
  DryRun: go through all the motions of running a command, but with no actual calls
18
12
  MaximumNumberOfLoops: set the maximum number of loops
13
+ Progress: print dots for progress
19
14
  log:
20
15
  WelcomeMessage: Welcome to arara %{0}!
21
16
  ProcessingFile: Processing file ''%{0}'', please wait.
data/lib/macaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Macaw
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
File without changes
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.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns
@@ -166,7 +166,7 @@ files:
166
166
  - lib/macaw/rules/xetex.rb
167
167
  - lib/macaw/version.rb
168
168
  - macaw.gemspec
169
- - test.tex
169
+ - test/test.tex
170
170
  - test/test_macaw.rb
171
171
  homepage: ''
172
172
  licenses:
@@ -193,4 +193,5 @@ signing_key:
193
193
  specification_version: 4
194
194
  summary: Ruby Arara
195
195
  test_files:
196
+ - test/test.tex
196
197
  - test/test_macaw.rb