Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/winrm-fs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# limitations under the License.

require 'winrm' unless defined?(WinRM::Connection)
require 'logger'
require 'pathname' unless defined?(Pathname)
require_relative 'winrm-fs/exceptions'
require_relative 'winrm-fs/file_manager'
Expand Down
4 changes: 3 additions & 1 deletion lib/winrm-fs/core/file_transporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# limitations under the License.

require 'benchmark' unless defined?(Benchmark)
require 'csv' unless defined?(CSV)
require 'digest' unless defined?(Digest)
require 'securerandom' unless defined?(SecureRandom)
require 'stringio' unless defined?(StringIO)
Expand Down Expand Up @@ -67,6 +66,7 @@ def initialize(shell, opts = {})
@shell = shell
@logger = shell.logger
@id_generator = opts.fetch(:id_generator) { -> { SecureRandom.uuid } }
require 'zip'
Zip.unicode_names = true
end

Expand Down Expand Up @@ -409,6 +409,8 @@ def parse_response(output)
"(exitcode: 0), but stderr present\n#{stderr}"
end

require 'csv'

logger.debug 'Parsing CSV Response'
logger.debug output.stdout

Expand Down
11 changes: 3 additions & 8 deletions lib/winrm-fs/core/tmp_zip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# limitations under the License.

require 'delegate'
require 'logger' unless defined?(Logger)
require 'pathname' unless defined?(Pathname)
require 'tempfile' unless defined?(Tempfile)
require 'zip' unless defined?(Zip)

module WinRM
module FS
Expand Down Expand Up @@ -68,7 +68,8 @@ class TmpZip
# @param logger [#debug,#debug?] an optional logger/ui object that
# responds to `#debug` and `#debug?` (default `nil`)
def initialize(dir, logger = nil)
@logger = logger || Logging.logger[self]
require 'zip'
@logger = logger || Logger.new(nil)
@dir = clean_dirname(dir)
@zip_io = Tempfile.open(['tmpzip-', '.zip'], binmode: true)
write_zip
Expand Down Expand Up @@ -116,12 +117,6 @@ def entries
Pathname.glob(dir.join('**/.*')).push(*Pathname.glob(dir.join('**/*'))).delete_if(&:directory?).sort
end

# (see Logging.log_subject)
# @api private
def log_subject
@log_subject ||= [self.class.to_s.split('::').last, path].join('::')
end

# Adds all file entries to the Zip output stream.
#
# @param zos [Zip::OutputStream] zip output stream
Expand Down