26 lines
575 B
Ruby
26 lines
575 B
Ruby
require 'English'
|
|
|
|
ansible_role = 'bind'
|
|
|
|
def exec_cmd(cmd)
|
|
puts cmd
|
|
puts %x(#{cmd})
|
|
raise unless $CHILD_STATUS.success?
|
|
end
|
|
|
|
task :default do
|
|
exec_cmd(
|
|
"docker run -v $(pwd):/#{ansible_role}:ro -it nishiki/ansible:stretch bash -c " \
|
|
"'cd /#{ansible_role} && rake verify'"
|
|
)
|
|
end
|
|
|
|
task verify: %w[
|
|
install
|
|
]
|
|
|
|
task :install do
|
|
exec_cmd("ansible-playbook -i tests/inventory tests/#{ansible_role}.yml")
|
|
exec_cmd("ansible-playbook -i tests/inventory tests/#{ansible_role}.yml | grep changed=0")
|
|
exec_cmd("cd tests/spec && rspec #{ansible_role}.rb")
|
|
end
|