smart_asset 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -12
- data/lib/smart_asset.rb +16 -2
- data/lib/smart_asset/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -108,17 +108,18 @@ Other Options
|
|
108
108
|
|
109
109
|
You may add extra options to your <code>config/assets.yml</code> file.
|
110
110
|
|
111
|
-
|
111
|
+
Below are the default values (excluding <code>asset\_host</code>):
|
112
112
|
|
113
113
|
<pre>
|
114
|
-
# Append random numbers to script paths
|
115
|
-
append_random:
|
114
|
+
# Append random numbers to script paths on each request
|
115
|
+
append_random:
|
116
|
+
development: true
|
116
117
|
|
117
118
|
# Asset host URL (defaults to ActionController::Base.asset_host or nil)
|
118
119
|
asset_host:
|
119
120
|
production: http://assets%d.mydomain.com
|
120
121
|
|
121
|
-
# How many asset hosts you have (if asset_host defined with %d)
|
122
|
+
# How many asset hosts you have (use if asset_host defined with %d)
|
122
123
|
asset_host_count: 4
|
123
124
|
|
124
125
|
# Public directory
|
@@ -137,15 +138,18 @@ sources:
|
|
137
138
|
|
138
139
|
### smart\_asset
|
139
140
|
|
140
|
-
You use
|
141
|
+
You may use environment variables with the <code>smart\_asset</code> command to alter its behavior.
|
141
142
|
|
142
|
-
|
143
|
+
<code>DEBUG=1</code><br/>Output commands that are running, leave the tmp file around for inspection
|
144
|
+
|
145
|
+
<code>PACKAGE=package\_1</code><br/>Only compress a specific package
|
146
|
+
|
147
|
+
<code>MODIFIED='12/1/2010 12:00'</code><br/>Use a default modified time other than Time.now for non-version controlled files
|
148
|
+
|
149
|
+
<code>WARN=1</code><br/>Get compression warnings from Closure Compiler and YUI Compressor
|
150
|
+
|
151
|
+
#### Example:
|
143
152
|
|
144
153
|
<pre>
|
145
154
|
WARN=1 smart_asset
|
146
|
-
</pre>
|
147
|
-
|
148
|
-
* <code>DEBUG=1</code> - Output commands that are running, leave the tmp file around for inspection
|
149
|
-
* <code>PACKAGE=package\_1</code> - Only compress a specific package
|
150
|
-
* <code>MODIFIED='12/1/2010 12:00'</code> - Use a default modified time other than Time.now for non-version controlled files
|
151
|
-
* <code>WARN=1</code> - Get compression warnings from Closure Compiler and YUI Compressor
|
155
|
+
</pre>
|
data/lib/smart_asset.rb
CHANGED
@@ -122,16 +122,23 @@ class SmartAsset
|
|
122
122
|
@root = File.expand_path(root)
|
123
123
|
@config = YAML::load(File.read("#{@root}/#{relative_config}"))
|
124
124
|
|
125
|
+
# Default values
|
125
126
|
if @config['append_random'].nil?
|
126
|
-
@config['append_random'] =
|
127
|
+
@config['append_random'] = {}
|
127
128
|
end
|
129
|
+
if @config['append_random']['development'].nil?
|
130
|
+
@config['append_random']['development'] = true
|
131
|
+
end
|
132
|
+
|
128
133
|
@config['asset_host_count'] ||= 4
|
129
134
|
@config['asset_host'] ||= ActionController::Base.asset_host rescue nil
|
130
135
|
@config['environments'] ||= %w(production)
|
131
136
|
@config['public'] ||= 'public'
|
137
|
+
|
132
138
|
@config['destination'] ||= {}
|
133
139
|
@config['destination']['javascripts'] ||= 'javascripts/packaged'
|
134
140
|
@config['destination']['stylesheets'] ||= 'stylesheets/packaged'
|
141
|
+
|
135
142
|
@config['sources'] ||= {}
|
136
143
|
@config['sources']['javascripts'] ||= "javascripts"
|
137
144
|
@config['sources']['stylesheets'] ||= "stylesheets"
|
@@ -145,7 +152,14 @@ class SmartAsset
|
|
145
152
|
end
|
146
153
|
end
|
147
154
|
|
148
|
-
|
155
|
+
# Class variables
|
156
|
+
@append_random =
|
157
|
+
if @config['append_random'].is_a?(::Hash)
|
158
|
+
@config['append_random'][@env]
|
159
|
+
else
|
160
|
+
@config['append_random']
|
161
|
+
end
|
162
|
+
|
149
163
|
@asset_host = @config['asset_host']
|
150
164
|
@envs = @config['environments']
|
151
165
|
@sources = @config['sources']
|
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
|
+
- 5
|
9
|
+
version: 0.4.5
|
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-15 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|