guard-autoupload 1.0.0 → 1.1.0

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: 2a76d209ee938526ce9381c587699b936fd4e29f
4
- data.tar.gz: ac65618097d9d518ba890d75b879146cd1f430aa
3
+ metadata.gz: c9e8cc13938f436ef77d4691954891ec72d84bcc
4
+ data.tar.gz: b56fc25cdaff4f07512248aa3c3ccbb0462d66d2
5
5
  SHA512:
6
- metadata.gz: 390b6e1683a9dc0ee7b3e5bfa1530d59b7d16e24174d28b658012f8e824bc9a95910637934ab8b1f40f3ed1188602903152a15652da2f7f6a2d9f984c6f1fcac
7
- data.tar.gz: e6ac7b7886cc8285a7e09fa475a6b17c9f0762e9cd36af8b8a930f9a5f10f334bc338b6c432544665ed45923abc11dbc4ff2e63ff4a3d972dbec6026e6bc23a1
6
+ metadata.gz: c0e49708f1fac887d59208b5e7bbbb55130d40cdaff01f3094b5e72a7051e397fe386faa8ee09532a0a7a8d2b03a4d1a71f67a829985bd0dc465cb6dcf13b61e
7
+ data.tar.gz: 92e24804e1afd216c2bce4e72c7ed997d9c854a9d87e51c2fe7acb6df4c68e15370c156126a6126a3c1658caf07106fec08da7497f6a13053ea838d42acabd4b
data/Guardfile CHANGED
@@ -5,13 +5,15 @@ opts = {
5
5
  # Possible values are :scp, :sftp and :ftp.
6
6
  # Of these :scp is the preferred one for
7
7
  # its stability.
8
- :host => "localhost",
8
+ :host => "remote_host",
9
9
  # :port => 22, # Uncomment this if you need to set port to
10
10
  # something else than default.
11
- :user => "jyrkililja",
12
- :remote => "/Users/jyrkililja/projects/guard-development/test/",
11
+ :user => "username",
12
+ :password => "password",
13
+ :remote => "remote_path",
13
14
  :verbose => true, # if true you get all outputs
14
- :quiet => false # if true outputs only on exceptions.
15
+ :quiet => false, # if true outputs only on exceptions.
16
+ :remote_delete => true # delete remote file if local file is deleted (defaults to true)
15
17
  }
16
18
 
17
19
  guard :autoupload, opts do
data/README.md CHANGED
@@ -33,7 +33,8 @@ Sample guardfile:
33
33
  :password => "password",
34
34
  :remote => "remote_path",
35
35
  :verbose => false, # if true you get all outputs
36
- :quiet => false # if true outputs only on exceptions.
36
+ :quiet => false, # if true outputs only on exceptions.
37
+ :remote_delete => true # delete the remote file if local file is deleted (defaults to true)
37
38
  }
38
39
 
39
40
  guard :autoupload, opts do
@@ -58,4 +59,3 @@ The code is hevily based on [vincenthu's guard-flopbox][gsftp] and
58
59
 
59
60
  [gsftp]: https://github.com/vincentchu/guard-flopbox
60
61
  [gftp]: https://github.com/bgarret/guard-ftpsync
61
-
@@ -43,6 +43,7 @@ module Guard
43
43
  @local_subpath = options[:local] || ''
44
44
  @verbose = options[:verbose]
45
45
  @quiet = options[:quiet] unless verbose?
46
+ @remote_delete = options[:remote_delete].nil? ? true : options[:remote_delete]
46
47
  output = options.dup
47
48
  output[:password] = options[:password].gsub(/./, '*') if options.include? :password
48
49
 
@@ -50,7 +51,8 @@ module Guard
50
51
  UI.info("Initialized with options #{output.inspect}") unless quiet?
51
52
  end
52
53
 
53
- def run_on_change(paths)
54
+ def run_on_changes(paths)
55
+ local_file = nil
54
56
  paths.each do |path|
55
57
  path = path.encode(Kconv::UTF8, Encoding::UTF8_MAC) if RUBY_PLATFORM.include? "darwin"
56
58
 
@@ -83,24 +85,27 @@ module Guard
83
85
  msg = "Uploaded:\n#{paths.join("\n")}"
84
86
  UI.info(msg)
85
87
  ::Guard::Notifier.notify "uploaded", :title => "Uploaded"
88
+ local_file
86
89
  end
87
90
 
88
91
  def run_on_removals(paths)
89
92
  paths.each do |path|
90
93
  path.sub!(/^#{@local_subpath}/, '')
91
94
  remote_file = File.join(@remote, path)
92
-
93
- begin
94
- UI.info("Delete #{remote_file}") if verbose?
95
- @session.remove!(remote_file)
96
- rescue => ex
97
- UI.error("Exception on deleting #{path}\n#{ex.inspect.toutf8}")
98
- UI.error(ex.backtrace.join("\n")) if verbose?
95
+
96
+ if @remote_delete
97
+ begin
98
+ UI.info("Delete #{remote_file}") if verbose?
99
+ @session.remove!(remote_file)
100
+ rescue => ex
101
+ UI.error("Exception on deleting #{path}\n#{ex.inspect.toutf8}")
102
+ UI.error(ex.backtrace.join("\n")) if verbose?
103
+ end
99
104
  end
100
-
105
+
101
106
  UI.info("Deleted #{path}") unless quiet?
102
107
  end
103
-
108
+
104
109
  ::Guard::Notifier.notify "Deleted", :title => "Deleted"
105
110
  end
106
111
 
@@ -12,7 +12,8 @@ opts = {
12
12
  :password => "password",
13
13
  :remote => "remote_path",
14
14
  :verbose => true, # if true you get all outputs
15
- :quiet => false # if true outputs only on exceptions.
15
+ :quiet => false, # if true outputs only on exceptions.
16
+ :remote_delete => true # delete the remote file if the local file is deleted (defaults to true)
16
17
  }
17
18
 
18
19
  guard :autoupload, opts do
@@ -22,4 +23,3 @@ guard :autoupload, opts do
22
23
  %r{__jb_old__}, %r{__jb_bak__} # ruby idea ingores
23
24
  ]
24
25
  end
25
-
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module AutouploadVersion
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-autoupload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jyrki Lilja
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -127,4 +127,3 @@ signing_key:
127
127
  specification_version: 4
128
128
  summary: Autoupload plugin - uploads local changes to remote host.
129
129
  test_files: []
130
- has_rdoc: