guard-sync 0.1.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 +15 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/lib/guard/sync.rb +93 -0
- data/lib/guard/sync/templates/Guardfile +0 -0
- data/lib/guard/sync/version.rb +5 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTViMjAyZjM3ODhhOWM1MDVlNzBmYTFiYzJkYWUzMDYxZTQyMDQ2ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTBmYjI4N2VhZmY4MzRmZmZiMTE0OTY1YzU1ZTk2ZmU3Mzk3NjQ0MA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzA4MmUyMjYzNDlkZDQ4NDM0MDQ1NzQzODAyNTIxN2I2NGRmMGM1MjBhMGFj
|
10
|
+
MDhmYzliODljNTQ0NDhjMzZmOTg0Y2UwMTk4MjMxN2U4ZGFiMDcwMmMxNGNh
|
11
|
+
MDliMDRmNWE1MTExZTY2ZmFiMjlhNDcwYjJhOGMwMTdiNjY4Yzg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Mjg1NzkyOTczMDllZWYzZDA0MmI2YWI5YjBjYjBlNTA4YWExZGYwNzkyNzk3
|
14
|
+
YTU1NGIzYzcyMGJmNGRiYTlmNWNhNTJhNTU4YWE0NDYwY2Q2MDQwZmMyZDU2
|
15
|
+
YjhlZGZkNjg5N2NkODJiYmVjZjRkMTQwMTFjY2I2ZDY3OTE3Mjg=
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kyle Cook
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Guard::Sync
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'guard-sync'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install guard-sync
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/lib/guard/sync.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require "guard"
|
2
|
+
require "guard/guard"
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
class Sync < Guard
|
6
|
+
def initialize(watchers = [], options = {})
|
7
|
+
super
|
8
|
+
@options = {
|
9
|
+
:all_on_start => false,
|
10
|
+
:archive => true,
|
11
|
+
:compress => true,
|
12
|
+
:verbose => false,
|
13
|
+
:delete => false,
|
14
|
+
:src => '.'
|
15
|
+
}.merge options
|
16
|
+
update
|
17
|
+
end
|
18
|
+
|
19
|
+
def start
|
20
|
+
run_all if @options[:all_on_start]
|
21
|
+
end
|
22
|
+
|
23
|
+
def stop
|
24
|
+
end
|
25
|
+
|
26
|
+
def reload
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_all
|
30
|
+
UI.info "Guard::Sync is running" if @opts
|
31
|
+
%x{#{@command}} if @opts
|
32
|
+
end
|
33
|
+
|
34
|
+
def run_on_changes paths
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_on_additions paths
|
38
|
+
@options[:exclude] = '*'
|
39
|
+
@options[:include] = paths.to_s[1..-2]
|
40
|
+
@options[:delete] = false
|
41
|
+
update
|
42
|
+
run_all
|
43
|
+
end
|
44
|
+
|
45
|
+
def run_on_modifications paths
|
46
|
+
end
|
47
|
+
|
48
|
+
def run_on_removals paths
|
49
|
+
@options[:exclude] = '*'
|
50
|
+
@options[:include] = paths.to_s[1..-2]
|
51
|
+
@options[:delete] = true
|
52
|
+
update
|
53
|
+
run_all
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def update
|
59
|
+
begin
|
60
|
+
update_options
|
61
|
+
update_command
|
62
|
+
rescue :MissingOptions => e
|
63
|
+
UI.info "Guard::Sync did not run successfully: #{e}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def update_command
|
68
|
+
raise :MissingOptions, "Missing either :src, :host, or :dest" unless @options[:src] and @options[:host] and @options[:dest]
|
69
|
+
@command = "rsync #{@opts} #{@options[:src]} #{@options[:host]}:#{@options[:dest]}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def update_options
|
73
|
+
opt_list = []
|
74
|
+
long_opts = []
|
75
|
+
|
76
|
+
opt_list.push('a') if @options[:archive]
|
77
|
+
opt_list.push('v') if @options[:verbose]
|
78
|
+
opt_list.push('z') if @options[:compress]
|
79
|
+
|
80
|
+
long_opts.push('--del') if @options[:delete]
|
81
|
+
long_opts.push("--include=#{@options[:include]}") if @options[:include]
|
82
|
+
long_opts.push("--exclude=#{@options[:exclude]}") if @options[:exclude]
|
83
|
+
|
84
|
+
raise :MissingOptions, "No options to pass to rsync" unless opt_list != []
|
85
|
+
|
86
|
+
@opts = '-'+opt_list.reduce { |a,b| a + b }
|
87
|
+
long_opts = long_opts.reduce { |a,b| a + ' ' + b }
|
88
|
+
|
89
|
+
@opts = @opts + " #{long_opts}" if long_opts
|
90
|
+
puts @opts
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-sync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle Cook
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
description: Synchronizes a directory to a remote host
|
42
|
+
email:
|
43
|
+
- kylecook80@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/guard/sync/templates/Guardfile
|
49
|
+
- lib/guard/sync/version.rb
|
50
|
+
- lib/guard/sync.rb
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
homepage: ''
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.0.3
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Synchronization for guard
|
77
|
+
test_files: []
|
78
|
+
has_rdoc:
|