smart_asset 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/smart_asset.rb +4 -2
- data/lib/smart_asset/version.rb +1 -1
- metadata +3 -3
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
|
-
|
49
|
-
|
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
|
data/lib/smart_asset/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
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-
|
17
|
+
date: 2010-12-16 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|