directory_push 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 713af2d1df5f371834bcca64bffff82b116e9a6d
4
- data.tar.gz: ecc2f95f17e166f897ad284ab1e2e20294af0e8a
3
+ metadata.gz: d6b1c4c9d852154cb16f1092282a83a248bb64cb
4
+ data.tar.gz: eeee6b3a199eb39deb53e950499c921adddd12d4
5
5
  SHA512:
6
- metadata.gz: 496b80ddb9ca54d78fc833f416dd71563424769e1975703ee9fc4c508ba199ac24ead082d384e5e3738fa88d76ca73fe8aa00a5ff0dde1d375cc38b8d87eea33
7
- data.tar.gz: 19b30ca77b92136e98d6e75e20d6c0484ad01cf708b80d2e91060c115626d64e11dfe6a792f75644c51c6fadd9d27bfff702b77889df7e6e41117bd337361819
6
+ metadata.gz: a93b48eb6c6c45df621b6bb385b2384744ba65ecc118c5f69393c89a672d42e75ba48079905a017692d88383af8659a80b6bc574323a1847e7ada3f6bd86b99d
7
+ data.tar.gz: 208418314bac3d46d40adec1361ff29d313d5caf8ba326c7d7c596822533e1a9097124b0f73b20cfa83c3f7037e1a2046d22a4f454720d73d95733b9ba31af5a
@@ -1,3 +1,3 @@
1
1
  module DirectoryPush
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -19,6 +19,7 @@ module DirectoryPush
19
19
 
20
20
  FILTER_FILE_NAME = '.rsync-filter'
21
21
  DEFAULT_RSYNC_OPTIONS = [
22
+ '--delete',
22
23
  '--verbose',
23
24
  '--archive',
24
25
  '--compress',
@@ -29,49 +30,39 @@ module DirectoryPush
29
30
  GUARDFILE_TEXT = %q{
30
31
  require 'yaml'
31
32
  require 'guard/compat/plugin'
32
- require 'rsync'
33
33
 
34
34
  config = YAML.load(File.read(File.join(File.dirname(__FILE__), 'config.yml')))
35
- $rsync_options = config.delete(:rsync)
36
- $rsync_options << '--delete'
37
- $source = config.delete(:source)
35
+ rsync_options = ['rsync'] + config.delete(:rsync)
36
+ source = config.delete(:source)
38
37
  ignore_pattern = config.delete(:ignore)
39
- $remote = %Q{#{config.delete(:user)}@#{config.delete(:remote_address)}:"#{config.delete(:destination)}"}
38
+ remote = %Q{#{config.delete(:user)}@#{config.delete(:remote_address)}:"#{config.delete(:destination)}"}
39
+
40
+ rsync_options << source << remote
41
+ $rsync_command = rsync_options.join(' ')
40
42
 
41
43
  module ::Guard
42
44
  class DirectoryPush < Plugin
43
- private
44
- def sync()
45
- Compat::UI.info %Q{Guard::DirectoryPush source: "#{$source}", destination: "#{$remote}", options: #{$rsync_options}}
46
- result = Rsync.run $source, $remote, $rsync_options
47
- if result.success?
48
- result.changes.each do |change|
49
- Compat::UI.info "#{change.filename} (#{change.summary})"
50
- end
51
- else
52
- Compat::UI.error result.error
53
- raise result.error
54
- end
55
- end
56
-
57
- public
58
-
59
- alias_method :start, :sync
60
- alias_method :stop, :sync
61
- alias_method :reload, :sync
62
- alias_method :run_all, :sync
45
+ def start() sync end
46
+ def reload() sync end
47
+ def run_all() sync end
63
48
  def run_on_additions(paths)
64
- Compat::UI.info "Guard::DirectoryPush Files created: #{paths}"
49
+ Compat::UI.info "Guard::DirectoryPush Files created: #{paths}."
65
50
  sync
66
51
  end
67
52
  def run_on_modifications(paths)
68
- Compat::UI.info "Guard::DirectoryPush Files changed: #{paths}"
53
+ Compat::UI.info "Guard::DirectoryPush Files changed: #{paths}."
69
54
  sync
70
55
  end
71
56
  def run_on_removals(paths)
72
- Compat::UI.info "Guard::DirectoryPush Files removed: #{paths}"
57
+ Compat::UI.info "Guard::DirectoryPush Files removed: #{paths}."
73
58
  sync
74
59
  end
60
+
61
+ private
62
+ def sync()
63
+ Compat::UI.info %Q{Guard::DirectoryPush `#{$rsync_command}`.}
64
+ system $rsync_command
65
+ end
75
66
  end
76
67
  end
77
68
 
@@ -79,7 +70,7 @@ config[:verbose] = true
79
70
  config[:cli] = '--color'
80
71
  config[:sync_on_start] = true
81
72
 
82
- directories [$source]
73
+ directories [source]
83
74
  guard 'directory-push', config do
84
75
  watch %r{^.+$}
85
76
  if ignore_pattern
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directory_push
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill