guard-mirror 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. data/lib/guard/mirror.rb +18 -7
  2. metadata +2 -2
@@ -37,20 +37,19 @@ module ::Guard
37
37
 
38
38
  @options[:paths].each { |path| @env.append_path path }
39
39
 
40
- if @options[:compress]
41
- @env.js_compressor = ::Closure::Compiler.new
42
- @env.css_compressor = ::YUI::CssCompressor.new
43
- end
40
+ enable_compression if @options[:compress] == true
44
41
 
45
42
  end
46
43
 
47
44
  def start
48
45
  UI.info 'A mirror has started.'
49
- run_all
46
+ run_all false
50
47
  end
51
48
 
52
- def run_all
53
- UI.info 'Mirroring all files...'
49
+ def run_all compress = true
50
+ compress = (compress && @options[:compress] == :run_all) ||
51
+ @options[:compress] == true
52
+ UI.info "Mirroring #{compress ? 'and compressing ' : ''}all files..."
54
53
  if @options[:target]
55
54
  paths = [@options[:target]]
56
55
  else
@@ -60,7 +59,9 @@ module ::Guard
60
59
  end
61
60
  end.flatten
62
61
  end
62
+ enable_compression if compress
63
63
  run_on_changes paths
64
+ disable_compression unless @options[:compress] == true
64
65
  end
65
66
 
66
67
  def run_on_changes paths
@@ -98,5 +99,15 @@ module ::Guard
98
99
  File.expand_path "#{@options[:dest]}/#{path}"
99
100
  end
100
101
 
102
+ def enable_compression
103
+ @env.js_compressor = ::Closure::Compiler.new
104
+ @env.css_compressor = ::YUI::CssCompressor.new
105
+ end
106
+
107
+ def disable_compression
108
+ @env.js_compressor = nil
109
+ @env.css_compressor = nil
110
+ end
111
+
101
112
  end
102
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-08 00:00:00.000000000 Z
12
+ date: 2012-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard