kitchen-transport-express 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9700e07ca7ddd76297069ea6c62e00bb4ed82b87f48f643be7ba41e560e9bd4
4
- data.tar.gz: 94f6354276aa9ebad26add90b234a5478f9f1ba1157fe34a69297354a29523ea
3
+ metadata.gz: b255fcbeed01b423bd2bd8e71069501b2c0b636e3d2313ccdd48f8347106333d
4
+ data.tar.gz: 9696bbf314ccbda4c978cf89963e22005a18d064a359d835ccf033403d46f6b8
5
5
  SHA512:
6
- metadata.gz: a6989457b293f6a59dabef6bea15684548769fbac53ded1413effadcf44bdcf797afe0560fba452378453d18ba3a5f88b16768ae6eb30876ca24cc1756fe0afa
7
- data.tar.gz: 9f2a64a0eb918cdb14980d46b3e1f2dfbcb59d4631329784fd41d0835b1c353da2a36900483f0113067bec16b2fb277994e5d95d17af8823a2ce447ea36da899
6
+ metadata.gz: 548f04230a39e196b59fd952a4a5247bb9ee4c754d88785f61400565d7c0bd8802a1857a3c7896bb7f1a311bb63475c7416b7746768436eee60fb9cfa0b2dcc7
7
+ data.tar.gz: ba37810bfcdafaa6ba2973e6410c35aac5ac57bc0f9102db149829cffadea1043a4a24c509f41801eacbc6347cec41ae66907c0b79d90d95484a8bc3ea4d3707
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # kitchen-transport-express CHANGELOG
2
2
 
3
+ ## 1.3.0
4
+ * chore: 📝 minor updates to method documentation
5
+ * chore: 🔧 add metadata to gemspec
6
+
3
7
  ## 1.2.0
4
8
  * feat: 🥅 add error handling to the thread pool
5
9
  * feat: 📝🎨 add YARD tags and cleaned up class namespaces and private methods
@@ -18,12 +18,12 @@ lib = File.expand_path("lib", __dir__)
18
18
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19
19
  require "kitchen/transport/express/version"
20
20
 
21
- Gem::Specification.new do |spec|
21
+ Gem::Specification.new do |spec| # rubocop: disable Metrics/BlockLength
22
22
  spec.name = "kitchen-transport-express"
23
23
  spec.version = Kitchen::Transport::Express::VERSION
24
24
  spec.authors = ["Justin Steele"]
25
25
  spec.email = ["justin.steele@oracle.com"]
26
- spec.summary = %q{Skip the long lines in transport. 15 items or less!}
26
+ spec.summary = %q{Skip the long lines in Kitchen Transport!}
27
27
  spec.description = %q{A Test Kitchen Transport plugin that streamlines the file transfer phase to Linux hosts.}
28
28
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
29
  spec.homepage = "https://github.com/justintsteele/kitchen-transport-express.git"
@@ -31,6 +31,13 @@ Gem::Specification.new do |spec|
31
31
  spec.license = "Apache-2.0"
32
32
  spec.require_paths = ["lib"]
33
33
  spec.required_ruby_version = ">= 2.4"
34
+ spec.metadata = {
35
+ "bug_tracker_uri" => "https://github.com/justintsteele/kitchen-transport-express/issues",
36
+ "changelog_uri" => "https://github.com/justintsteele/kitchen-transport-express/blob/main/CHANGELOG.md",
37
+ "documentation_uri" => "https://github.com/justintsteele/kitchen-transport-express/blob/main/README.md",
38
+ "homepage_uri" => "https://github.com/justintsteele/kitchen-transport-express",
39
+ "source_code_uri" => "https://github.com/justintsteele/kitchen-transport-express",
40
+ }
34
41
  spec.add_dependency "test-kitchen"
35
42
  spec.add_dependency "ffi-libarchive"
36
43
  spec.add_dependency "concurrent-ruby"
@@ -40,4 +47,4 @@ Gem::Specification.new do |spec|
40
47
  spec.add_development_dependency "rake"
41
48
  spec.add_development_dependency "rspec"
42
49
  spec.add_development_dependency "yard"
43
- end
50
+ end # rubocop: enable Metrics/BlockLength
@@ -23,10 +23,10 @@ module Kitchen
23
23
  #
24
24
  # @author Justin Steele <justin.steele@oracle.com>
25
25
  module Archiver
