Command plugin for tumugi
tumugi-plugin-command is a tumugi plugin to execute a command.
Installation
Add this line to your application's Gemfile:
gem 'tumugi-plugin-command'
And then execute bundle install
.
Task
Tumugi::Plugin::CommandTask
Tumugi::Plugin::CommandTask
is task to execute a specified command.
Parameters
- command command which you want to execute (string, required)
- output_file output file path. If you specified this parameter, all outputs to STDOUT are saved in this file. (string)
Examples
- Run command
task :task1, type: :command do
command "ls -la"
end
- Run command and save all outputs to STDOUT into file
task :task1, type: :command do
command "echo 'success'"
## If you don't want to output stdout as log, set "quiet" param
# quiet true
output_file "result.txt"
end
- Run external shell script
#!/bin/sh
echo 'success' > tmp/external_script_result.txt
task :task1, type: :command do
requires :task2
command { "cat #{input.path}" }
end
task :task2, type: :command do
command "./examples/external_script.sh"
output target(:local_file, "tmp/external_script_result.txt")
end
Development
After checking out the repo, run bundle install
to install dependencies. Then, run bundle exec rake test
to run the tests.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tumugi/tumugi-plugin-command.
License
The gem is available as open source under the terms of the Apache License Version 2.0.