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 crash when compiling extensionless binary items #525

Merged
merged 1 commit into from Jan 31, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nanoc/cli/commands/create-site.rb
Expand Up @@ -130,7 +130,7 @@ def array_to_yaml(array)
item.identifier.chop + '.css'
elsif item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
item.identifier.chop + (item[:extension] ? '.' + item[:extension] : '')
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
Expand Down
13 changes: 13 additions & 0 deletions test/cli/commands/test_create_site.rb
Expand Up @@ -18,6 +18,19 @@ def test_can_compile_new_site
end
end

def test_can_compile_new_site_with_binary_items
Nanoc::CLI.run %w( create_site foo )

FileUtils.cd('foo') do
File.open('content/blah', 'w') { |io| io << 'asdf' }
site = Nanoc::Site.new('.')
site.load_data
site.compile

assert File.file?('output/blah')
end
end

def test_default_encoding
unless defined?(Encoding)
skip 'No Encoding class'
Expand Down