26
- # Creates the archive locally in the Kitchen cache location
26
+ # Creates the archive locally in the Kitchen cache location.
27
27
  #
28
- # @param path [String] the path of the top-level directory to be arvhied
29
- # @return [String] the name of the archive
28
+ # @param path [String] the path of the top-level directory to be arvhied.
29
+ # @return [String] the name of the archive.
30
30
  def archive(path)
31
31
  archive_basename = ::File.basename(path) + ".tgz"
32
32
  archive_full_name = ::File.join(::File.dirname(path), archive_basename)
@@ -37,10 +37,9 @@ module Kitchen
37
37
  archive_full_name
38
38
  end
39
39
 
40
- # Extracts the archive on the remote host
40
+ # Extracts the archive on the remote host.
41
41
  #
42
- # @param session [Net::SSH::Connection::Session] The SSH session used to connect to the remote host and execute
43
- # the extract and cleanup commands
42
+ # @param session [Net::SSH::Connection::Session] The SSH session used to connect to the remote host and execute the extract and cleanup commands.
44
43
  def extract(session, local, remote)
45
44
  return unless local.match(/.*\.tgz/)
46
45
 
@@ -55,10 +54,10 @@ module Kitchen
55
54
 
56
55
  private
57
56
 
58
- # Creats a archive of the directory provided
57
+ # Creats a archive of the directory provided.
59
58
  #
60
- # @param path [String] the path to the directory that will be archived
61
- # @param archive_path [String] the fully qualified path to the archive that will be created
59
+ # @param path [String] the path to the directory that will be archived.
60
+ # @param archive_path [String] the fully qualified path to the archive that will be created.
62
61
  # @api private
63
62
  def create_archive(path, archive_path)
