|
|
@ -37,6 +37,12 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: no
|
|
|
|
default: no
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
|
|
|
|
production:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Install with --production flag
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: no
|
|
|
|
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
path:
|
|
|
|
path:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The base path where to install the bower packages
|
|
|
|
- The base path where to install the bower packages
|
|
|
@ -76,6 +82,7 @@ class Bower(object):
|
|
|
|
self.module = module
|
|
|
|
self.module = module
|
|
|
|
self.name = kwargs['name']
|
|
|
|
self.name = kwargs['name']
|
|
|
|
self.offline = kwargs['offline']
|
|
|
|
self.offline = kwargs['offline']
|
|
|
|
|
|
|
|
self.production = kwargs['production']
|
|
|
|
self.path = kwargs['path']
|
|
|
|
self.path = kwargs['path']
|
|
|
|
self.version = kwargs['version']
|
|
|
|
self.version = kwargs['version']
|
|
|
|
|
|
|
|
|
|
|
@ -94,6 +101,9 @@ class Bower(object):
|
|
|
|
if self.offline:
|
|
|
|
if self.offline:
|
|
|
|
cmd.append('--offline')
|
|
|
|
cmd.append('--offline')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.production:
|
|
|
|
|
|
|
|
cmd.append('--production')
|
|
|
|
|
|
|
|
|
|
|
|
# If path is specified, cd into that path and run the command.
|
|
|
|
# If path is specified, cd into that path and run the command.
|
|
|
|
cwd = None
|
|
|
|
cwd = None
|
|
|
|
if self.path:
|
|
|
|
if self.path:
|
|
|
@ -144,6 +154,7 @@ def main():
|
|
|
|
arg_spec = dict(
|
|
|
|
arg_spec = dict(
|
|
|
|
name=dict(default=None),
|
|
|
|
name=dict(default=None),
|
|
|
|
offline=dict(default='no', type='bool'),
|
|
|
|
offline=dict(default='no', type='bool'),
|
|
|
|
|
|
|
|
production=dict(default='no', type='bool'),
|
|
|
|
path=dict(required=True),
|
|
|
|
path=dict(required=True),
|
|
|
|
state=dict(default='present', choices=['present', 'absent', 'latest', ]),
|
|
|
|
state=dict(default='present', choices=['present', 'absent', 'latest', ]),
|
|
|
|
version=dict(default=None),
|
|
|
|
version=dict(default=None),
|
|
|
@ -154,6 +165,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
name = module.params['name']
|
|
|
|
name = module.params['name']
|
|
|
|
offline = module.params['offline']
|
|
|
|
offline = module.params['offline']
|
|
|
|
|
|
|
|
production = module.params['production']
|
|
|
|
path = os.path.expanduser(module.params['path'])
|
|
|
|
path = os.path.expanduser(module.params['path'])
|
|
|
|
state = module.params['state']
|
|
|
|
state = module.params['state']
|
|
|
|
version = module.params['version']
|
|
|
|
version = module.params['version']
|
|
|
@ -161,7 +173,7 @@ def main():
|
|
|
|
if state == 'absent' and not name:
|
|
|
|
if state == 'absent' and not name:
|
|
|
|
module.fail_json(msg='uninstalling a package is only available for named packages')
|
|
|
|
module.fail_json(msg='uninstalling a package is only available for named packages')
|
|
|
|
|
|
|
|
|
|
|
|
bower = Bower(module, name=name, offline=offline, path=path, version=version)
|
|
|
|
bower = Bower(module, name=name, offline=offline, production=production, path=path, version=version)
|
|
|
|
|
|
|
|
|
|
|
|
changed = False
|
|
|
|
changed = False
|
|
|
|
if state == 'present':
|
|
|
|
if state == 'present':
|
|
|
|