guard-sync 0.1.0 → 0.2.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.
- data/lib/guard/sync.rb +39 -20
- data/lib/guard/sync/templates/Guardfile +3 -0
- data/lib/guard/sync/version.rb +1 -1
- metadata +11 -6
- checksums.yaml +0 -15
data/lib/guard/sync.rb
CHANGED
@@ -7,11 +7,14 @@ module Guard
|
|
7
7
|
super
|
8
8
|
@options = {
|
9
9
|
:all_on_start => false,
|
10
|
-
:archive =>
|
10
|
+
:archive => false,
|
11
|
+
:recursive => true,
|
11
12
|
:compress => true,
|
12
|
-
:
|
13
|
+
:permissions => true,
|
13
14
|
:delete => false,
|
14
|
-
:src => '.'
|
15
|
+
:src => '.',
|
16
|
+
:verbose => false,
|
17
|
+
:quiet => true
|
15
18
|
}.merge options
|
16
19
|
update
|
17
20
|
end
|
@@ -20,21 +23,14 @@ module Guard
|
|
20
23
|
run_all if @options[:all_on_start]
|
21
24
|
end
|
22
25
|
|
23
|
-
def stop
|
24
|
-
end
|
25
|
-
|
26
|
-
def reload
|
27
|
-
end
|
28
|
-
|
29
26
|
def run_all
|
30
|
-
UI.info "Guard::Sync is running" if @opts
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
def run_on_changes paths
|
27
|
+
# UI.info "Guard::Sync is running" if @opts
|
28
|
+
UI.info "#{@action}d #{@options[:include]}"
|
29
|
+
`#{@command}` if @opts
|
35
30
|
end
|
36
31
|
|
37
32
|
def run_on_additions paths
|
33
|
+
@action = "create"
|
38
34
|
@options[:exclude] = '*'
|
39
35
|
@options[:include] = paths.to_s[1..-2]
|
40
36
|
@options[:delete] = false
|
@@ -42,10 +38,8 @@ module Guard
|
|
42
38
|
run_all
|
43
39
|
end
|
44
40
|
|
45
|
-
def run_on_modifications paths
|
46
|
-
end
|
47
|
-
|
48
41
|
def run_on_removals paths
|
42
|
+
@action = "remove"
|
49
43
|
@options[:exclude] = '*'
|
50
44
|
@options[:include] = paths.to_s[1..-2]
|
51
45
|
@options[:delete] = true
|
@@ -74,11 +68,28 @@ module Guard
|
|
74
68
|
long_opts = []
|
75
69
|
|
76
70
|
opt_list.push('a') if @options[:archive]
|
77
|
-
opt_list.push('
|
71
|
+
opt_list.push('r') if @options[:recursive]
|
72
|
+
opt_list.push('p') if @options[:permissions]
|
78
73
|
opt_list.push('z') if @options[:compress]
|
74
|
+
opt_list.push('v') if @options[:verbose]
|
75
|
+
opt_list.push('q') if @options[:quiet]
|
76
|
+
|
77
|
+
include_paths = @options[:include]
|
78
|
+
include_paths = include_paths[1..-2] if include_paths
|
79
|
+
split_paths = include_paths.split('/') if include_paths
|
80
|
+
joined_paths = []
|
81
|
+
|
82
|
+
if split_paths.kind_of?(Array)
|
83
|
+
included_paths = []
|
84
|
+
split_paths.each_with_index do |path, index|
|
85
|
+
combined_path = get_combined_path split_paths, index
|
86
|
+
included_paths << "--include=#{combined_path.chop}"
|
87
|
+
end
|
88
|
+
joined_paths = included_paths.join(" ")
|
89
|
+
end
|
79
90
|
|
80
91
|
long_opts.push('--del') if @options[:delete]
|
81
|
-
long_opts.push(
|
92
|
+
long_opts.push(joined_paths) if @options[:include] and joined_paths
|
82
93
|
long_opts.push("--exclude=#{@options[:exclude]}") if @options[:exclude]
|
83
94
|
|
84
95
|
raise :MissingOptions, "No options to pass to rsync" unless opt_list != []
|
@@ -87,7 +98,15 @@ module Guard
|
|
87
98
|
long_opts = long_opts.reduce { |a,b| a + ' ' + b }
|
88
99
|
|
89
100
|
@opts = @opts + " #{long_opts}" if long_opts
|
90
|
-
|
101
|
+
end
|
102
|
+
|
103
|
+
def get_combined_path array, num
|
104
|
+
path = ''
|
105
|
+
array.each_with_index do |folder, i|
|
106
|
+
path << "#{folder}/"
|
107
|
+
break if i == num
|
108
|
+
end unless array.length < num
|
109
|
+
path
|
91
110
|
end
|
92
111
|
end
|
93
112
|
end
|
data/lib/guard/sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Kyle Cook
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-17 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: guard
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: bundler
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -53,26 +58,26 @@ files:
|
|
53
58
|
homepage: ''
|
54
59
|
licenses:
|
55
60
|
- MIT
|
56
|
-
metadata: {}
|
57
61
|
post_install_message:
|
58
62
|
rdoc_options: []
|
59
63
|
require_paths:
|
60
64
|
- lib
|
61
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
62
67
|
requirements:
|
63
68
|
- - ! '>='
|
64
69
|
- !ruby/object:Gem::Version
|
65
70
|
version: '0'
|
66
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
67
73
|
requirements:
|
68
74
|
- - ! '>='
|
69
75
|
- !ruby/object:Gem::Version
|
70
76
|
version: '0'
|
71
77
|
requirements: []
|
72
78
|
rubyforge_project:
|
73
|
-
rubygems_version:
|
79
|
+
rubygems_version: 1.8.23
|
74
80
|
signing_key:
|
75
|
-
specification_version:
|
81
|
+
specification_version: 3
|
76
82
|
summary: Synchronization for guard
|
77
83
|
test_files: []
|
78
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
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=
|