kitchen-sync 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0376fdf7d97ee105cfbfb248cd7a42ffd0e6132c
4
- data.tar.gz: 6fa0f7cb5fd4dd9eba236520f17de3591a507f48
3
+ metadata.gz: 7c22375c770510ba072de49ad78a4840c70bbcc8
4
+ data.tar.gz: e127ccc22c91a8265d35640121e1e74377ba176f
5
5
  SHA512:
6
- metadata.gz: 2f587f0f0b9885937e4e5852e98bb308ae6105ea2a0c3b9d9ed76cbf24a37e181a1651c72055c39ff564f7aa6b00893bb36796eb5127a9d4e1fef747e20d0234
7
- data.tar.gz: e82b6548d9f31de4acb86f4ee12ace4a9b1644078f116e12735291f1b6d99f0033dd8c0de70173b2eda1acd48db14330443a13064ed0b382296d8f4be21d5ef6
6
+ metadata.gz: 49e7cc419bddef287adbadd38d37c53c943592be3805e51255fe9fb29d3a5e5afe594327a9ad5617481626158f388a5a10900ff932234d7ecf3b001cfa0665f9
7
+ data.tar.gz: 311b93a549dd26bb3f2ec6008831dfd01cd61389f6bc25c4cb8a907d7500f35330feecb0ccc4c7e8316df9044fcb51c0aabdd20173a07ccdfd881a9a881787a3
@@ -1,5 +1,13 @@
1
1
  # Kitchen-Sync Changelog
2
2
 
3
+ ## v2.1.1
4
+
5
+ Allow mixing kitchen-sync transports with other transports.
6
+
7
+ ## v2.1.0
8
+
9
+ Compatibility with new Test Kitchen features.
10
+
3
11
  ## v2.0.0
4
12
 
5
13
  Fully revamped at last for Test Kitchen's new modular transports.
@@ -19,9 +19,18 @@ module Kitchen
19
19
  # Monkey patch to prevent the deletion of everything
20
20
  module Provisioner
21
21
  class ChefBase < Base
22
- def init_command
23
- "mkdir -p #{config[:root_path]}"
22
+
23
+ old_init_command = instance_method(:init_command)
24
+
25
+ define_method(:init_command) do
26
+ if (defined?(Kitchen::Transport::Sftp) && instance.transport.is_a?(Kitchen::Transport::Sftp)) || \
27
+ (defined?(Kitchen::Transport::Rsync) && instance.transport.is_a?(Kitchen::Transport::Rsync))
28
+ "mkdir -p #{config[:root_path]}"
29
+ else
30
+ old_init_command.bind(self).()
31
+ end
24
32
  end
33
+
25
34
  end
26
35
  end
27
36
  end
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  class KitchenSync
19
- VERSION = '2.1.0'
19
+ VERSION = '2.1.1'
20
20
  end
@@ -45,11 +45,12 @@ module Kitchen
45
45
  end
46
46
 
47
47
  locals = Array(locals)
48
- # We only try to sync folders for now.
49
- rsync_candidates = locals.select {|path| File.directory?(path) }
48
+ # We only try to sync folders for now and ignore the cache folder
49
+ # because we don't want to --delete that.
50
+ rsync_candidates = locals.select {|path| File.directory?(path) && File.basename(path) != 'cache' }
50
51
  ssh_command = "ssh #{ssh_args.join(' ')}"
51
52
  copy_identity
52
- rsync_cmd = "/usr/bin/rsync -e '#{ssh_command}' -az#{logger.level == :debug ? 'vv' : ''} #{rsync_candidates.join(' ')} #{@session.options[:user]}@#{@session.host}:#{remote}"
53
+ rsync_cmd = "/usr/bin/rsync -e '#{ssh_command}' -az#{logger.level == :debug ? 'vv' : ''} --delete #{rsync_candidates.join(' ')} #{@session.options[:user]}@#{@session.host}:#{remote}"
53
54
  logger.debug("[rsync] Running rsync command: #{rsync_cmd}")
54
55
  ret = []
55
56
  time = Benchmark.realtime do
@@ -72,9 +72,13 @@ module Kitchen
72
72
  def upload(locals, remote)
73
73
  Array(locals).each do |local|
74
74
  full_remote = File.join(remote, File.basename(local))
75
+ options = {
76
+ recursive: File.directory?(local),
77
+ purge: File.basename(local) != 'cache',
78
+ }
75
79
  recursive = File.directory?(local)
76
80
  time = Benchmark.realtime do
77
- sftp_upload!(local, full_remote, recursive)
81
+ sftp_upload!(local, full_remote, options)
78
82
  end
79
83
  logger.info("[SFTP] Time taken to upload #{local} to #{self}:#{full_remote}: %.2f sec" % time)
80
84
  end
@@ -82,7 +86,7 @@ module Kitchen
82
86
 
83
87
  private
84
88
 
85
- def sftp_upload!(local, remote, recursive)
89
+ def sftp_upload!(local, remote, recursive: true, purge: true)
86
90
  # Fast path check, if the remote path doesn't exist at all we just run a direct transfer
87
91
  unless safe_stat(remote)
88
92
  logger.debug("[SFTP] Fast path upload from #{local} to #{remote}")
@@ -100,7 +104,7 @@ module Kitchen
100
104
  files_to_upload(checksums, local, recursive).each do |rel_path|
101
105
  upload_file(checksums, local, remote, rel_path)
102
106
  end
103
- purge_files(checksums, remote)
107
+ purge_files(checksums, remote) if purge
104
108
  # Wait until all xfers are complete.
105
109
  sftp_loop(0)
106
110
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.4.8
109
+ rubygems_version: 2.6.2
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Improved file transfers for for test-kitchen