public
Rubygem
Description: Blender is like ant or make for the front-end. It aggregates and compresses CSS and/or JavaScript assets for a site into efficient, production-ready files.
Homepage: http://front-end-architect.lighthouseapp.com/projects/11475-blender/overview
Clone URL: git://github.com/front-end/front-end-blender.git
Fixed unhandled win32console gem dependency. [#35 status:resolved]
cgriego (author)
Sun Nov 23 21:53:45 -0800 2008
commit  4902f07a3d229a4930612e2ba23764b649d14c45
tree    8b64b6388084a1acdebf1b7670304482fc661656
parent  a1f2e8c1f0b3cd3be58e33c02f502e74683dfffd
...
2
3
4
5
 
6
7
8
9
 
10
11
12
...
2
3
4
 
5
6
7
8
 
9
10
11
12
0
@@ -2,11 +2,11 @@
0
 
0
 Gem::Specification.new do |s|
0
   s.name = %q{blender}
0
-  s.version = "0.22"
0
+  s.version = "0.23"
0
 
0
   s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
0
   s.authors = ["Blake Elshire", "Chris Griego"]
0
-  s.date = %q{2008-11-18}
0
+  s.date = %q{2008-11-23}
0
   s.default_executable = %q{blend}
0
   s.description = %q{Blender is like ant or make for the front-end. It aggregates and compresses CSS and/or JavaScript assets for a site into efficient, production-ready files.}
0
   s.email = %q{blender@front-end-architect.com}
...
9
10
11
12
 
13
14
15
...
18
19
20
21
 
22
23
24
...
30
31
32
 
33
34
35
...
82
83
84
85
86
 
 
87
88
89
90
 
 
91
92
93
...
136
137
138
 
 
 
 
 
 
 
 
139
140
141
...
225
226
227
228
 
229
230
231
...
234
235
236
237
 
238
239
240
241
242
 
243
244
245
...
9
10
11
 
12
13
14
15
...
18
19
20
 
21
22
23
24
...
30
31
32
33
34
35
36
...
83
84
85
 
 
86
87
88
89
 
 
90
91
92
93
94
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
234
235
236
 
237
238
239
240
...
243
244
245
 
246
247
248
249
250
 
251
252
253
254
0
@@ -9,7 +9,7 @@ require 'rubygems'
0
 require 'yaml'
0
 require 'base64'
0
 require 'benchmark'
0
-require 'colored'
0
+require 'colored' unless PLATFORM =~ /win32/ && !Gem.available?('win32console')
0
 require 'mime/types'
0
 require 'find'
0
 require 'pathname'
0
@@ -18,7 +18,7 @@ require 'front_end_architect/hash'
0
 
0
 module FrontEndArchitect
0
   class Blender
0
-    VERSION = '0.22'
0
+    VERSION = '0.23'
0
     
0
     FILTER_REGEX = /filter: ?[^?]+\(src=(['"])([^\?'"]+)(\?(?:[^'"]+)?)?\1,[^?]+\1\);/im
0
     IMPORT_REGEX = /@import(?: url\(| )(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]+)?)?\1\)?(?:[^?;]+)?;/im
0
@@ -30,6 +30,7 @@ module FrontEndArchitect
0
       :force     => false,
0
       :root      => File.dirname(:blendfile.to_s),
0
       :min       => :yui,
0
+      :colored   => (Object.const_defined? :Colored),
0
     }
0
     
0
     def initialize(opts)
0
@@ -82,12 +83,12 @@ module FrontEndArchitect
0
                 if File.writable?(output_name) && !(@options[:gzip] && !File.writable?(gzip_output_name))
0
                   create_output(output_name, sources, file_type)
0
                 else
0
-                  puts 'Permission Denied:'.white_on_red + ' ' + output_name.red
0
-                  puts 'Permission Denied:'.white_on_red + ' ' + gzip_output_name.red if @options[:gzip]
0
+                  puts_colored 'Permission Denied:' + ' ' + output_name,      :red
0
+                  puts_colored 'Permission Denied:' + ' ' + gzip_output_name, :red if @options[:gzip]
0
                 end
0
               else
0
-                puts 'Skipping: '.yellow + output_name.yellow
0
-                puts 'Skipping: '.yellow + gzip_output_name.yellow if @options[:gzip]
0
+                puts_colored 'Skipping: ' + output_name,      :yellow
0
+                puts_colored 'Skipping: ' + gzip_output_name, :yellow if @options[:gzip]
0
               end
0
             else
0
               create_output(output_name, sources, file_type)
0
@@ -136,6 +137,14 @@ module FrontEndArchitect
0
     
0
     protected
0
     
0
+    def puts_colored(output, color)
0
+      if @options[:colored]
0
+        puts Colored.colorize(output, { :foreground => color })
0
+      else
0
+        puts output
0
+      end
0
+    end
0
+    
0
     def flatten_blendfile(value, key=nil, context=[])
0
       if value.is_a? Hash
0
         context << key unless key.nil?
0
@@ -225,7 +234,7 @@ module FrontEndArchitect
0
         output_file << output
0
       end
0
       
0
-      puts output_name.green
0
+      puts_colored output_name, :green
0
       
0
       if @options[:gzip]
0
         output_gzip = output_name + '.gz'
0
@@ -234,12 +243,12 @@ module FrontEndArchitect
0
           gz.write(output)
0
         end
0
         
0
-        puts output_gzip.green
0
+        puts_colored output_gzip, :green
0
       end
0
     end
0
     
0
     def process_css(input_file, output_path)
0
-      # TODO Move this to a seperate class and clean it up A LOT. For 1.1
0
+      # TODO Move this to a seperate class and clean it up A LOT. For 2.0
0
       
0
       # Determine full path of input file
0
       input_path    = Pathname.new(File.dirname(input_file))

Comments