Module: NewlineHw::Shell::Function
- Defined in:
- lib/newline_hw/shell/function.rb
Overview
Produce a bash / zsh function to be called by a tty compatible shell
Constant Summary collapse
- HW_FUNCTION =
"hw".freeze
Class Method Summary collapse
Class Method Details
.cmd ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/newline_hw/shell/function.rb', line 14 def cmd <<-eos function #{HW_FUNCTION}() { setup_command=$(#{path} setup_command $*); setup_es=$?; if [ "$setup_es" = "0" ]; then eval $setup_command; setup_command_es=$?; run_command=$(#{path} run_command $PWD $*); run_es=$?; if [ $run_es = "0" ] && [ $setup_command_es = "0" ]; then eval $run_command; else echo "Could not run project run command"; echo $run_command; fi else echo "Could not run project setup command"; echo $setup_command; fi } eos end |
.path ⇒ Object
10 11 12 |
# File 'lib/newline_hw/shell/function.rb', line 10 def path File.(File.join(File.dirname(__FILE__), "..", "..", "..", "exe", "newline_hw")) end |