2

Motivation: I would like to copy a file foo.bar to \jobname.bar before every pdflatex run. So I thought, I could modify an existing arara rule.

I wanted to try the hello.yaml rule for arara from this answer: https://tex.stackexchange.com/a/119246/36296

!config
# Hello world
# author: Chris Hughes, Paulo Cereda
# last edited by: cmh, June 14th 2013
# requires arara 3.0+
#
# Sample usage: 
#
# % arara: hello
# % arara: hello: {name: A.Ellett}
#
# This rule is really just a shortcut for commands like the following
#
#   hello
# or
#   hello A.Ellett
#
identifier: hello
name: hello
commands: 
- <arara> bash -i -c hello @{name}
arguments: 
- identifier: name
  flag: <arara> @{parameters.name}
  default: "world"

But if I try to run this rule with

% arara: hello

in my .tex file, I get the following error message:

I have spotted an error in rule 'hello' located at
'<path to arara>/rules'. I could not parse the rule,
something bad happened. Apparently, the provided YAML file is
invalid. I will do my best to help you in any way I can. There
are more details available on this exception:

DETAILS --------------------------------------------------------- Cannot create property=commands for JavaBean=com.github.cereda.arara.model.Rule@55a1c291 in 'reader', line 1, column 1: !config ^ No single argument constructor found for class com.github.cereda.arara.model.RuleCommand in 'reader', line 21, column 1: - <arara> bash -i -c hello @{name} ^

(I replaced <path to arara> in the above message, as the original one contained my user name; I have other custom .yaml files for arara in the same location which work flawlessly)

The bash function itself seems to work. If I do

bash -i -c hello sam

within a terminal, I get

Hello, sam!

as expected.

I am using arara 4.0. Any ideas what might be wrong?

2 Answers2

4

I think you actually want something like this:

!config
# Hello world
# author: Chris Hughes, Paulo Cereda
# last edited by: cmh, June 14th 2013
# requires arara 3.0+
#
# Sample usage: 
#
# % arara: hello
# % arara: hello: {name: A.Ellett}
#
# This rule is really just a shortcut for commands like the following
#
#   hello
# or
#   hello A.Ellett
#
identifier: hello
name: hello
commands: 
- command: <arara> bash -i -c hello @{name}
arguments: 
- identifier: name
  flag: <arara> @{parameters.name}
  default: "world"
ig0774
  • 1,970
3

Don't you want something like this?

!config
# Hello world
# author: Chris Hughes, Paulo Cereda
# last edited by: cmh, June 14th 2013
# requires arara 3.0+
#
# Sample usage: 
#
# % arara: hello
# % arara: hello: {name: A.Ellett}
#
# This rule is really just a shortcut for commands like the following
#
#   hello
# or
#   hello A.Ellett
#
identifier: hello
name: hello
command: <arara> bash -i -c hello @{name}
arguments:
- identifier: name
  flag: <arara> @{parameters.name}
  default: "world"
# vim: set nospell:
cfr
  • 198,882
  • Thanks a lot for your answer! As far as I can see, your solution works perfectly with arara 3.0, but unfortunately I do get the same error as above with arara 4.0, which I need for my workflow :( – samcarter_is_at_topanswers.xyz Nov 29 '16 at 09:32
  • @samcarter Oh, sorry. I missed that. Where do you get 4.0 from? – cfr Nov 29 '16 at 17:26
  • 1
    Sorry for hiding this information on the bottom of my question. I compiled version 4.0 from its source: https://github.com/cereda/arara . It has all kinds of fantastic new features, see https://github.com/cereda/arara/wiki/New-feature-highlights-in-4.0. Personally I love the ability to check if some files have changed or if the log contains specific strings to trigger compilations. – samcarter_is_at_topanswers.xyz Nov 29 '16 at 17:36