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

Fix support for dotfiles in data-sources #492

Merged
merged 1 commit into from Nov 5, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+10 −1
Diff settings

Always

Just for now

Fix support for dotfiles in data-sources

    .htaccess and .htpasswd were not handled by any data-source
  • Loading branch information...
Andreas
Andreas committed Nov 5, 2014
commit 81f394f9cfbd3427ce449241d8473e9442e44faa
@@ -60,7 +60,7 @@ def initialize(filename)
# @raise [UnsupportedFileTypeError] if a file of an unsupported type is
# detected (something other than file, directory or link)
def all_files_in(dir_name, recursion_limit = 10)
Dir[dir_name + '/**/*'].map do |fn|
Dir.glob(dir_name + '/**/*', File::FNM_DOTMATCH).map do |fn|
case File.ftype(fn)
when 'link'
if 0 == recursion_limit
@@ -101,4 +101,13 @@ def test_resolve_symlink_too_many
end
end

def test_dotfiles_are_valid_items
# Write sample files
FileUtils.mkdir_p('dir')
File.open('dir/.htaccess', 'w') { |io| io.write('o hai') }

actual_files = Nanoc::Extra::FilesystemTools.all_files_in('dir').sort
assert_equal ['dir/.htaccess'], actual_files
end

end
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.