Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verbose console #394

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rake/file_utils_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def #{name}(*args, **options, &block)
def verbose(value=nil)
oldvalue = FileUtilsExt.verbose_flag
FileUtilsExt.verbose_flag = value unless value.nil?
ENV["TESTOPTS"] = "-v" if value
if block_given?
begin
yield
Expand Down
2 changes: 0 additions & 2 deletions lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ def define
desc @description
task @name => Array(deps) do
FileUtilsExt.verbose(@verbose) do
puts "Use TESTOPTS=\"--verbose\" to pass --verbose" \
", etc. to runners." if ARGV.include? "--verbose"
args =
"#{ruby_opts_string} #{run_code} " +
"#{file_list_string} #{option_list}"
Expand Down
6 changes: 6 additions & 0 deletions test/test_rake_file_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def teardown
FileUtils::LN_SUPPORTED[0] = true
RakeFileUtils.verbose_flag = Rake::FileUtilsExt::DEFAULT
ENV["RAKE_TEST_SH"] = @rake_test_sh
ENV["TESTOPTS"] = nil

super
end
Expand Down Expand Up @@ -107,8 +108,13 @@ def test_safe_ln_fails_on_script_error
def test_verbose
verbose true
assert_equal true, verbose
assert_equal '-v', ENV['TESTOPTS']

ENV['TESTOPTS'] = nil
verbose false
assert_equal false, verbose
assert_equal nil, ENV['TESTOPTS']

verbose(true) {
assert_equal true, verbose
}
Expand Down
7 changes: 0 additions & 7 deletions test/test_rake_functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,6 @@ def test_test_task_when_verbose_unless_verbose_passed_not_prompt_testopts
refute_match exp, @out
end

def test_test_task_when_verbose_passed_prompts_testopts
rakefile_test_task
rake "--verbose", "unit"
exp = /TESTOPTS="--verbose" to pass --verbose/
assert_match exp, @out
end

def test_comment_before_task_acts_like_desc
rakefile_comments

Expand Down