winrm-fs 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/.rspec +3 -3
- data/.rubocop.yml +9 -9
- data/.travis.yml +4 -4
- data/Gemfile +3 -3
- data/LICENSE +202 -202
- data/README.md +86 -86
- data/Rakefile +28 -28
- data/VERSION +1 -1
- data/Vagrantfile +9 -9
- data/appveyor.yml +39 -39
- data/bin/rwinrmcp +86 -86
- data/changelog.md +37 -34
- data/lib/winrm-fs.rb +28 -28
- data/lib/winrm-fs/core/file_transporter.rb +509 -507
- data/lib/winrm-fs/core/tmp_zip.rb +166 -166
- data/lib/winrm-fs/exceptions.rb +28 -28
- data/lib/winrm-fs/file_manager.rb +117 -117
- data/lib/winrm-fs/scripts/check_files.ps1.erb +54 -48
- data/lib/winrm-fs/scripts/checksum.ps1.erb +13 -13
- data/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -6
- data/lib/winrm-fs/scripts/decode_files.ps1.erb +58 -58
- data/lib/winrm-fs/scripts/delete.ps1.erb +6 -6
- data/lib/winrm-fs/scripts/download.ps1.erb +8 -8
- data/lib/winrm-fs/scripts/exists.ps1.erb +8 -8
- data/lib/winrm-fs/scripts/scripts.rb +31 -31
- data/spec/config-example.yml +4 -4
- data/spec/integration/file_manager_spec.rb +218 -203
- data/spec/integration/tmp_zip_spec.rb +26 -26
- data/spec/matchers.rb +58 -58
- data/spec/spec_helper.rb +72 -72
- data/spec/unit/file_transporter_spec.rb +839 -819
- data/spec/unit/tmp_zip_spec.rb +79 -79
- data/winrm-fs.gemspec +37 -37
- metadata +2 -2
data/spec/unit/tmp_zip_spec.rb
CHANGED
@@ -1,79 +1,79 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher (<fnichol@nichol.ca>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2015, Fletcher Nichol
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License');
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an 'AS IS' BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require 'winrm-fs/core/tmp_zip'
|
20
|
-
|
21
|
-
describe WinRM::FS::Core::TmpZip do
|
22
|
-
let(:src_dir) do
|
23
|
-
tmpdir = Pathname.new(Dir.mktmpdir)
|
24
|
-
@tmpdirs << tmpdir
|
25
|
-
src_dir = tmpdir.join('src')
|
26
|
-
sub_dir = src_dir.join('veggies')
|
27
|
-
|
28
|
-
src_dir.mkpath
|
29
|
-
create_local_file(src_dir.join('apple.txt'), 'appleapple')
|
30
|
-
create_local_file(src_dir.join('banana.txt'), 'bananabanana')
|
31
|
-
create_local_file(src_dir.join('cherry.txt'), 'cherrycherry')
|
32
|
-
sub_dir.mkpath
|
33
|
-
create_local_file(sub_dir.join('carrot.txt'), 'carrotcarrot')
|
34
|
-
src_dir
|
35
|
-
end
|
36
|
-
|
37
|
-
let(:tmp_zip) { WinRM::FS::Core::TmpZip.new(src_dir) }
|
38
|
-
|
39
|
-
before { @tmpdirs = [] }
|
40
|
-
|
41
|
-
after do
|
42
|
-
@tmpdirs.each(&:rmtree)
|
43
|
-
tmp_zip.unlink if tmp_zip.path
|
44
|
-
end
|
45
|
-
|
46
|
-
it '#path returns path to created zip file' do
|
47
|
-
expect(tmp_zip.path.file?).to eq true
|
48
|
-
end
|
49
|
-
|
50
|
-
it '#unlink removes the file' do
|
51
|
-
path = tmp_zip.path
|
52
|
-
expect(path.file?).to eq true
|
53
|
-
|
54
|
-
tmp_zip.unlink
|
55
|
-
|
56
|
-
expect(path.file?).to eq false
|
57
|
-
expect(tmp_zip.path).to eq nil
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'for a zip file containing the base directory' do
|
61
|
-
let(:tmp_zip) { WinRM::FS::Core::TmpZip.new(src_dir) }
|
62
|
-
|
63
|
-
it 'contains the input entries' do
|
64
|
-
zip = Zip::File.new(tmp_zip.path)
|
65
|
-
|
66
|
-
expect(zip.map(&:name).sort).to eq(
|
67
|
-
['apple.txt', 'banana.txt', 'cherry.txt', 'veggies/carrot.txt']
|
68
|
-
)
|
69
|
-
expect(zip.read('apple.txt')).to eq 'appleapple'
|
70
|
-
expect(zip.read('banana.txt')).to eq 'bananabanana'
|
71
|
-
expect(zip.read('cherry.txt')).to eq 'cherrycherry'
|
72
|
-
expect(zip.read('veggies/carrot.txt')).to eq 'carrotcarrot'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def create_local_file(path, content)
|
77
|
-
path.open('wb') { |file| file.write(content) }
|
78
|
-
end
|
79
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Fletcher (<fnichol@nichol.ca>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Fletcher Nichol
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the 'License');
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an 'AS IS' BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require 'winrm-fs/core/tmp_zip'
|
20
|
+
|
21
|
+
describe WinRM::FS::Core::TmpZip do
|
22
|
+
let(:src_dir) do
|
23
|
+
tmpdir = Pathname.new(Dir.mktmpdir)
|
24
|
+
@tmpdirs << tmpdir
|
25
|
+
src_dir = tmpdir.join('src')
|
26
|
+
sub_dir = src_dir.join('veggies')
|
27
|
+
|
28
|
+
src_dir.mkpath
|
29
|
+
create_local_file(src_dir.join('apple.txt'), 'appleapple')
|
30
|
+
create_local_file(src_dir.join('banana.txt'), 'bananabanana')
|
31
|
+
create_local_file(src_dir.join('cherry.txt'), 'cherrycherry')
|
32
|
+
sub_dir.mkpath
|
33
|
+
create_local_file(sub_dir.join('carrot.txt'), 'carrotcarrot')
|
34
|
+
src_dir
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:tmp_zip) { WinRM::FS::Core::TmpZip.new(src_dir) }
|
38
|
+
|
39
|
+
before { @tmpdirs = [] }
|
40
|
+
|
41
|
+
after do
|
42
|
+
@tmpdirs.each(&:rmtree)
|
43
|
+
tmp_zip.unlink if tmp_zip.path
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#path returns path to created zip file' do
|
47
|
+
expect(tmp_zip.path.file?).to eq true
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#unlink removes the file' do
|
51
|
+
path = tmp_zip.path
|
52
|
+
expect(path.file?).to eq true
|
53
|
+
|
54
|
+
tmp_zip.unlink
|
55
|
+
|
56
|
+
expect(path.file?).to eq false
|
57
|
+
expect(tmp_zip.path).to eq nil
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'for a zip file containing the base directory' do
|
61
|
+
let(:tmp_zip) { WinRM::FS::Core::TmpZip.new(src_dir) }
|
62
|
+
|
63
|
+
it 'contains the input entries' do
|
64
|
+
zip = Zip::File.new(tmp_zip.path)
|
65
|
+
|
66
|
+
expect(zip.map(&:name).sort).to eq(
|
67
|
+
['apple.txt', 'banana.txt', 'cherry.txt', 'veggies/carrot.txt']
|
68
|
+
)
|
69
|
+
expect(zip.read('apple.txt')).to eq 'appleapple'
|
70
|
+
expect(zip.read('banana.txt')).to eq 'bananabanana'
|
71
|
+
expect(zip.read('cherry.txt')).to eq 'cherrycherry'
|
72
|
+
expect(zip.read('veggies/carrot.txt')).to eq 'carrotcarrot'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_local_file(path, content)
|
77
|
+
path.open('wb') { |file| file.write(content) }
|
78
|
+
end
|
79
|
+
end
|
data/winrm-fs.gemspec
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'date'
|
3
|
-
|
4
|
-
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.name = 'winrm-fs'
|
9
|
-
s.version = version
|
10
|
-
s.date = Date.today.to_s
|
11
|
-
|
12
|
-
s.author = ['Shawn Neal', 'Matt Wrock']
|
13
|
-
s.email = ['sneal@sneal.net', 'matt@mattwrock.com']
|
14
|
-
s.homepage = 'http://github.com/WinRb/winrm-fs'
|
15
|
-
|
16
|
-
s.summary = 'WinRM File System'
|
17
|
-
s.description = <<-EOF
|
18
|
-
Ruby library for file system operations via Windows Remote Management
|
19
|
-
EOF
|
20
|
-
|
21
|
-
s.files = `git ls-files`.split(/\n/)
|
22
|
-
s.require_path = 'lib'
|
23
|
-
s.rdoc_options = %w(-x test/ -x examples/)
|
24
|
-
s.extra_rdoc_files = %w(README.md LICENSE)
|
25
|
-
|
26
|
-
s.bindir = 'bin'
|
27
|
-
s.executables = ['rwinrmcp']
|
28
|
-
s.required_ruby_version = '>= 1.9.0'
|
29
|
-
s.add_runtime_dependency 'erubis', '~> 2.7'
|
30
|
-
s.add_runtime_dependency 'logging', ['>= 1.6.1', '< 3.0']
|
31
|
-
s.add_runtime_dependency 'rubyzip', '~> 1.1'
|
32
|
-
s.add_runtime_dependency 'winrm', '~> 1.5'
|
33
|
-
s.add_development_dependency 'pry'
|
34
|
-
s.add_development_dependency 'rspec', '~> 3.0.0'
|
35
|
-
s.add_development_dependency 'rake', '~> 10.3.2'
|
36
|
-
s.add_development_dependency 'rubocop', '~> 0.28.0'
|
37
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.name = 'winrm-fs'
|
9
|
+
s.version = version
|
10
|
+
s.date = Date.today.to_s
|
11
|
+
|
12
|
+
s.author = ['Shawn Neal', 'Matt Wrock']
|
13
|
+
s.email = ['sneal@sneal.net', 'matt@mattwrock.com']
|
14
|
+
s.homepage = 'http://github.com/WinRb/winrm-fs'
|
15
|
+
|
16
|
+
s.summary = 'WinRM File System'
|
17
|
+
s.description = <<-EOF
|
18
|
+
Ruby library for file system operations via Windows Remote Management
|
19
|
+
EOF
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split(/\n/)
|
22
|
+
s.require_path = 'lib'
|
23
|
+
s.rdoc_options = %w(-x test/ -x examples/)
|
24
|
+
s.extra_rdoc_files = %w(README.md LICENSE)
|
25
|
+
|
26
|
+
s.bindir = 'bin'
|
27
|
+
s.executables = ['rwinrmcp']
|
28
|
+
s.required_ruby_version = '>= 1.9.0'
|
29
|
+
s.add_runtime_dependency 'erubis', '~> 2.7'
|
30
|
+
s.add_runtime_dependency 'logging', ['>= 1.6.1', '< 3.0']
|
31
|
+
s.add_runtime_dependency 'rubyzip', '~> 1.1'
|
32
|
+
s.add_runtime_dependency 'winrm', '~> 1.5'
|
33
|
+
s.add_development_dependency 'pry'
|
34
|
+
s.add_development_dependency 'rspec', '~> 3.0.0'
|
35
|
+
s.add_development_dependency 'rake', '~> 10.3.2'
|
36
|
+
s.add_development_dependency 'rubocop', '~> 0.28.0'
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winrm-fs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Neal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubis
|