guard-copy 0.0.5 → 0.0.6

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.md CHANGED
@@ -57,14 +57,16 @@ the directory specified by the `:from` option to that specified by the
57
57
  ### List of available options:
58
58
 
59
59
  ``` ruby
60
- :from => 'source' # directory to copy files from
61
- :to => 'target' # directory or glob to copy files to; string or array
62
- :glob => :newest # how to handle globs; default: :all
63
- # :newest - copy to only the newest directory
64
- # :all - copy to all directories
65
- :delete => true # delete files from target directories; default: false
66
- :verbose => true # log all operations as info messages; default: false
67
- :absolute => true # allow absolute paths for :to; default: false
60
+ :from => 'source' # directory to copy files from
61
+ :to => 'target' # directory or glob to copy files to; string or array
62
+ :glob => :newest # how to handle globs; default: :all
63
+ # :newest - copy to only the newest directory
64
+ # :all - copy to all directories
65
+ :mkpath => true # create directories in target when full target path
66
+ # does not exist; default: false
67
+ :delete => true # delete files from target directories; default: false
68
+ :verbose => true # log all operations as info messages; default: false
69
+ :absolute => true # allow absolute paths for :to; default: false
68
70
  ```
69
71
 
70
72
  ## Watchers
@@ -47,6 +47,11 @@ module Guard
47
47
  def run_on_changes(paths)
48
48
  validate_at_least_one_target('copy')
49
49
  with_all_target_paths(paths) do |from_path, to_path|
50
+ to_dir = File.dirname(to_path)
51
+ if !File.directory?(to_dir) && options[:mkpath]
52
+ UI.info("creating directory #{to_dir}") if options[:verbose]
53
+ FileUtils.mkpath(to_dir)
54
+ end
50
55
  validate_to_path(to_path)
51
56
  UI.info("copying to #{to_path}") if options[:verbose]
52
57
  FileUtils.cp(from_path, to_path)
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module CopyVersion
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-07-23 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  version: '0'
55
55
  segments:
56
56
  - 0
57
- hash: 258885786691457194
57
+ hash: -3415023527263966142
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  segments:
65
65
  - 0
66
- hash: 258885786691457194
66
+ hash: -3415023527263966142
67
67
  requirements: []
68
68
  rubyforge_project:
69
69
  rubygems_version: 1.8.24