lib/rubu.rb in rubu-0.0.4 vs lib/rubu.rb in rubu-0.0.5
- old
+ new
@@ -1,9 +1,11 @@
require 'open3'
require 'yaml'
require 'digest/md5'
+require_relative './version.rb'
+
module Rubu
# Persistent state of Rubu.
#
# State maintains YAML based state file (if in use). The file
@@ -56,11 +58,10 @@
# Move is the action in Step.
class Move
@@host = []
- @@show_shell_warning = true
# Status after execution.
attr_reader :status
# Storage for error message.
@@ -116,14 +117,10 @@
def display( msg )
@output = msg
STDOUT.puts @output
end
- def set_show_shell_warning( value = true )
- @@show_shell_warning = value
- end
-
end
# Shell based command.
class ShellCommand < Move
@@ -141,11 +138,11 @@
if Order[ :verbose ]
STDOUT.puts @cmd
end
if status.exitstatus == 0
- if @@show_shell_warning && not( stderr.empty? )
+ if Order[ :sh_warn ] && not( stderr.empty? )
warn( stderr )
end
@status = :success
else
@status = :error
@@ -401,14 +398,15 @@
# Configuration space for Rubu.
#
# Options:
- # * serial - Force parallel executions to serial.
- # * parmax - Limit the number of parallel executions.
- # * verbose - Show command executions.
- # * force - Force Step updates.
+ # * serial - Force parallel executions to serial (default: parallel).
+ # * parmax - Limit the number of parallel executions (default: 0).
+ # * verbose - Show command executions (default: false).
+ # * force - Force Step updates (default: false).
+ # * sh_warn - Show shell warnings (default: true).
class Order
@@order = {}
# Set Order entry value.
@@ -430,9 +428,15 @@
# Maximun parallel runs (0 for no limit).
Order[ :parmax ] = 0
# Verbose execution.
Order[ :verbose ] = false
+
+ # Force Step updates.
+ Order[ :force ] = false
+
+ # Show warnings (for shell commands).
+ Order[ :sh_warn ] = true
end
# Option space for program.