smart_asset 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@ Features
8
8
 
9
9
  Similar to <code>AssetPackager</code>, but with the following changes:
10
10
 
11
- * Git modified date/time for package version
11
+ * Git modified date/time for package version (only re-packages files that have been modified)
12
12
  * Google Closure Compiler for javascript compression
13
13
  * Framework agnostic (adapters provided for Rails 2, Rails 3, and Sinatra)
14
14
 
data/lib/smart_asset.rb CHANGED
@@ -31,6 +31,7 @@ class SmartAsset
31
31
  dir = "#{@pub}/#{@sources[type]}"
32
32
  ext = ext_from_type type
33
33
  version = {}
34
+ cache = {}
34
35
 
35
36
  # Read version yaml
36
37
  if File.exists?(version_path = "#{dest}/#{type}.yml")
@@ -45,8 +46,9 @@ class SmartAsset
45
46
  # Retrieve list of Git modified timestamps
46
47
  modified = []
47
48
  files.each do |file|
48
- if File.exists?("#{dir}/#{file}.#{ext}")
49
- mod = `cd #{@root} && git log --pretty=format:%cd -n 1 --date=iso #{@config['public']}/#{@sources[type]}/#{file}.#{ext}`
49
+ fname = "#{dir}/#{file}.#{ext}"
50
+ if File.exists?(fname)
51
+ mod = (cache[fname] ||= `cd #{@root} && git log --pretty=format:%cd -n 1 --date=iso #{@config['public']}/#{@sources[type]}/#{file}.#{ext}`)
50
52
  if mod.strip.empty? || mod.include?('command not found')
51
53
  modified << (ENV['MODIFIED'] ? Time.parse(ENV['MODIFIED']) : Time.now).utc.strftime("%Y%m%d%H%M%S")
52
54
  else
@@ -1,3 +1,3 @@
1
1
  class SmartAsset
2
- VERSION = "0.4.6" unless defined?(::SmartAsset::VERSION)
2
+ VERSION = "0.4.7" unless defined?(::SmartAsset::VERSION)
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 6
9
- version: 0.4.6
8
+ - 7
9
+ version: 0.4.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Winton Welsh
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-15 00:00:00 -08:00
17
+ date: 2010-12-16 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency