front-end-blender 0.16 → 0.17

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.rdoc CHANGED
@@ -62,16 +62,17 @@ Other examples:
62
62
 
63
63
  == Installation
64
64
 
65
- To install the RubyGem, run the following at the command line:
66
- sudo gem sources --add http://gems.github.com
67
- sudo gem install front-end-blender
65
+ To install the RubyGem, run the following at the command line (you may need to use a command such as su or sudo):
66
+ gem install mime-types
67
+ gem install colored
68
+ gem install front-end-blender --source http://gems.github.com
68
69
 
69
- * Java, v1.4 or greater is required
70
- * RubyGems, v1.2 or greater is recommended
70
+ If you're using Windows, you'll also need to run the following:
71
+ gem install win32console
71
72
 
72
- Ruby installation instructions for your platform can be found here: http://www.ruby-lang.org/en/downloads/
73
- Instructions for downloading & installing RubyGems can be found here: http://rubygems.org/read/chapter/3
74
- Download and install Java here: http://java.com/en/
73
+ * Java v1.4 or greater is required, http://java.com/en/
74
+ * Ruby v1.8.6 or greater is required, http://www.ruby-lang.org/en/downloads/
75
+ * RubyGems v1.2 or greater is recommended, http://rubygems.org/read/chapter/3
75
76
 
76
77
  == License
77
78
 
@@ -4,8 +4,6 @@
4
4
  # Blender is freely distributable under the terms of an MIT-style license.
5
5
  # For details, see http://www.opensource.org/licenses/mit-license.php
6
6
 
7
- # TODO Nearly all file name comparisons should be case-insensitive
8
-
9
7
  $:.unshift File.join(File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__), *%w[..])
10
8
 
11
9
  require 'rubygems'
@@ -21,7 +19,7 @@ require 'front_end_architect/hash'
21
19
 
22
20
  module FrontEndArchitect
23
21
  class Blender
24
- VERSION = '0.16'
22
+ VERSION = '0.17'
25
23
 
26
24
  FILTER_REGEX = /filter: ?[^?]+\(src=(['"])([^\?'"]+)(\?(?:[^'"]+)?)?\1,[^?]+\1\);/im
27
25
  IMPORT_REGEX = /@import(?: url\(| )(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]+)?)?\1\)?(?:[^?;]+)?;/im
@@ -80,12 +78,12 @@ module FrontEndArchitect
80
78
  if File.writable?(output_name) && !(@options[:gzip] && !File.writable?(gzip_output_name))
81
79
  create_output(output_name, sources, file_type)
82
80
  else
83
- puts "Permission Denied:".white_on_red + " " + output_name.red
84
- puts "Permission Denied:".white_on_red + " " + gzip_output_name.red if @options[:gzip]
81
+ puts 'Permission Denied:'.white_on_red + ' ' + output_name.red
82
+ puts 'Permission Denied:'.white_on_red + ' ' + gzip_output_name.red if @options[:gzip]
85
83
  end
86
84
  else
87
- puts "Skipping: ".yellow + output_name.yellow
88
- puts "Skipping: ".yellow + gzip_output_name.yellow if @options[:gzip]
85
+ puts 'Skipping: '.yellow + output_name.yellow
86
+ puts 'Skipping: '.yellow + gzip_output_name.yellow if @options[:gzip]
89
87
  end
90
88
  else
91
89
  create_output(output_name, sources, file_type)
@@ -107,16 +105,15 @@ module FrontEndArchitect
107
105
  Find.find(Dir.getwd) do |f|
108
106
  basename = File.basename(f)
109
107
 
110
- if FileTest.directory?(f) && (basename[0] == ?. || basename.match(/^(yui|tinymce|dojo|wp-includes|wp-admin|mint)$/) || (File.basename(f) == 'rails' && File.basename(File.dirname(f)) == 'vendor'))
108
+ if FileTest.directory?(f) && (basename[0] == ?. || basename.match(/^(yui|tinymce|dojo|wp-includes|wp-admin|mint)$/i) || (File.basename(f).downcase == 'rails' && File.basename(File.dirname(f)).downcase == 'vendor'))
111
109
  Find.prune
112
- elsif !(basename.match(/[-.](pack|min)\.(css|js)$/) || basename.match(/^(sifr\.js|ext\.js|mootools.*\.js)$/))
113
- # TODO Test for 'pack.js' and 'min.css' where the folder name serves as the identifier
110
+ elsif !(basename.match(/(^|[-.])(pack|min)\.(css|js)$/i) || basename.match(/^(sifr\.js|ext\.js|mootools.*\.js)$/i))
114
111
  # TODO Check file contents instead of name for minification (port YSlow's isMinified)
115
112
  f.gsub!(Dir.getwd.to_s + '/', '')
116
113
 
117
- if File.extname(f) == '.css' || File.extname(f) == '.js'
118
- min_file = basename.sub(/\.(css|js)$/, '-min.\1')
119
- path = File.dirname(f).split('/') # File#dirname depends on /
114
+ if File.extname(f).downcase == '.css' || File.extname(f).downcase == '.js'
115
+ min_file = basename.sub(/\.(css|js)$/i, '-min.\1')
116
+ path = File.dirname(f).split('/') # File::dirname depends on /
120
117
 
121
118
  path.push min_file
122
119
  path.push [basename]
@@ -171,7 +168,7 @@ module FrontEndArchitect
171
168
  imports = ''
172
169
 
173
170
  sources.each do |i|
174
- if File.extname(i) == '.css'
171
+ if File.extname(i).downcase == '.css'
175
172
  processed_output, processed_imports = process_css(i, output_path)
176
173
 
177
174
  output << processed_output
@@ -181,7 +178,7 @@ module FrontEndArchitect
181
178
  end
182
179
  end
183
180
 
184
- if File.extname(output_name) == '.css' && !imports.empty?
181
+ if File.extname(output_name).downcase == '.css' && !imports.empty?
185
182
  output.insert(0, imports)
186
183
  end
187
184
 
@@ -208,9 +205,9 @@ module FrontEndArchitect
208
205
 
209
206
  # Data
210
207
  if @options[:data]
211
- if File.extname(output_name) == '.css'
208
+ if File.extname(output_name).downcase == '.css'
212
209
  output = output.gsub(URL_REGEX) do
213
- unless $2.include?('.css')
210
+ unless $2.downcase.include?('.css')
214
211
  mime_type = MIME::Types.type_for($2)
215
212
  url_contents = make_data_uri(IO.read($2), mime_type[0])
216
213
  else
@@ -249,7 +246,7 @@ module FrontEndArchitect
249
246
  input = input.gsub(FILTER_REGEX) do |filter|
250
247
  uri = $2
251
248
  cbuster = $3
252
- unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/)
249
+ unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/i)
253
250
  full_path = File.expand_path($2, File.dirname(input_file))
254
251
  buster = make_cache_buster(full_path, $3)
255
252
  new_path = uri.to_s + buster
@@ -270,7 +267,7 @@ module FrontEndArchitect
270
267
  asset_path = Pathname.new(File.join(File.expand_path(@options[:root]), uri))
271
268
  end
272
269
 
273
- unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/)
270
+ unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/i)
274
271
  if (output_path != input_path)
275
272
 
276
273
  new_path = asset_path.relative_path_from(output_path)
@@ -297,11 +294,12 @@ module FrontEndArchitect
297
294
  if output_path == input_path
298
295
  if @options[:data]
299
296
  input = input.gsub(URL_REGEX) do
300
- uri = $2
297
+ uri = $2
301
298
  cbuster = $3
302
299
 
303
- unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/)
300
+ unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/i)
304
301
  new_path = File.expand_path($2, File.dirname(input_file))
302
+
305
303
  if uri.match(/^(\/[^\/]+.+)$/)
306
304
  new_path = Pathname.new(File.join(File.expand_path(@options[:root]), uri))
307
305
  end
@@ -313,8 +311,8 @@ module FrontEndArchitect
313
311
  end
314
312
  elsif @options[:cache_buster]
315
313
  input = input.gsub(URL_REGEX) do
316
- unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/)
317
- uri = $2
314
+ unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/i)
315
+ uri = $2
318
316
  cbuster = $3
319
317
 
320
318
  if uri.match(/^(\/[^\/]+.+)$/)
@@ -337,11 +335,12 @@ module FrontEndArchitect
337
335
  else
338
336
  # Find all url(.ext) in file and rewrite relative url from output directory.
339
337
  input = input.gsub(URL_REGEX) do
340
- uri = $2
338
+ uri = $2
341
339
  cbuster = $3
342
- unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/)
340
+
341
+ unless uri.match(/^(https:\/\/|http:\/\/|\/\/)/i)
343
342
  if @options[:data]
344
- # if doing data conversion rewrite url as an absolute path.
343
+ # if doing data conversion rewrite url as an absolute path
345
344
  new_path = File.expand_path(uri, File.dirname(input_file))
346
345
 
347
346
  if uri.match(/^(\/[^\/]+.+)$/)
@@ -354,7 +353,7 @@ module FrontEndArchitect
354
353
  asset_path = Pathname.new(File.join(File.expand_path(@options[:root]), uri))
355
354
  end
356
355
 
357
- new_path = asset_path.relative_path_from(output_path)
356
+ new_path = asset_path.relative_path_from(output_path)
358
357
 
359
358
  if @options[:cache_buster]
360
359
  buster = make_cache_buster(asset_path, $3)
@@ -383,7 +382,7 @@ module FrontEndArchitect
383
382
 
384
383
  if @options[:cache_buster] == :mtime
385
384
  file_mtime = File.mtime(asset_path).to_i
386
- buster = query_string + file_mtime.to_s
385
+ buster = query_string + file_mtime.to_s
387
386
  else
388
387
  buster = query_string + @options[:cache_buster]
389
388
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: front-end-blender
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.16"
4
+ version: "0.17"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Elshire & Chris Griego
@@ -9,7 +9,7 @@ autorequire: front_end_architect/blend
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-17 00:00:00 -07:00
12
+ date: 2008-09-24 00:00:00 -07:00
13
13
  default_executable: blend
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency