guard-remote-sync 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -5
- data/lib/guard/remote-sync/command.rb +2 -2
- data/lib/guard/remote-sync/version.rb +1 -1
- data/lib/guard/remote-sync.rb +10 -10
- metadata +1 -1
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
guard-
|
1
|
+
guard-remote-sync
|
2
2
|
============
|
3
3
|
|
4
4
|
**Usage**
|
@@ -7,8 +7,8 @@ bundle exec guard
|
|
7
7
|
```
|
8
8
|
|
9
9
|
**Example Guardfile**
|
10
|
-
```
|
11
|
-
guard '
|
10
|
+
```ruby
|
11
|
+
guard 'remote-sync',
|
12
12
|
:source => ".",
|
13
13
|
:destination => '/export/home/{username}/tmp',
|
14
14
|
:user => '{user}',
|
@@ -20,5 +20,3 @@ guard 'rsync-remote',
|
|
20
20
|
watch(%r{^.+\.(js|xml|php|class|config)$})
|
21
21
|
end
|
22
22
|
```
|
23
|
-
|
24
|
-
A more extensive and tested rsync guard
|
@@ -12,9 +12,9 @@ module Guard
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def sync
|
15
|
-
UI.info "Guard::
|
15
|
+
UI.info "Guard::RemoteSync `#{@command}`"
|
16
16
|
r = `#{@command}`
|
17
|
-
UI.info "Guard::
|
17
|
+
UI.info "Guard::RemoteSync Status : \n #{r}" if @options[:verbose]
|
18
18
|
end
|
19
19
|
|
20
20
|
def test
|
data/lib/guard/remote-sync.rb
CHANGED
@@ -45,9 +45,9 @@ module Guard
|
|
45
45
|
# Call once when Guard starts. Please override initialize method to init stuff.
|
46
46
|
# @raise [:task_has_failed] when start has failed
|
47
47
|
def start
|
48
|
-
throw([:task_has_failed], "Guard::
|
49
|
-
UI.info "Guard::
|
50
|
-
Notifier.notify("Guard::
|
48
|
+
throw([:task_has_failed], "Guard::RemoteSync options invalid") unless options_valid?
|
49
|
+
UI.info "Guard::RemoteSync started in source directory '#{File.expand_path @source.directory}'"
|
50
|
+
Notifier.notify("Guard::RemoteSync is running in directory #{File.expand_path @source.directory}", notifier_options)
|
51
51
|
@command.sync if options[:sync_on_start] && @command.test
|
52
52
|
|
53
53
|
end
|
@@ -56,15 +56,15 @@ module Guard
|
|
56
56
|
# @raise [:task_has_failed] when stop has failed
|
57
57
|
|
58
58
|
def stop
|
59
|
-
UI.info "Guard::
|
60
|
-
Notifier.notify("Guard::
|
59
|
+
UI.info "Guard::RemoteSync stopped."
|
60
|
+
Notifier.notify("Guard::RemoteSync stopped.",notifier_options)
|
61
61
|
end
|
62
62
|
|
63
63
|
# Called when `reload|r|z + enter` is pressed.
|
64
64
|
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
65
65
|
# @raise [:task_has_failed] when reload has failed
|
66
66
|
def reload
|
67
|
-
Notifier.notify("Manual Guard::
|
67
|
+
Notifier.notify("Manual Guard::RemoteSync synchronize #{File.expand_path @source.directory} to #{@destination.directory}",notifier_options)
|
68
68
|
@command.sync
|
69
69
|
end
|
70
70
|
|
@@ -72,7 +72,7 @@ module Guard
|
|
72
72
|
# This method should be principally used for long action like running all specs/tests/...
|
73
73
|
# @raise [:task_has_failed] when run_all has failed
|
74
74
|
def run_all
|
75
|
-
Notifier.notify("Manual Guard::
|
75
|
+
Notifier.notify("Manual Guard::RemoteSync synchronize #{@source.directory} to #{@destination.directory}",notifier_options)
|
76
76
|
@command.sync
|
77
77
|
end
|
78
78
|
|
@@ -103,18 +103,18 @@ module Guard
|
|
103
103
|
def options_valid?
|
104
104
|
valid = true
|
105
105
|
if options[:source].nil? && options[:cli_options].nil?
|
106
|
-
UI.error("Guard::
|
106
|
+
UI.error("Guard::RemoteSync a source directory is required")
|
107
107
|
valid = false
|
108
108
|
end
|
109
109
|
if options[:destination].nil? && options[:cli_options].nil?
|
110
|
-
UI.error("Guard::
|
110
|
+
UI.error("Guard::RemoteSync a source directory is required")
|
111
111
|
valid = false
|
112
112
|
end
|
113
113
|
valid
|
114
114
|
end
|
115
115
|
|
116
116
|
def notifier_options
|
117
|
-
{:title => "Guard::
|
117
|
+
{:title => "Guard::RemoteSync", :image => :success}
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|