Skip to content

Commit

Permalink
Merge branch 'fix_precompilation' of https://github.com/rickenharp/as…
Browse files Browse the repository at this point in the history
…sets into rickenharp-fix_precompilation
  • Loading branch information
jodosha committed May 20, 2016
2 parents 9b22a28 + e07607c commit 505a919
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/hanami/assets/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def fresh?
# @since 0.1.0
# @api private
def compile?
@compile ||= ::File.fnmatch(COMPILE_PATTERN, source.to_s) &&
@compile ||= ::File.fnmatch(COMPILE_PATTERN, ::File.basename(source.to_s)) &&
!EXTENSIONS[::File.extname(source.to_s)]
end

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/stylesheets/folder.dot/other_style.foobar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a foobar file.
1 change: 1 addition & 0 deletions test/fixtures/stylesheets/style.foobar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a foobar file.
16 changes: 16 additions & 0 deletions test/integration/compiler_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@
directory.must_be :exist?
end

it 'copies unknown asset' do
Hanami::Assets::Compiler.compile(@config, 'style.foobar')

target = @config.public_directory.join('assets', 'style.foobar')
content = target.read
content.must_equal "This is a foobar file.\n"
end

it 'copies unknown asset in folder with a dot in it' do
Hanami::Assets::Compiler.compile(@config, 'other_style.foobar')

target = @config.public_directory.join('assets', 'other_style.foobar')
content = target.read
content.must_equal "This is a foobar file.\n"
end

it "won't compile/copy if the source hasn't changed" do
Hanami::Assets::Compiler.compile(@config, 'unchanged.js')

Expand Down

0 comments on commit 505a919

Please sign in to comment.