front-end-blender 0.22 → 0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ require 'rubygems'
9
9
  require 'yaml'
10
10
  require 'base64'
11
11
  require 'benchmark'
12
- require 'colored'
12
+ require 'colored' unless PLATFORM =~ /win32/ && !Gem.available?('win32console')
13
13
  require 'mime/types'
14
14
  require 'find'
15
15
  require 'pathname'
@@ -18,7 +18,7 @@ require 'front_end_architect/hash'
18
18
 
19
19
  module FrontEndArchitect
20
20
  class Blender
21
- VERSION = '0.22'
21
+ VERSION = '0.23'
22
22
 
23
23
  FILTER_REGEX = /filter: ?[^?]+\(src=(['"])([^\?'"]+)(\?(?:[^'"]+)?)?\1,[^?]+\1\);/im
24
24
  IMPORT_REGEX = /@import(?: url\(| )(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]+)?)?\1\)?(?:[^?;]+)?;/im
@@ -30,6 +30,7 @@ module FrontEndArchitect
30
30
  :force => false,
31
31
  :root => File.dirname(:blendfile.to_s),
32
32
  :min => :yui,
33
+ :colored => (Object.const_defined? :Colored),
33
34
  }
34
35
 
35
36
  def initialize(opts)
@@ -82,12 +83,12 @@ module FrontEndArchitect
82
83
  if File.writable?(output_name) && !(@options[:gzip] && !File.writable?(gzip_output_name))
83
84
  create_output(output_name, sources, file_type)
84
85
  else
85
- puts 'Permission Denied:'.white_on_red + ' ' + output_name.red
86
- puts 'Permission Denied:'.white_on_red + ' ' + gzip_output_name.red if @options[:gzip]
86
+ puts_colored 'Permission Denied:' + ' ' + output_name, :red
87
+ puts_colored 'Permission Denied:' + ' ' + gzip_output_name, :red if @options[:gzip]
87
88
  end
88
89
  else
89
- puts 'Skipping: '.yellow + output_name.yellow
90
- puts 'Skipping: '.yellow + gzip_output_name.yellow if @options[:gzip]
90
+ puts_colored 'Skipping: ' + output_name, :yellow
91
+ puts_colored 'Skipping: ' + gzip_output_name, :yellow if @options[:gzip]
91
92
  end
92
93
  else
93
94
  create_output(output_name, sources, file_type)
@@ -136,6 +137,14 @@ module FrontEndArchitect
136
137
 
137
138
  protected
138
139
 
140
+ def puts_colored(output, color)
141
+ if @options[:colored]
142
+ puts Colored.colorize(output, { :foreground => color })
143
+ else
144
+ puts output
145
+ end
146
+ end
147
+
139
148
  def flatten_blendfile(value, key=nil, context=[])
140
149
  if value.is_a? Hash
141
150
  context << key unless key.nil?
@@ -225,7 +234,7 @@ module FrontEndArchitect
225
234
  output_file << output
226
235
  end
227
236
 
228
- puts output_name.green
237
+ puts_colored output_name, :green
229
238
 
230
239
  if @options[:gzip]
231
240
  output_gzip = output_name + '.gz'
@@ -234,12 +243,12 @@ module FrontEndArchitect
234
243
  gz.write(output)
235
244
  end
236
245
 
237
- puts output_gzip.green
246
+ puts_colored output_gzip, :green
238
247
  end
239
248
  end
240
249
 
241
250
  def process_css(input_file, output_path)
242
- # TODO Move this to a seperate class and clean it up A LOT. For 1.1
251
+ # TODO Move this to a seperate class and clean it up A LOT. For 2.0
243
252
 
244
253
  # Determine full path of input file
245
254
  input_path = Pathname.new(File.dirname(input_file))
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.22"
4
+ version: "0.23"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Elshire
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-18 00:00:00 -08:00
13
+ date: 2008-11-23 00:00:00 -08:00
14
14
  default_executable: blend
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency