Class: Spud::BuildTools::SpudBuild::RuleContext
- Inherits:
-
Object
- Object
- Spud::BuildTools::SpudBuild::RuleContext
- Defined in:
- lib/build_tools/spud/rule_context.rb
Instance Attribute Summary collapse
-
#__process ⇒ Object
readonly
Returns the value of attribute __process.
Instance Method Summary collapse
-
#initialize(spud, file_context) ⇒ RuleContext
constructor
A new instance of RuleContext.
- #invoke(name, *args, **kwargs) ⇒ Object
- #sh(cmd) ⇒ Object
- #sh?(cmd) ⇒ Boolean
- #shh(cmd) ⇒ Object
- #shh?(cmd) ⇒ Boolean
- #shhh(cmd) ⇒ Object
- #shhh?(cmd) ⇒ Boolean
Constructor Details
#initialize(spud, file_context) ⇒ RuleContext
Returns a new instance of RuleContext.
10 11 12 13 14 15 16 17 |
# File 'lib/build_tools/spud/rule_context.rb', line 10 def initialize(spud, file_context) @__spud = spud @__process = nil file_context.singleton_methods.each do |method_name| define_singleton_method(method_name, &file_context.method(method_name)) end end |
Instance Attribute Details
#__process ⇒ Object (readonly)
Returns the value of attribute __process.
8 9 10 |
# File 'lib/build_tools/spud/rule_context.rb', line 8 def __process @__process end |
Instance Method Details
#invoke(name, *args, **kwargs) ⇒ Object
53 54 55 |
# File 'lib/build_tools/spud/rule_context.rb', line 53 def invoke(name, *args, **kwargs) @__spud.invoke(name, *args, **kwargs) end |
#sh(cmd) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/build_tools/spud/rule_context.rb', line 19 def sh(cmd) out = sh?(cmd) raise ShellError unless out.status.exitstatus.zero? out end |
#sh?(cmd) ⇒ Boolean
26 27 28 29 |
# File 'lib/build_tools/spud/rule_context.rb', line 26 def sh?(cmd) puts cmd Spud::Shell.new(cmd) end |
#shh(cmd) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/build_tools/spud/rule_context.rb', line 31 def shh(cmd) out = shh?(cmd) raise ShellError unless out.status.exitstatus.zero? out end |
#shh?(cmd) ⇒ Boolean
38 39 40 |
# File 'lib/build_tools/spud/rule_context.rb', line 38 def shh?(cmd) Spud::Shell.new(cmd) end |
#shhh(cmd) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/build_tools/spud/rule_context.rb', line 42 def shhh(cmd) out = shhh?(cmd) raise ShellError, out unless out.status.exitstatus.zero? out end |
#shhh?(cmd) ⇒ Boolean
49 50 51 |
# File 'lib/build_tools/spud/rule_context.rb', line 49 def shhh?(cmd) Spud::Shell.new(cmd, silent: true) end |