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

If any file changed only parse all files if force-update is true #1087

Open
wants to merge 1 commit 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/rdoc/rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ def gather_files files

file_list = remove_unparseable(file_list)

result = []
if file_list.count {|name, mtime|
result << name if mtime || @options.force_update
file_list[name] = @last_modified[name] unless mtime
mtime
} > 0
@last_modified.replace file_list
file_list.keys.sort
result.sort
else
[]
end
Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ def test_gather_files
assert_equal [a, b], @rdoc.gather_files([b, a, b])
end

def test_gather_files_with_no_force_update
a = File.expand_path __FILE__
b = File.expand_path '../test_rdoc_text.rb', __FILE__

assert_equal [a, b], @rdoc.gather_files([a, b])

@rdoc.last_modified[a] -= 10
@rdoc.options.force_update = false
assert_equal [a], @rdoc.gather_files([a, b])
end

def test_handle_pipe
$stdin = StringIO.new "hello"

Expand Down