64
63
  Archive.write_open_filename(archive_path, Archive::COMPRESSION_GZIP,
@@ -67,10 +66,10 @@ module Kitchen
67
66
  end
68
67
  end
69
68
 
70
- # Appends the content of each item in the expanded directory path
69
+ # Appends the content of each item in the expanded directory path.
71
70
  #
72
- # @param tar [Archive::Writer] the instance of the archive class
73
- # @param path [String] the path to the directory that will be archived
71
+ # @param tar [Archive::Writer] the instance of the archive class.
72
+ # @param path [String] the path to the directory that will be archived.
74
73
  # @api private
75
74
  def write_content(tar, path)
76
75
  all_files = Dir.glob("#{path}/**/*")
@@ -85,11 +84,11 @@ module Kitchen
85
84
  end
86
85
  end
87
86
 
88
- # Creates the entry in the Archive for each item
87
+ # Creates the entry in the Archive for each item.
89
88
  #
90
- # @param ent [Archive::Entry] the current entry being added to the archive
91
- # @param file [String] the current file or directory being added to the archive
92
- # @param path [String] the path to the directory being archived
89
+ # @param ent [Archive::Entry] the current entry being added to the archive.
90
+ # @param file [String] the current file or directory being added to the archive.
91
+ # @param path [String] the path to the directory being archived.
93
92
  # @api private
94
93
  def entry(ent, file, path)
95
94
  ent.pathname = file.gsub(%r{#{File.dirname(path)}/}, "")
@@ -102,8 +101,8 @@ module Kitchen
102
101
 
103
102
  # The content of the file in binary format. Directories have no content.
104
103
  #
105
- # @param file [String] the path to the file
106
- # @return [String] the content of the file
104
+ # @param file [String] the path to the file.
105
+ # @return [String] the content of the file.
107
106
  # @api private
108
107
  def content(file)
109
108
  File.read(file, mode: "rb")
@@ -111,17 +110,17 @@ module Kitchen
111
110
 
112
111
  # The size of the file. Directories have no size.
113
112
  #
114
- # @param file [String] the path to the file
115
- # @return [Integer] the size of the file
113
+ # @param file [String] the path to the file.
114
+ # @return [Integer] the size of the file.
116
115
  # @api private
117
116
  def size(file)
118
117
  content(file).size
119
118
  end
120
119
 
121
- # The file permissions of the file
120
+ # The file permissions of the file.
122
121
  #
123
- # @param file [String] the path to the file or directory
124
- # @return [Integer] the mode of the file or directory
122
+ # @param file [String] the path to the file or directory.
123
+ # @return [Integer] the mode of the file or directory.
125
124
  # @api private
126
125
  def mode(file)
127
126
  f = File.stat(file)
@@ -17,7 +17,10 @@
17
17
  module Kitchen
18
18
  module Transport
19
19
  class Express
20
- VERSION = "1.2.0"
20
+ # The version string for Kitchen Transport Express.
21
+ #
22
+ # @author Justin Steele <justin.steele@oracle.com>
23
+ VERSION = "1.3.0"
21
24
  end
22
25
  end
23
26
  end
@@ -21,15 +21,15 @@ require_relative "express/archiver"
21
21
 
22
22
  module Kitchen
23
23
  module Transport
24
- # Kitchen Transport Express
24
+ # Kitchen Transport Express.
25
25
  #
26
26
  # @author Justin Steele <justin.steele@oracle.com>
27
27
  class Express
28
- # A constant that gets prepended to debugger messages
28
+ # A constant that gets prepended to debugger messages.
29
29
  LOG_PREFIX = "EXPRESS"
30
30
  end
31
31
 
32
- # Express SSH Transport Error class
32
+ # Express SSH Transport Error class.
33
33
  #
34
34
  # @author Justin Steele <justin.steele@oracle.com>
35
35
  class ExpressFailed < StandardError
@@ -38,17 +38,17 @@ module Kitchen
38
38
  end
39
39
  end
40
40
 
41
- # Express SSH Transport plugin for Test Kitchen
41
+ # Express SSH Transport plugin for Test Kitchen.
42
42
  #
43
43
  # @author Justin Steele <justin.steele@oracle.com>
44
44
  class ExpressSsh < Kitchen::Transport::Ssh
45
45
  kitchen_transport_api_version 1
46
46
  plugin_version Express::VERSION
47
47
 
48
- # Override the method in the super class to start the connection with our connection class
48
+ # Override the method in the super class to start the connection with our connection class.
49
49
  #
50
- # @param options [Hash] connection options
51
- # @return [Ssh::Connection] an instance of Kitchen::Transport::ExpressSsh::Connection
50
+ # @param options [Hash] connection options.
51
+ # @return [Ssh::Connection] an instance of Kitchen::Transport::ExpressSsh::Connection.
52
52
  def create_new_connection(options, &block)
53
53
  if @connection
54
54
  logger.debug("[#{Express::LOG_PREFIX}] Shutting previous connection #{@connection}")
@@ -59,16 +59,16 @@ module Kitchen
59
59
  @connection = self.class::Connection.new(options, &block)
60
60
  end
61
61
 
62
- # Determines if the Kitchen instance is attempting a Verify stage
62
+ # Determines if the Kitchen instance is attempting a Verify stage.
63
63
  #
64
- # @param instance [Kitchen::Instance] the instance passed in from Kitchen
64
+ # @param instance [Kitchen::Instance] the instance passed in from Kitchen.
65
65
  # @return [Boolean]
66
66
  def verifier_defined?(instance)
67
67
  defined?(Kitchen::Verifier::Inspec) && instance.verifier.is_a?(Kitchen::Verifier::Inspec)
68
68
  end
69
69
 
70
- # Finalizes the Kitchen config by executing super and parsing the options provided by the kitchen.yml
71
- # The only difference here is we layer in our ssh options so the verifier can use our transport
70
+ # Finalizes the Kitchen config by executing super and parsing the options provided by the kitchen.yml.
71
+ # The only difference here is we layer in our ssh options so the verifier can use our transport.
72
72
  # (see Kitchen::Transport::Ssh#finalize_config!)
73
73
  def finalize_config!(instance)
74
74
  super.tap do
@@ -88,15 +88,14 @@ module Kitchen
88
88
  class Connection < Kitchen::Transport::Ssh::Connection
89
89
  include Express::Archiver
90
90
 
91
+ # Overrides the upload method in Kitchen::Transport::Ssh::Connection.
92
+ # The special sauce here is that we create threaded uploads of archives of the kitchen files rather than serial file uploads.
91
93
  # (see Kitchen::Transport::Base::Connection#upload)
92
- # Overrides the upload method in Kitchen::Transport::Ssh::Connection
93
- # The special sauce here is that we create threaded executions of uploading our archives
94
94
  #
95
- # @param locals [Array] the top-level list of directories and files to be transfered
96
- # @param remote [String] the remote directory config[:kitchen_root]
97
- # @raise [ExpressFailed] if any of the threads raised an exception
98
- # rubocop: disable Metrics/MethodLength
99
- def upload(locals, remote)
95
+ # @param locals [Array] the top-level list of directories and files to be transfered.
96
+ # @param remote [String] the remote directory (kitchen_root).
97
+ # @raise [ExpressFailed] if any of the threads raised an exception.
98
+ def upload(locals, remote) # rubocop: disable Metrics/MethodLength
100
99
  return super unless valid_remote_requirements?(remote)
101
100
 
102
101
  processed_locals = process_locals(locals)
@@ -112,14 +111,13 @@ module Kitchen
112
111
  pool.wait_for_termination
113
112
 
114
113
  raise ExpressFailed, exceptions.pop unless exceptions.empty?
115
- end
116
- # rubocop: enable Metrics/MethodLength
114
+ end # rubocop: enable Metrics/MethodLength
117
115
 
118
116
  private
119
117
 
120
- # Creates the thread pool and exceptions queue
118
+ # Creates the thread pool and exceptions queue.
121
119
  #
122
- # @param processed_locals [Array] list of files and archives to be uploaded
120
+ # @param processed_locals [Array] list of files and archives to be uploaded.
123
121
  # @return [Array(Concurrent::FixedThreadPool, Queue)]
124
122
  # @api private
125
123
  def thread_pool(processed_locals)
@@ -128,7 +126,7 @@ module Kitchen
128
126
 
129
127
  # Ensures the remote host has the minimum-required executables to extract the archives.
130
128
  #
131
- # @param remote [String] the remote directory config[:kitchen_root]
129
+ # @param remote [String] the remote directory (kitchen_root).
132
130
  # @return [Boolean]
133
131
  # @api private
134
132
  def valid_remote_requirements?(remote)
@@ -144,8 +142,8 @@ module Kitchen
144
142
  # Builds an array of files we want to ship. If the top-level item is a directory, archive it and
145
143
  # add the archive name to the array.
146
144
  #
147
- # @param locals [Array] the top-level list of directories and files to be transfered
148
- # @return [Array] the paths to the files and archives that will be transferred
145
+ # @param locals [Array] the top-level list of directories and files to be transfered.
146
+ # @return [Array] the paths to the files and archives that will be transferred.
149
147
  # @api private
150
148
  def process_locals(locals)
151
149
  processed_locals = []
@@ -162,10 +160,10 @@ module Kitchen
162
160
 
163
161
  # Uploads the archives or files to the remote host.
164
162
  #
165
- # @param local [String] a single top-level item from the upload method
166
- # @param remote [String] path to remote destination
167
- # @param opts [Hash] the ssh options that came in from the Kitchen instance
168
- # @raise [StandardError] if the files could not be uploaded successfully
163
+ # @param local [String] a single top-level item from the upload method.
164
+ # @param remote [String] path to remote destination.
165
+ # @param opts [Hash] the ssh options that came in from the Kitchen instance.
166
+ # @raise [StandardError] if the files could not be uploaded successfully.
169
167
  # @api private
170
168
  def transfer(local, remote, opts = {})
171
169
  logger.debug("[#{Express::LOG_PREFIX}] Transferring #{local} to #{remote}")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-transport-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Steele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-06 00:00:00.000000000 Z
11
+ date: 2025-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -160,7 +160,11 @@ homepage: https://github.com/justintsteele/kitchen-transport-express.git
160
160
  licenses:
161
161
  - Apache-2.0
162
162
  metadata:
163
- github_repo: https://github.com/justintsteele/kitchen-transport-express
163
+ bug_tracker_uri: https://github.com/justintsteele/kitchen-transport-express/issues
164
+ changelog_uri: https://github.com/justintsteele/kitchen-transport-express/blob/main/CHANGELOG.md
165
+ documentation_uri: https://github.com/justintsteele/kitchen-transport-express/blob/main/README.md
166
+ homepage_uri: https://github.com/justintsteele/kitchen-transport-express
167
+ source_code_uri: https://github.com/justintsteele/kitchen-transport-express
164
168
  post_install_message:
165
169
  rdoc_options: []
166
170
  require_paths:
@@ -179,5 +183,5 @@ requirements: []
179
183
  rubygems_version: 3.3.7
180
184
  signing_key:
181
185
  specification_version: 4
182
- summary: Skip the long lines in transport. 15 items or less!
186
+ summary: Skip the long lines in Kitchen Transport!
183
187
  test_files: []