macaw-ruby 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +38 -20
- data/bin/macaw +3 -3
- data/lib/macaw/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 419b4f3eb4d30ade847d09c3cca5271be02a8778
|
4
|
+
data.tar.gz: 5d94f419c91aebda33ca2ab0f5f4b771b1793844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cf56c902c48414fef468b631854ba55fe25a53688f6aa56039ac39b251d01bc48bc159c9c5436c718455596b89c20e9b64d69034c2f5a29ad1f107123f6376
|
7
|
+
data.tar.gz: ef08fbafe0d4723286c203650bf3d50a3494d1e8643e311d9662aa7e86c42621436ae7c46139a607552ce8b36fcd8f6b8ab8d886be63166e4a06ae63162dd857
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,47 @@
|
|
1
1
|
# Macaw
|
2
2
|
|
3
|
-
|
3
|
+
Macaw is a Ruby Arara, a Ruby port of http://cereda.github.io/arara/. This is in many aspects very rough around the
|
4
|
+
edges at this moment as it was written in a weekend while I was busy doing other things. Ruby does rock.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
7
|
-
|
8
|
+
To install, make sure you have Ruby 1.9 or later installed, and then (on a command line, sorry) type
|
8
9
|
|
9
|
-
gem
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install macaw
|
10
|
+
gem install macaw-ruby
|
18
11
|
|
19
12
|
## Usage
|
20
13
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
14
|
+
In day-to-day use it will (should) behave exactly like arara. It accepts the same command line parameters and reads the
|
15
|
+
same *standard* rules that are bundled with arara; if you use only those, there's no need to change anything in your
|
16
|
+
LaTeX documents.
|
17
|
+
|
18
|
+
## Custom rules
|
19
|
+
|
20
|
+
Macaw doesn't use yaml for its rules; rules are Ruby scripts. Macaw will read your araraconfig.yaml to find the paths to
|
21
|
+
your custom rules; in that location, you can drop files that end in '.rb', which are structured like this:
|
22
|
+
|
23
|
+
class Macaw # this line is mandatory
|
24
|
+
# define your macaw rule here. The name after 'def' is the name of your rule, the options between parenthesis are yor
|
25
|
+
# parameters. Optional parameters are marked using '=nil' (and for those of you who know ruby, this looks familiar but
|
26
|
+
# behaves oddly; using anything else than 'nil' will likewise make the parameter optional, but you will *always* be
|
27
|
+
# passed 'nil' if the arara rule in the tex file did not pass the parameters).
|
28
|
+
def zoterobib(collection, format=nil, port=nil, exportCharset=nil, exportNotes=nil, useJournalAbbreviation=nil)
|
29
|
+
# ||= assigns a value if it wasn't set; set your default values here
|
30
|
+
format ||= 'biblatex'
|
31
|
+
port ||= 23119
|
32
|
+
|
33
|
+
# this adds the optional parameters to the url
|
34
|
+
params = []
|
35
|
+
params << "&exportCharset=#{exportCharset}" if exportCharset
|
36
|
+
params << "&exportNotes=#{exportNotes}" if exportNotes
|
37
|
+
params << "&useJournalAbbreviation=#{useJournalAbbreviation}" if useJournalAbbreviation
|
38
|
+
|
39
|
+
# the ~ is a Macaw feature -- it will escape the path of the string after it to be safe to be passed on the command
|
40
|
+
# line. It will do the right thing depending on the platform it's being run on.
|
41
|
+
bib = ~"#{@base}.bib"
|
42
|
+
url = ~"http://localhost:#{port}/better-bibtex/collection?#{collection}.#{format}#{params}"
|
43
|
+
|
44
|
+
# Macaw.system executes the command, captures output, does logging, etc
|
45
|
+
Macaw.system "curl --connect-timeout 5 -z #{bib} -o #{bib} #{url}"
|
46
|
+
end
|
47
|
+
end
|
data/bin/macaw
CHANGED
@@ -204,7 +204,7 @@ class Macaw
|
|
204
204
|
@@log
|
205
205
|
end
|
206
206
|
|
207
|
-
def self.system(cmd)
|
207
|
+
def self.system(cmd, failonerror=true)
|
208
208
|
cmd = cmd.compact.join(' ') if cmd.is_a?(Array)
|
209
209
|
puts cmd
|
210
210
|
|
@@ -219,11 +219,11 @@ class Macaw
|
|
219
219
|
end
|
220
220
|
|
221
221
|
exit_status = wait_thr.value
|
222
|
-
error "cmd failed: #{cmd}" unless exit_status.success?
|
222
|
+
error "cmd failed: #{cmd}" unless exit_status.success? && failonerror
|
223
223
|
end
|
224
224
|
}
|
225
225
|
rescue Timeout::Error
|
226
|
-
error "#{cmd}: timed out after #{@@options[:timeout]} seconds"
|
226
|
+
error "#{cmd}: timed out after #{@@options[:timeout]} seconds" if failonerror
|
227
227
|
end
|
228
228
|
return output
|
229
229
|
end
|
data/lib/macaw/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macaw-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emiliano Heyns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|