Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: sstephenson/sprockets
base: 0c9582d0b7
...
head fork: sstephenson/sprockets
compare: 895b53bc83
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 09, 2013
@SamSaffron SamSaffron added a to_i when comparing times on asset, fidelity is already hard
coded to 1 second in lots of other spots
change persistence format to Fixnum from String, upgrade should take
care of cleaning up tmp/cache directory
2fefbf4
@josh josh Merge pull request #428 from SamSaffron/master
Fix serialization format for mtime on files
895b53b
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/sprockets/asset.rb
View
14 lib/sprockets/asset.rb
@@ -39,7 +39,8 @@ def initialize(environment, logical_path, pathname)
@logical_path = logical_path.to_s
@pathname = Pathname.new(pathname)
@content_type = environment.content_type_of(pathname)
- @mtime = environment.stat(pathname).mtime
+ # drop precision to 1 second, same pattern followed elsewhere
+ @mtime = Time.at(environment.stat(pathname).mtime.to_i)
@length = environment.stat(pathname).size
@digest = environment.file_digest(pathname).hexdigest
end
@@ -58,8 +59,7 @@ def init_with(environment, coder)
end
if mtime = coder['mtime']
- # Parse time string
- @mtime = Time.parse(mtime)
+ @mtime = Time.at(mtime)
end
if length = coder['length']
@@ -74,7 +74,7 @@ def encode_with(coder)
coder['logical_path'] = logical_path
coder['pathname'] = relativize_root_path(pathname).to_s
coder['content_type'] = content_type
- coder['mtime'] = mtime.iso8601
+ coder['mtime'] = mtime.to_i
coder['length'] = length
coder['digest'] = digest
end
@@ -244,7 +244,11 @@ def dependency_fresh?(environment, dep)
# stale. Many deployment environments may recopy or recheckout
# assets on each deploy. In this case the mtime would be the
# time of deploy rather than modified time.
- if mtime >= stat.mtime
+ #
+ # Note: to_i is used in eql? and write_to we assume fidelity of 1 second
+ # if people save files more frequently than 1 second sprockets may
+ # not pick it up, by design
+ if mtime.to_i >= stat.mtime.to_i
return true
end

No commit comments for this range

Something went wrong with that request. Please try again.