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 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
- All the values below are the default values, excluding <code>append\_random</code> and <code>asset\_host</code>:
111
+ Below are the default values (excluding <code>asset\_host</code>):
112
112
 
113
113
  <pre>
114
- # Append random numbers to script paths (defaults to true in development mode)
115
- append_random: false
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 different environment variables with the <code>smart\_asset</code> command.
141
+ You may use environment variables with the <code>smart\_asset</code> command to alter its behavior.
141
142
 
142
- Example:
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'] = @env == 'development'
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
- @append_random = @config['append_random']
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']
@@ -1,3 +1,3 @@
1
1
  class SmartAsset
2
- VERSION = "0.4.4" unless defined?(::SmartAsset::VERSION)
2
+ VERSION = "0.4.5" 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
- - 4
9
- version: 0.4.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-14 00:00:00 -08:00
17
+ date: 2010-12-15 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency