winrm-elevated 1.1.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winrm-elevated
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Neal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: erubi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: winrm
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,49 +53,55 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: rspec
56
+ name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: '3.2'
61
+ version: '10.3'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '13'
48
65
  type: :development
49
66
  prerelease: false
50
67
  version_requirements: !ruby/object:Gem::Requirement
51
68
  requirements:
52
- - - "~>"
69
+ - - ">="
53
70
  - !ruby/object:Gem::Version
54
- version: '3.2'
71
+ version: '10.3'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '13'
55
75
  - !ruby/object:Gem::Dependency
56
- name: rake
76
+ name: rspec
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
79
  - - "~>"
60
80
  - !ruby/object:Gem::Version
61
- version: '10.3'
81
+ version: '3.2'
62
82
  type: :development
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
86
  - - "~>"
67
87
  - !ruby/object:Gem::Version
68
- version: '10.3'
88
+ version: '3.2'
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: rubocop
71
91
  requirement: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: '0.28'
95
+ version: 0.51.0
76
96
  type: :development
77
97
  prerelease: false
78
98
  version_requirements: !ruby/object:Gem::Requirement
79
99
  requirements:
80
100
  - - "~>"
81
101
  - !ruby/object:Gem::Version
82
- version: '0.28'
83
- description: " Ruby library for running commands via WinRM as elevated through
84
- a scheduled task\n"
102
+ version: 0.51.0
103
+ description: Ruby library for running commands via WinRM as elevated through a scheduled
104
+ task
85
105
  email:
86
106
  - sneal@sneal.net
87
107
  executables: []
@@ -90,50 +110,31 @@ extra_rdoc_files:
90
110
  - README.md
91
111
  - LICENSE
92
112
  files:
93
- - ".gitignore"
94
- - ".rspec"
95
- - ".rubocop.yml"
96
- - ".travis.yml"
97
- - Gemfile
98
113
  - LICENSE
99
114
  - README.md
100
- - Rakefile
101
- - VERSION
102
- - appveyor.yml
103
- - changelog.md
104
115
  - lib/winrm-elevated.rb
105
116
  - lib/winrm-elevated/scripts/elevated_shell.ps1
106
117
  - lib/winrm/shells/elevated.rb
107
- - spec/config-example.yml
108
- - spec/matchers.rb
109
- - spec/powershell_elevated_spec.rb
110
- - spec/spec_helper.rb
111
- - winrm-elevated.gemspec
112
118
  homepage: https://github.com/WinRb/winrm-elevated
113
119
  licenses:
114
120
  - Apache-2.0
115
121
  metadata: {}
116
122
  post_install_message:
117
- rdoc_options:
118
- - "-x"
119
- - test/
120
- - "-x"
121
- - examples/
123
+ rdoc_options: []
122
124
  require_paths:
123
125
  - lib
124
126
  required_ruby_version: !ruby/object:Gem::Requirement
125
127
  requirements:
126
128
  - - ">="
127
129
  - !ruby/object:Gem::Version
128
- version: 1.9.0
130
+ version: 2.3.0
129
131
  required_rubygems_version: !ruby/object:Gem::Requirement
130
132
  requirements:
131
133
  - - ">="
132
134
  - !ruby/object:Gem::Version
133
135
  version: '0'
