Skip to content

Commit

Permalink
Fix crash when compiling extensionless binary items
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Jan 31, 2015
1 parent d20ab7a commit 12b6e8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit 12b6e8e

Please sign in to comment.