From aba11155a452ea388f6c67c97eb81aa0ae437346 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 14 Nov 2018 23:00:40 -0500 Subject: [PATCH] rename check_executable to check_program --- .../configure/check_executable_failure.rb | 3 --- .../configure/check_executable_no_fail.rb | 3 --- .../configure/check_executable_success.rb | 3 --- .../configure/check_program_failure.rb | 3 +++ .../configure/check_program_no_fail.rb | 3 +++ .../configure/check_program_success.rb | 3 +++ lib/rscons/application.rb | 4 ++-- lib/rscons/configure_op.rb | 14 ++++++------- lib/rscons/script.rb | 10 +++++----- spec/build_tests_spec.rb | 20 +++++++++---------- 10 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 build_tests/configure/check_executable_failure.rb delete mode 100644 build_tests/configure/check_executable_no_fail.rb delete mode 100644 build_tests/configure/check_executable_success.rb create mode 100644 build_tests/configure/check_program_failure.rb create mode 100644 build_tests/configure/check_program_no_fail.rb create mode 100644 build_tests/configure/check_program_success.rb diff --git a/build_tests/configure/check_executable_failure.rb b/build_tests/configure/check_executable_failure.rb deleted file mode 100644 index 152f66e..0000000 --- a/build_tests/configure/check_executable_failure.rb +++ /dev/null @@ -1,3 +0,0 @@ -configure do - check_executable "executable-that-is-not-found" -end diff --git a/build_tests/configure/check_executable_no_fail.rb b/build_tests/configure/check_executable_no_fail.rb deleted file mode 100644 index 21eddae..0000000 --- a/build_tests/configure/check_executable_no_fail.rb +++ /dev/null @@ -1,3 +0,0 @@ -configure do - check_executable "executable-that-is-not-found", fail: false -end diff --git a/build_tests/configure/check_executable_success.rb b/build_tests/configure/check_executable_success.rb deleted file mode 100644 index c914402..0000000 --- a/build_tests/configure/check_executable_success.rb +++ /dev/null @@ -1,3 +0,0 @@ -configure do - check_executable "find" -end diff --git a/build_tests/configure/check_program_failure.rb b/build_tests/configure/check_program_failure.rb new file mode 100644 index 0000000..0c2f8b6 --- /dev/null +++ b/build_tests/configure/check_program_failure.rb @@ -0,0 +1,3 @@ +configure do + check_program "program-that-is-not-found" +end diff --git a/build_tests/configure/check_program_no_fail.rb b/build_tests/configure/check_program_no_fail.rb new file mode 100644 index 0000000..184772f --- /dev/null +++ b/build_tests/configure/check_program_no_fail.rb @@ -0,0 +1,3 @@ +configure do + check_program "program-that-is-not-found", fail: false +end diff --git a/build_tests/configure/check_program_success.rb b/build_tests/configure/check_program_success.rb new file mode 100644 index 0000000..334ebb3 --- /dev/null +++ b/build_tests/configure/check_program_success.rb @@ -0,0 +1,3 @@ +configure do + check_program "find" +end diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index 1a13419..951e425 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -120,9 +120,9 @@ module Rscons co.check_lib(*cl) end end - if ces = @script.check_executables + if ces = @script.check_programs ces.each do |ce| - co.check_executable(*ce) + co.check_program(*ce) end end rescue ConfigureOp::ConfigureFailure diff --git a/lib/rscons/configure_op.rb b/lib/rscons/configure_op.rb index f6f866d..3eb5df5 100644 --- a/lib/rscons/configure_op.rb +++ b/lib/rscons/configure_op.rb @@ -182,19 +182,19 @@ module Rscons common_config_checks(status, options) end - # Check for an executable. - def check_executable(executable, options = {}) - $stdout.write("Checking for executable '#{executable}'... ") + # Check for a executable program. + def check_program(program, options = {}) + $stdout.write("Checking for program '#{program}'... ") found = false - if executable["/"] or executable["\\"] - if File.file?(executable) and File.executable?(executable) + if program["/"] or program["\\"] + if File.file?(program) and File.executable?(program) found = true - success_message = executable + success_message = program end else path_entries = ENV["PATH"].split(File::PATH_SEPARATOR) path_entries.find do |path_entry| - if path = test_path_for_executable(path_entry, executable) + if path = test_path_for_executable(path_entry, program) found = true success_message = path end diff --git a/lib/rscons/script.rb b/lib/rscons/script.rb index cc2c24c..12ed1de 100644 --- a/lib/rscons/script.rb +++ b/lib/rscons/script.rb @@ -66,10 +66,10 @@ module Rscons @script.check_libs << args end - # Check for an executable. - def check_executable(*args) - @script.check_executables ||= [] - @script.check_executables << args + # Check for an executable program. + def check_program(*args) + @script.check_programs ||= [] + @script.check_programs << args end end @@ -107,7 +107,7 @@ module Rscons # @return [Array] # Executables to check for. - attr_accessor :check_executables + attr_accessor :check_programs # @return [Boolean] # Whether to autoconfigure if the user does not explicitly perform a diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index 30c5827..dc5d06f 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -1725,29 +1725,29 @@ EOF end end - context "check_executable" do - it "succeeds when the requested executable is found" do + context "check_program" do + it "succeeds when the requested program is found" do test_dir "configure" - result = run_rscons(rsconsfile: "check_executable_success.rb", op: "configure") + result = run_rscons(rsconsfile: "check_program_success.rb", op: "configure") expect(result.stderr).to eq "" expect(result.status).to eq 0 - expect(result.stdout).to match /Checking for executable 'find'... .*find/ + expect(result.stdout).to match /Checking for program 'find'... .*find/ end - it "fails when the requested executable is not found" do + it "fails when the requested program is not found" do test_dir "configure" - result = run_rscons(rsconsfile: "check_executable_failure.rb", op: "configure") + result = run_rscons(rsconsfile: "check_program_failure.rb", op: "configure") expect(result.stderr).to eq "" expect(result.status).to_not eq 0 - expect(result.stdout).to match /Checking for executable 'executable-that-is-not-found'... not found/ + expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/ end - it "succeeds when the requested executable is not found but :fail is set to false" do + it "succeeds when the requested program is not found but :fail is set to false" do test_dir "configure" - result = run_rscons(rsconsfile: "check_executable_no_fail.rb", op: "configure") + result = run_rscons(rsconsfile: "check_program_no_fail.rb", op: "configure") expect(result.stderr).to eq "" expect(result.status).to eq 0 - expect(result.stdout).to match /Checking for executable 'executable-that-is-not-found'... not found/ + expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/ end end end