134
136
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.6.6
137
+ rubygems_version: 3.1.2
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: Ruby library for running commands as elevated
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- *.swp
2
- *.gem
3
- pkg/*
4
- .rvmrc
5
- .idea
6
- .bundle
7
- spec/config.yml
8
- Gemfile.lock
9
- .vagrant
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format nested
3
- --require spec_helper
@@ -1,17 +0,0 @@
1
- Style/FileName:
2
- Enabled: false
3
-
4
- Style/Encoding:
5
- Enabled: true
6
-
7
- Metrics/LineLength:
8
- Max: 120
9
-
10
- Metrics/MethodLength:
11
- Max: 20
12
-
13
- ClassLength:
14
- Max: 250
15
-
16
- Metrics/AbcSize:
17
- Max: 25
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
6
-
7
- # This prevents testing branches that are created just for PRs
8
- branches:
9
- only:
10
- - master
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- # encoding: UTF-8
2
- source 'https://rubygems.org'
3
- gemspec
4
-
5
- group :development do
6
- # Use a tighter specification until rubocop issues are fixed.
7
- # Then remove this
8
- gem 'rubocop', '~> 0.28.0'
9
- end
data/Rakefile DELETED
@@ -1,28 +0,0 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'bundler/setup'
4
- require 'rspec/core/rake_task'
5
- require 'rubocop/rake_task'
6
- require 'bundler/gem_tasks'
7
-
8
- # Change to the directory of this file.
9
- Dir.chdir(File.expand_path('../', __FILE__))
10
-
11
- RSpec::Core::RakeTask.new(:spec) do |task|
12
- task.pattern = 'spec/*_spec.rb'
13
- task.rspec_opts = ['--color', '-f documentation']
14
- task.rspec_opts << '-tunit'
15
- end
16
-
17
- # Run the integration test suite
18
- RSpec::Core::RakeTask.new(:integration) do |task|
19
- task.pattern = 'spec/*_spec.rb'
20
- task.rspec_opts = ['--color', '-f documentation']
21
- task.rspec_opts << '-tintegration'
22
- end
23
-
24
- RuboCop::RakeTask.new
25
-
26
- task default: [:spec, :rubocop]
27
-
28
- task all: [:default, :integration]
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.1.0
@@ -1,39 +0,0 @@
1
- version: "master-{build}"
2
-
3
- os: Windows Server 2012 R2
4
- platform:
5
- - x64
6
-
7
- environment:
8
- winrm_user: test_user
9
- winrm_password: Pa$$word1
10
-
11
- matrix:
12
- - ruby_version: "21"
13
- winrm_endpoint: http://localhost:5985/wsman
14
-
15
- clone_folder: c:\projects\winrm-elevated
16
- clone_depth: 1
17
- branches:
18
- only:
19
- - master
20
-
21
- install:
22
- - ps: net user /add $env:winrm_user $env:winrm_password
23
- - ps: net localgroup administrators $env:winrm_user /add
24
- - ps: winrm set winrm/config/client/auth '@{Basic="true"}'
25
- - ps: winrm set winrm/config/service/auth '@{Basic="true"}'
26
- - ps: winrm set winrm/config/service '@{AllowUnencrypted="true"}'
27
- - ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
28
- - ps: Write-Host $env:PATH
29
- - ps: ruby --version
30
- - ps: gem --version
31
- - ps: gem install bundler --quiet --no-ri --no-rdoc
32
- - ps: bundler --version
33
-
34
- build_script:
35
- - bundle install || bundle install || bundle install
36
-
37
- test_script:
38
- - SET SPEC_OPTS=--format progress
39
- - bundle exec rake integration
@@ -1,31 +0,0 @@
1
- # WinRM-Elevated Gem Changelog
2
-
3
- # 1.1.0
4
- - Allow tasks to be configured for interactive logon
5
- - Fix broken credentials when they contain dollar signs
6
- - Do not fail when temporary files cannot be deleted
7
-
8
- # 1.0.1
9
- - Fix to avoid profile conflicts
10
- - Fix inadequate Execution Policy errors
11
-
12
- # 1.0.0
13
- - Adjust to comply with winrm v2 APIs
14
- - Expose implementation as a class of `WinRM::Shells`
15
-
16
- # 0.4.0
17
- - Initialize `Elevated::Runner` with a `CommandExecutor` instead of a `WinrmService` client
18
- - Run commands from newer winrm executor
19
- - Use latest winrm-fs 0.4.2
20
- - Allow task to run as a service account
21
- - Provide an artificially long timeout to the task to keep the task from dying after 60 seconds
22
-
23
- # 0.3.0
24
- - [Name Powershell Script and Log Files Uniquely](https://github.com/WinRb/winrm-elevated/pull/6)
25
-
26
- # 0.2.0
27
- - [Only upload the elevated runner script once per winrm session](https://github.com/WinRb/winrm-elevated/pull/3)
28
- - Bump WinRM (1.5) and WinRM-fs (0.3.0) gem constraints
29
-
30
- # 0.1.0
31
- - Initial Release
@@ -1,3 +0,0 @@
1
- endpoint: "http://localhost:55985/wsman"
2
- user: vagrant
3
- password: vagrant
@@ -1,50 +0,0 @@
1
- # encoding: UTF-8
2
- require 'rspec/expectations'
3
-
4
- # rspec matchers
5
- RSpec::Matchers.define :have_stdout_match do |expected_stdout|
6
- match do |actual_output|
7
- !expected_stdout.match(actual_output.stdout).nil?
8
- end
9
- failure_message do |actual_output|
10
- "expected that '#{actual_output.stdout}' would match #{expected_stdout}"
11
- end
12
- end
13
-
14
- RSpec::Matchers.define :have_stderr_match do |expected_stderr|
15
- match do |actual_output|
16
- !expected_stderr.match(actual_output.stderr).nil?
17
- end
18
- failure_message do |actual_output|
19
- "expected that '#{actual_output.stderr}' would match #{expected_stderr}"
20
- end
21
- end
22
-
23
- RSpec::Matchers.define :have_no_stdout do
24
- match do |actual_output|
25
- stdout = actual_output.stdout
26
- stdout == '\r\n' || stdout == ''
27
- end
28
- failure_message do |actual_output|
29
- "expected that '#{actual_output.stdout}' would have no stdout"
30
- end
31
- end
32
-
33
- RSpec::Matchers.define :have_no_stderr do
34
- match do |actual_output|
35
- stderr = actual_output.stderr
36
- stderr == '\r\n' || stderr == ''
37
- end
38
- failure_message do |actual_output|
39
- "expected that '#{actual_output.stderr}' would have no stderr"
40
- end
41
- end
42
-
43
- RSpec::Matchers.define :have_exit_code do |expected_exit_code|
44
- match do |actual_output|
45
- expected_exit_code == actual_output.exitcode
46
- end
47
- failure_message do |actual_output|
48
- "expected exit code #{expected_exit_code}, but got #{actual_output.exitcode}"
49
- end
50
- end
@@ -1,87 +0,0 @@
1
- # encoding: UTF-8
2
- describe 'powershell elevated runner', integration: true do
3
- describe 'ipconfig' do
4
- subject(:output) { elevated_shell.run('ipconfig') }
5
- it { should have_exit_code 0 }
6
- it { should have_stdout_match(/Windows IP Configuration/) }
7
- it { should have_no_stderr }
8
- end
9
-
10
- describe 'ipconfig as Service' do
11
- subject(:output) do
12
- elevated_shell.username = 'System'
13
- elevated_shell.password = nil
14
- elevated_shell.run('ipconfig')
15
- end
16
- it { should have_exit_code 0 }
17
- it { should have_stdout_match(/Windows IP Configuration/) }
18
- it { should have_no_stderr }
19
- end
20
-
21
- describe 'echo \'hello world\' using apostrophes' do
22
- subject(:output) { elevated_shell.run("echo 'hello world'") }
23
- it { should have_exit_code 0 }
24
- it { should have_stdout_match(/hello world/) }
25
- it { should have_no_stderr }
26
- end
27
-
28
- describe 'ipconfig with incorrect argument -z' do
29
- subject(:output) { elevated_shell.run('ipconfig 127.0.0.1 -z') }
30
- it { should have_exit_code 1 }
31
- end
32
-
33
- describe 'Math area calculation' do
34
- subject(:output) do
35
- cmd = <<-EOH
36
- $diameter = 4.5
37
- $area = [Math]::pow([Math]::PI * ($diameter/2), 2)
38
- Write-Host $area
39
- EOH
40
- elevated_shell.run(cmd)
41
- end
42
- it { should have_exit_code 0 }
43
- it { should have_stdout_match(/49.9648722805149/) }
44
- it { should have_no_stderr }
45
- end
46
-
47
- describe 'ipconfig with a block' do
48
- subject(:stdout) do
49
- outvar = ''
50
- elevated_shell.run('ipconfig') do |stdout, _stderr|
51
- outvar << stdout
52
- end
53
- outvar
54
- end
55
- it { should match(/Windows IP Configuration/) }
56
- end
57
-
58
- describe 'capturing output from Write-Host and Write-Error' do
59
- subject(:output) do
60
- script = <<-eos
61
- Write-Host 'Hello'
62
- $host.ui.WriteErrorLine(', world!')
63
- eos
64
-
65
- @captured_stdout = ''
66
- @captured_stderr = ''
67
- elevated_shell.run(script) do |stdout, stderr|
68
- @captured_stdout << stdout if stdout
69
- @captured_stderr << stderr if stderr
70
- end
71
- end
72
-
73
- it 'should have stdout' do
74
- expect(output.stdout).to eq("Hello\r\n")
75
- expect(output.stdout).to eq(@captured_stdout)
76
- end
77
-
78
- it 'should have stderr' do
79
- expect(output.stderr).to eq(", world!\r\n")
80
- expect(output.stderr).to eq(@captured_stderr)
81
- end
82
-
83
- it 'should have output' do
84
- expect(output.output).to eq("Hello\r\n, world!\r\n")
85
- end
86
- end
87
- end