Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Undefined variables in a condition results in a syntax error #23

Open
freesh opened this issue Jul 22, 2018 · 0 comments
Open

Undefined variables in a condition results in a syntax error #23

freesh opened this issue Jul 22, 2018 · 0 comments
Assignees
Labels

Comments

@freesh
Copy link
Owner

freesh commented Jul 22, 2018

[Symfony\Component\ExpressionLanguage\SyntaxError]
Variable "gitpush" is not valid around position 19 for expression `gitcommit == 1 && gitpush == 1`.

To prevent this, it would be useful to predefine some variables.

In this case, the variable git-push is created in the "Git ask push" task if the condition "gitcommit=1" is true. But if git-commit is false, git-push will never be created.
Here the example config:

'Git ask push':
  class: \Butler\Task\InputTask
  task: confirmation
  options:
    gitcommit: 'Create initial git commit?'

'Git commit':
  class: \Butler\Task\GitTask
  task: commit
  options:
    message: 'initial commit'
  condition: 'gitcommit == 1'

'Git add remote':
  class: \Butler\Task\GitTask
  task: remoteAdd
  options:
    origin: origin
  condition: 'gitcommit == 1'

'Git ask push':
  class: \Butler\Task\InputTask
  task: confirmation
  options:
    gitpush: 'Execute git push now?'
  condition: 'gitcommit == 1'

'Git push':
  class: \Butler\Task\GitTask
  task: push
  options:
    params:
      - '-u'
    origin: origin
    branch: master
  condition: 'gitpush == 1'
@freesh freesh added the bug label Jul 22, 2018
@freesh freesh self-assigned this Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant