guard-copy 0.0.8 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzMyNDhjMzRjMjViNzRjMWU5YjhmYWZiNmM3YmM3NTYyM2M1ZTFlZQ==
4
+ NTFmYjQ2ZDExYmEwODNkNDI2NmQyOThkNThjMGQyZTZlZDg3OGI5ZQ==
5
5
  data.tar.gz: !binary |-
6
- YjU4YTc0ZmRmYWI2MGY2NGMyNDM5NjhiMmRlNmY2Mjc4ZWU3YWE3Yw==
7
- !binary "U0hBNTEy":
6
+ YzMyODZlZmZkMWM0MjE2MzYyOWMxNDAzZTU2NGE1NTdlM2Q2Mzk4MA==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- MTVjNzRhMTkwNzYyZjBjNmMzNWMyZGFjNjZmZGU3ZDE4YWFkZDJhNTM4YWMw
10
- MTI2YmEzNWJlMDk3YmJmYWM2Mjk2OWQxMTY5ODUzYjhmYTQ5NWE3MGU3ZGYw
11
- NWZhZjE5MTQxZDY2Yjg3N2QxY2JjYzljMDJmMzQ2ZjA0ZDYzMWM=
9
+ MTQ0ZWU4NTQyZDExZmIxOTI1ZjlkNjIxNDVlOGZmMjkyOTAwNzFjZGU3ODA2
10
+ MWRjNGUxZDFlODVhMmU1Y2UwYmU1NDBiODZiMDdmNzc4OTQyYWIyMjJmZmQz
11
+ OWNlMzZkNDYzMTNiMjIwYTA2ZTIxNjVlMjQ5MjM3MmQxNGFlOTU=
12
12
  data.tar.gz: !binary |-
13
- ZDIyYmYzM2E4M2Q0MzgzMDI5YmM2ZDc1MmFjOWQwMDkwODU4ZjA0YTJmNTU0
14
- ZTJlYjAwZTBiZTVlOTkxMTg5ZGZkZTE3YzJlYTlhZTgxNzE4Zjc0NjZiZDk0
15
- OTNjODlhODljMDQ0M2NmNjZmZmRiMmQzOGNkODhhZTRlOGMzYWE=
13
+ N2FkNjAyNWRjODMxYTY4ZDlkMzZjNzVmMGI3MDQ0NTY5MTg0MjUxNzIzNDZl
14
+ NWI4MzA1YTcxMzNjODQwMTg2YTIxZTM3ZTkzYTE4OTFiNjNiNjJkN2YwMjdj
15
+ OGI1YjAzY2VlMTE1YzA3YzcyYmIzNmEzMjM0Y2E1MTBiM2Q0ZTU=
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Copy guard copies files to one or more locations whenever files are
4
4
  created or modified.
5
5
 
6
- * Tested against Ruby 1.8.7, 1.9.2, 1.9.3, and the latest versions of JRuby
6
+ * Tested against Ruby 1.9.3, 2.0.0 and the latest version of JRuby
7
7
 
8
8
  ## Installation
9
9
 
data/lib/guard/copy.rb CHANGED
@@ -1,24 +1,28 @@
1
1
  require 'guard'
2
- require 'guard/guard'
2
+ require 'guard/plugin'
3
3
  require 'fileutils'
4
4
 
5
5
  module Guard
6
- class Copy < Guard
6
+ class Copy < Plugin
7
7
 
8
8
  autoload :Target, 'guard/copy/target'
9
9
 
10
10
  attr_reader :targets
11
11
 
12
- # Initialize a Guard.
13
- # @param [Array<Guard::Watcher>] watchers the Guard file watchers
14
- # @param [Hash] options the custom Guard options
15
- def initialize(watchers = [], options = {})
12
+ # Initializes a Guard plugin.
13
+ # Don't do any work here, especially as Guard plugins get initialized even
14
+ # if they are not in an active group!
15
+ #
16
+ # @param [Hash] options the Guard plugin options
17
+ # @option options [Array<Guard::Watcher>] watchers the Guard plugin file
18
+ # watchers
19
+ # @option options [Symbol] group the group this Guard plugin belongs to
20
+ # @option options [Boolean] any_return allow any object to be returned from
21
+ # a watcher
22
+ #
23
+ def initialize(options = {})
24
+ inject_watchers(options)
16
25
  super
17
- if watchers.empty?
18
- watchers << ::Guard::Watcher.new(%r{^#{options[:from]}/.*$})
19
- else
20
- watchers.each { |w| normalize_watcher(w, options[:from]) }
21
- end
22
26
  @targets = Array(options[:to]).map { |to| Target.new(to, options) }
23
27
  end
24
28
 
@@ -76,6 +80,14 @@ module Guard
76
80
 
77
81
  private
78
82
 
83
+ def inject_watchers(options)
84
+ if !options[:watchers] || options[:watchers].empty?
85
+ options[:watchers] = [::Guard::Watcher.new(%r{^#{options[:from]}/.*$})]
86
+ else
87
+ options[:watchers].each { |w| normalize_watcher(w, options[:from]) }
88
+ end
89
+ end
90
+
79
91
  def target_paths
80
92
  @targets.map { |t| t.paths }.flatten
81
93
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module CopyVersion
3
- VERSION = "0.0.8"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Schwieterman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-05 00:00:00.000000000 Z
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.1'
26
+ version: '2.0'
27
27
  description: Guard::Copy automatically copies files.
28
28
  email:
29
29
  - marc.schwieterman@gmail.com
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.0.2
59
+ rubygems_version: 2.1.5
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Guard gem for copy