0

Given the following tasks.py

from invoke import run, task

@task
def gems():
    print 'Installing Gems'
    run('echo $PWD')
    #run('export GEM_HOME=$PWD && GEM_PATH=$PWD && gem install sass')

@task('gems')
def setup():
    pass

My automation script:

import invoke
import invoke.cli

invoke.cli.parse(['-r', os.path.dirname(__file__), '--list'])

this returns

Available tasks:

  gems
  setup

But when try to execute 'gems' as below:

invoke.cli.parse(['-r', os.path.dirname(__file__), 'gems'])

It is not executing the task

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
James Lin
  • 25,028
  • 36
  • 133
  • 233

1 Answers1

1

Instead of using invoke.cli.parse should use invoke.cli.dispath like:

invoke.cli.dispatch(['-r', os.path.dirname(__file__), 'setup'])
James Lin
  • 25,028
  • 36
  • 133
  • 233