Skip to content
Browse files

Only try args as a path if its a string

  • Loading branch information...
1 parent b777136 commit 3aaf5c39a5c015da902a0d7af6d17c472b6c75d2 @steel steel committed
Showing with 21 additions and 1 deletion.
  1. +1 −1 lib/sprockets/manifest.rb
  2. +20 −0 test/test_manifest.rb
View
2 lib/sprockets/manifest.rb
@@ -84,7 +84,7 @@ def files
#
def compile(*args)
paths = environment.each_logical_path(*args).to_a +
- args.flatten.select { |fn| Pathname.new(fn).absolute? }
+ args.flatten.select { |fn| Pathname.new(fn).absolute? if fn.is_a?(String)}
paths.each do |path|
if asset = find_asset(path)
View
20 test/test_manifest.rb
@@ -90,6 +90,26 @@ def teardown
assert_equal gallery_digest_path, data['assets']['gallery.css']
end
+ test "compile with regex" do
+ app_digest_path = @env['application.js'].digest_path
+ gallery_digest_path = @env['gallery.css'].digest_path
+
+ assert !File.exist?("#{@dir}/#{app_digest_path}")
+ assert !File.exist?("#{@dir}/#{gallery_digest_path}")
+
+ @manifest.compile('gallery.css', /application.js/)
+
+ assert File.exist?("#{@dir}/manifest.json")
+ assert File.exist?("#{@dir}/#{app_digest_path}")
+ assert File.exist?("#{@dir}/#{gallery_digest_path}")
+
+ data = JSON.parse(File.read(@manifest.path))
+ assert data['files'][app_digest_path]
+ assert data['files'][gallery_digest_path]
+ assert_equal app_digest_path, data['assets']['application.js']
+ assert_equal gallery_digest_path, data['assets']['gallery.css']
+ end
+
test "recompile asset" do
digest_path = @env['application.js'].digest_path
filename = fixture_path('default/application.js.coffee')

0 comments on commit 3aaf5c3

Please sign in to comment.
Something went wrong with that request. Please try again.