From ea926e8e43dc7e5f656a86f2b0a4842ac67c51ff Mon Sep 17 00:00:00 2001 From: Maksym Grebenets Date: Fri, 6 Apr 2018 09:09:04 +1000 Subject: [PATCH] Use correct lizard command when custom executable is provided --- lib/fastlane/plugin/lizard/actions/lizard_action.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/fastlane/plugin/lizard/actions/lizard_action.rb b/lib/fastlane/plugin/lizard/actions/lizard_action.rb index fb151c7..f5bf8a2 100644 --- a/lib/fastlane/plugin/lizard/actions/lizard_action.rb +++ b/lib/fastlane/plugin/lizard/actions/lizard_action.rb @@ -10,7 +10,9 @@ def self.run(params) UI.user_error!("The custom executable at '#{params[:executable]}' does not exist.") end - lizard_cli_version = Gem::Version.new(`lizard --version`.scan(/(?:\d+\.?){3}/).first) + lizard_command = "python #{params[:executable]}" || "lizard" + + lizard_cli_version = Gem::Version.new(`#{lizard_command} --version`.scan(/(?:\d+\.?){3}/).first) required_version = Gem::Version.new(Fastlane::Lizard::CLI_VERSION) if lizard_cli_version < required_version UI.user_error!("Your lizard version is outdated, please upgrade to at least version #{Fastlane::Lizard::CLI_VERSION} and start your lane again!") @@ -19,7 +21,7 @@ def self.run(params) command = forming_command(params) if params[:show_warnings] - Fastlane::Actions.sh_control_output("lizard #{params[:source_folder]} | sed -n -e '/^$/,$p'", print_command: true, print_command_output: true) + Fastlane::Actions.sh_control_output("#{lizard_command} #{params[:source_folder]} | sed -n -e '/^$/,$p'", print_command: true, print_command_output: true) end begin @@ -32,8 +34,7 @@ def self.run(params) def self.forming_command(params) command = [] - command << 'lizard' unless params[:executable] - command << "python #{params[:executable]}" if params[:executable] + command << lizard_command command << params[:language].split(",").map { |l| "-l #{l.strip}" }.join(" ") if params[:language] command << "--#{params[:export_type]}" if params[:export_type] command << "-C #{params[:ccn]}" if params[:ccn] # stands for cyclomatic complexity number