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.
@@ -1,58 +0,0 @@
1
- # encoding: UTF-8
2
- require 'winrm'
3
- require 'winrm-elevated'
4
- require_relative 'matchers'
5
-
6
- # Creates a WinRM connection for integration tests
7
- module ConnectionHelper
8
- def winrm_connection
9
- WinRM::Connection.new(winrm_config)
10
- end
11
-
12
- def elevated_shell
13
- @elevated_shell ||= winrm_connection.shell(:elevated)
14
- end
15
-
16
- def winrm_config
17
- unless @winrm_config
18
- path = File.expand_path("#{File.dirname(__FILE__)}/config.yml")
19
- unless File.exist?(path)
20
- path = File.expand_path("#{File.dirname(__FILE__)}/config-example.yml")
21
- end
22
- @winrm_config = symbolize_keys(YAML.load(File.read(path)))
23
- @winrm_config[:endpoint] = ENV['winrm_endpoint'] if ENV['winrm_endpoint']
24
- @winrm_config[:user] = ENV['winrm_user'] if ENV['winrm_user']
25
- @winrm_config[:password] = ENV['winrm_password'] if ENV['winrm_password']
26
- end
27
- @winrm_config
28
- end
29
-
30
- def username
31
- winrm_config[:user]
32
- end
33
-
34
- def password
35
- winrm_config[:password]
36
- end
37
-
38
- # rubocop:disable Metrics/MethodLength
39
- def symbolize_keys(hash)
40
- hash.each_with_object({}) do |(key, value), result|
41
- new_key = case key
42
- when String then key.to_sym
43
- else key
44
- end
45
- new_value = case value
46
- when Hash then symbolize_keys(value)
47
- else value
48
- end
49
- result[new_key] = new_value
50
- result
51
- end
52
- end
53
- # rubocop:enable Metrics/MethodLength
54
- end
55
-
56
- RSpec.configure do |config|
57
- config.include(ConnectionHelper)
58
- end
@@ -1,33 +0,0 @@
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-elevated'
9
- s.version = version
10
- s.date = Date.today.to_s
11
-
12
- s.author = ['Shawn Neal']
13
- s.email = ['sneal@sneal.net']
14
- s.homepage = 'https://github.com/WinRb/winrm-elevated'
15
-
16
- s.summary = 'Ruby library for running commands as elevated'
17
- s.description = <<-EOF
18
- Ruby library for running commands via WinRM as elevated through a scheduled task
19
- EOF
20
- s.license = 'Apache-2.0'
21
-
22
- s.files = `git ls-files`.split(/\n/)
23
- s.require_path = 'lib'
24
- s.rdoc_options = %w(-x test/ -x examples/)
25
- s.extra_rdoc_files = %w(README.md LICENSE)
26
-
27
- s.required_ruby_version = '>= 1.9.0'
28
- s.add_runtime_dependency 'winrm', '~> 2.0'
29
- s.add_runtime_dependency 'winrm-fs', '~> 1.0'
30
- s.add_development_dependency 'rspec', '~> 3.2'
31
- s.add_development_dependency 'rake', '~> 10.3'
32
- s.add_development_dependency 'rubocop', '~> 0.28'
33
- end