Build Status Code Climate Coverage Status Gem Version

tumugi-plugin-command

tumugi-plugin-command is a plugin to execute a command.

Installation

Add this line to your application's Gemfile:

gem 'tumugi-plugin-command'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tumugi-plugin-command

Task

Tumugi::Plugin::CommandTask

Tumugi::Plugin::BigqueryShellTask is task to execute a specified command.

Usage

  • Run command
task :task1, type: :command do
  param_set :command, "ls -la"
end
  • Run command and save STDOUT into file
task :task1, type: :command do
  param_set :command, "echo 'success'"
  param_set :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
  param_set :command, -> { "cat #{input.path}" }
end

task :task2, type: :command do
  param_set :command, "./examples/external_script.sh"
  output target(:local_file, "tmp/external_script_result.txt")
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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.