marcisme / guard-copy Goto Github PK
View Code? Open in Web Editor NEWCopy files when they are changed
License: MIT License
Copy files when they are changed
License: MIT License
Not sure why copying of a single file is not part of this plugin.
I think it's a very useful feature.
Hey,
hope you're not going to shoot me down with all these ideas... :)
I'm also developing a Guard and was thinking of implementing a bit more sophisticated folder control in it, quite similar to what you're doing with recreating the folder structure from watchers under the source folder, etc.
But before I just blatantly copy-paste code from your Guard, I was thinking that this is fairly generic functionality for pretty much any Guard which is dealing with files and there's more and more for (pre)compiling various formats, etc.
I can take a stab at trying to isolate this, but wanted to hear first if you think it's a good idea worth exploring?
Hey,
would be nice if there was an option to keep folders in synch by deleting files which are removed from source folder.
I can eventually submit a pull request but as far as I can see you just begun and also I'm a bit intimidated by the thoroughness of the test cases, not sure if my cowboy Ruby skills are enough to keep this quality :)
Just ran into an edge case today, I did a little bit of reorganisation in one of my folders which involved creating a few new folders and moving files into them.
Apparently this wasn't picked up by Guard-Copy, so I had to restart Guard to get them copied across.
I presume this is because of the fact that freshly created folders were involved and might very well be a Guard / Listen bug, but thought I should write down just so it's possible to track it.
This is how my settings look like at the moment:
guard 'copy', {
:from => "#{src_dir}/#{js_dir}",
:to => "#{build_dir}/js",
:mkpath => true,
:delete => true,
:verbose => true,
:run_at_start => true
} do
puts "Starting to watch JavaScript files."
watch(%r{^.*\.js$})
end
hi,
i'm running mac os x, the latest ruby (2.0) and have this config working just fine
guard 'copy', {
:from => tmp1',
:to => 'tmp2',
:mkpath => true,
:delete => true,
:verbose => true,
:run_at_start => true
} do
puts "Starting to watch JavaScript files."
watch(%r{^.*\.js$})
end
but when i use absolute paths
guard 'copy', {
:from => '/Volumes/U3/ru-egogo/tmp1',
:to => '/Volumes/U3/ru-egogo/tmp2',
:mkpath => true,
:delete => true,
:verbose => true,
:absolute => true,
:run_at_start => true
} do
puts "Starting to watch JavaScript files."
watch(%r{^.*\.js$})
end
nothing happens. Am I doing something wrong?
Many thanks for your help.
Would it be possible to have an option to create the target folder on demand?
At the moment I'm using a somewhat dirty hack to make sure the target folder exists:
guard 'copy', :from => 'src/common/img', :to => 'build/img', :delete => true, :verbose => true do
puts "Starting to watch image files."
Dir.mkdir('build/img') unless File.directory?('build/img')
watch(%r{^src/common/img/[^/]*.(jpg|jpeg|png|gif)$})
end
I also use Guard to create a build from scratch on the CI server on each commit where this is quite useful to have.
Thanks!
Would it be possible to include the option to copy / sync all files on startup?
This is a common and very useful pattern on other Guards too, see for example Guard::RSpec:
https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb
Thanks!
https://github.com/marcisme/guard-copy/blob/master/lib/guard/copy.rb#L123
guard :copy, :from => 'assets', :to => '_site/assets' ,:verbose => true,:mkpath => true do
watch(%r{assets/js/.+})
end
i get this Guard::Copy - :to must not include :from
can you remove that check or make so that it checks if target starts with from directory
Just wondering if you plan to support regex based file watching / filtering with the standard guard setup like this (at the moment this doesn't seem to work):
guard 'copy', :from => 'src/common/fonts', :to => 'build/font' do
puts "Starting to watch font files."
Dir.mkdir('build/font') unless File.directory?('build/font')
watch(%r{^#{src_dir}/#{font_dir}/.*\.(woff|svg|ttf)$})
end
Any chance we can update the dependency on Guard ~> 1.1 to Guard ~> 2.0 so as to be in line with other guard utilities (e.g. guard-compass).
The dependency on 1.1 is causing dependency conflicts on my project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.