Skip to content

Commit 394e985

Browse files
committed
properly refactor run method
1 parent c605832 commit 394e985

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

lib/arduino_ci/arduino_cmd.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,17 @@ def set_pref(key, value)
8787
end
8888

8989
# run the arduino command
90-
def run(*args, **kwargs)
90+
def _run(*args, **kwargs)
9191
raise "Ian needs to implement this in a subclass #{args} #{kwargs}"
9292
end
9393

94+
# build and run the arduino command
95+
def run(*args, **kwargs)
96+
# TODO: detect env!!
97+
full_args = @base_cmd + args
98+
_run(*full_args, **kwargs)
99+
end
100+
94101
# run a command and capture its output
95102
# @return [Hash] {:out => String, :err => String, :success => bool}
96103
def run_and_capture(*args, **kwargs)

lib/arduino_ci/arduino_cmd_linux.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ def _lib_dir
3636
end
3737

3838
# run the arduino command
39-
def run(*args, **kwargs)
40-
full_args = @base_cmd + args
41-
@display_mgr.run(*full_args, **kwargs)
39+
def _run(*args, **kwargs)
40+
@display_mgr.run(*args, **kwargs)
4241
end
4342

4443
def run_with_gui_guess(message, *args, **kwargs)

lib/arduino_ci/arduino_cmd_linux_builder.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ def _lib_dir
1919
end
2020

2121
# run the arduino command
22-
def run(*args, **kwargs)
23-
full_args = @base_cmd + args
24-
Host.run(*full_args, **kwargs)
22+
def _run(*args, **kwargs)
23+
Host.run(*args, **kwargs)
2524
end
2625

2726
end

lib/arduino_ci/arduino_cmd_osx.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ class ArduinoCmdOSX < ArduinoCmd
1414
flag :verify, "--verify"
1515

1616
# run the arduino command
17-
def run(*args, **kwargs)
18-
full_args = @base_cmd + args
19-
Host.run(*full_args, **kwargs)
17+
def _run(*args, **kwargs)
18+
Host.run(*args, **kwargs)
2019
end
2120

2221
def _lib_dir

0 commit comments

Comments
 (0)