Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/myjobs/app/models/workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def folder_contents
}.map {
|f| WorkflowFile.new(f, self.staged_dir)
}.reject {
|wf| wf.under_dotfile?
|wf| wf.is_dotfile?
}
else
@folder_contents = []
Expand Down
4 changes: 2 additions & 2 deletions apps/myjobs/app/models/workflow_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def relative_path
@path.relative_path_from(@staged_dir).to_s
end

def under_dotfile?
@path.ascend.to_a.any? { |entry| entry.basename.to_s.start_with?('.') }
def is_dotfile?
@path.basename.to_s.start_with?('.')
end

def path
Expand Down
13 changes: 10 additions & 3 deletions apps/myjobs/test/models/workflow_file_test.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
require 'test_helper'

class WorkflowFileTest < ActiveSupport::TestCase
test "it recognizes hidden files" do
assert WorkflowFile.new(
test "is dotfile does not detect hidden folders" do
refute WorkflowFile.new(
Pathname.new('/home/johrstrom/.wine/drive_c'),
Pathname.new('/home/johrstrom/ondemand/and/so/on')
).under_dotfile?
).is_dotfile?
end

test "is dotfile detects hidden files" do
assert WorkflowFile.new(
Pathname.new('/home/johrstrom/wine/.drive_c'),
Pathname.new('/home/johrstrom/ondemand/and/so/on')
).is_dotfile?
end
end