win32-service 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +6 -0
- data/README +1 -1
- data/lib/win32/daemon.rb +1 -1
- data/lib/win32/service.rb +29 -4
- data/lib/win32/windows/structs.rb +4 -0
- data/test/test_win32_daemon.rb +1 -1
- data/test/test_win32_service.rb +2 -1
- data/test/test_win32_service_configure.rb +5 -0
- data/test/test_win32_service_info.rb +6 -1
- data/win32-service.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c61135d653d2cd836f4b191664aade237c35ceb
|
4
|
+
data.tar.gz: 1d5c27933e9a68469dcc40ca580307e521eebfe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c23f2a150c83ab807c44d15b7fd52efdfcfef3018472470838ebf3895685f10475a427e78375ca75f9b01367816a7668b920ca1dd257d4515df90b3fe67e22cb
|
7
|
+
data.tar.gz: 705f5de01cdf3e709350385763afe7b7aa3bdf63c81b0b914da6a1c84181435b116e38617cf6a96974b2c836bf40632b25bf4ebd7463aadc1528606e674671ec
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.8.4 - 23-Jan-2014
|
2
|
+
* Added support for the delayed start startup type. Thanks go to Jim Arnold
|
3
|
+
for the patch.
|
4
|
+
* Fixed the service test that ensures that trying to start an already running
|
5
|
+
service will raise an error. Thanks again to Jim Arnold for the patch.
|
6
|
+
|
1
7
|
== 0.8.3 - 1-Nov-2013
|
2
8
|
* Fixed a bug where a service's state could be changed when merely
|
3
9
|
interrogating the service. Thanks go to Glenn Sarti / Puppet Labs
|
data/README
CHANGED
data/lib/win32/daemon.rb
CHANGED
data/lib/win32/service.rb
CHANGED
@@ -17,7 +17,7 @@ module Win32
|
|
17
17
|
extend Windows::Functions
|
18
18
|
|
19
19
|
# The version of the win32-service library
|
20
|
-
VERSION = '0.8.
|
20
|
+
VERSION = '0.8.4'
|
21
21
|
|
22
22
|
# SCM security and access rights
|
23
23
|
|
@@ -244,7 +244,8 @@ module Win32
|
|
244
244
|
:reboot_message,
|
245
245
|
:command,
|
246
246
|
:num_actions,
|
247
|
-
:actions
|
247
|
+
:actions,
|
248
|
+
:delayed_start
|
248
249
|
)
|
249
250
|
|
250
251
|
# :startdoc: #
|
@@ -479,7 +480,8 @@ module Win32
|
|
479
480
|
'failure_actions' => nil,
|
480
481
|
'failure_delay' => 0,
|
481
482
|
'service_name' => nil,
|
482
|
-
'host' => nil
|
483
|
+
'host' => nil,
|
484
|
+
'delayed_start' => false
|
483
485
|
}
|
484
486
|
|
485
487
|
# Validate the hash options
|
@@ -563,6 +565,19 @@ module Win32
|
|
563
565
|
FFI.raise_windows_error('ChangeServiceConfig2') unless bool
|
564
566
|
end
|
565
567
|
|
568
|
+
if opts['delayed_start']
|
569
|
+
delayed_start = SERVICE_DELAYED_AUTO_START_INFO.new
|
570
|
+
delayed_start[:fDelayedAutostart] = opts['delayed_start']
|
571
|
+
|
572
|
+
bool = ChangeServiceConfig2(
|
573
|
+
handle_scs,
|
574
|
+
SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
|
575
|
+
delayed_start
|
576
|
+
)
|
577
|
+
|
578
|
+
FFI.raise_windows_error('ChangeServiceConfig2') unless bool
|
579
|
+
end
|
580
|
+
|
566
581
|
if opts['failure_reset_period'] || opts['failure_reboot_message'] ||
|
567
582
|
opts['failure_command'] || opts['failure_actions']
|
568
583
|
then
|
@@ -1069,6 +1084,15 @@ module Win32
|
|
1069
1084
|
else
|
1070
1085
|
description = buf.read_pointer.read_string
|
1071
1086
|
end
|
1087
|
+
|
1088
|
+
delayed_start_buf = get_config2_info(handle_scs, SERVICE_CONFIG_DELAYED_AUTO_START_INFO)
|
1089
|
+
|
1090
|
+
if delayed_start_buf.is_a?(FFI::MemoryPointer)
|
1091
|
+
delayed_start_info = SERVICE_DELAYED_AUTO_START_INFO.new(delayed_start_buf)
|
1092
|
+
delayed_start = delayed_start_info[:fDelayedAutostart]
|
1093
|
+
else
|
1094
|
+
delayed_start = false
|
1095
|
+
end
|
1072
1096
|
else
|
1073
1097
|
msg = "WARNING: The registry entry for the #{service_name} "
|
1074
1098
|
msg += "service could not be found."
|
@@ -1153,7 +1177,8 @@ module Win32
|
|
1153
1177
|
reboot_msg,
|
1154
1178
|
command,
|
1155
1179
|
num_actions,
|
1156
|
-
actions
|
1180
|
+
actions,
|
1181
|
+
delayed_start
|
1157
1182
|
)
|
1158
1183
|
|
1159
1184
|
if block_given?
|
data/test/test_win32_daemon.rb
CHANGED
data/test/test_win32_service.rb
CHANGED
@@ -52,7 +52,7 @@ class TC_Win32_Service < Test::Unit::TestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
test "version number is expected value" do
|
55
|
-
assert_equal('0.8.
|
55
|
+
assert_equal('0.8.4', Win32::Service::VERSION)
|
56
56
|
end
|
57
57
|
|
58
58
|
test "services basic functionality" do
|
@@ -218,6 +218,7 @@ class TC_Win32_Service < Test::Unit::TestCase
|
|
218
218
|
end
|
219
219
|
|
220
220
|
test "attempting to start a running service raises an error" do
|
221
|
+
start_service(@service_name)
|
221
222
|
assert_raise(SystemCallError){ Win32::Service.start(@service_name) }
|
222
223
|
end
|
223
224
|
|
@@ -64,6 +64,11 @@ class TC_Win32_Service_Configure < Test::Unit::TestCase
|
|
64
64
|
assert_equal('disabled', config_info.start_type)
|
65
65
|
end
|
66
66
|
|
67
|
+
test "service start can be delayed" do
|
68
|
+
service_configure(:start_type => Win32::Service::AUTO_START, :delayed_start => true)
|
69
|
+
assert_true(full_info.delayed_start)
|
70
|
+
end
|
71
|
+
|
67
72
|
test "the configure method requires one argument" do
|
68
73
|
assert_raise(ArgumentError){ Win32::Service.configure }
|
69
74
|
end
|
@@ -162,7 +162,7 @@ class TC_Win32_ServiceInfo_Struct < Test::Unit::TestCase
|
|
162
162
|
|
163
163
|
def test_service_info_interactive
|
164
164
|
assert_respond_to(@service_info, :interactive)
|
165
|
-
|
165
|
+
assert_boolean(@service_info.interactive)
|
166
166
|
end
|
167
167
|
|
168
168
|
def test_service_info_service_flags
|
@@ -170,6 +170,11 @@ class TC_Win32_ServiceInfo_Struct < Test::Unit::TestCase
|
|
170
170
|
assert([0,1].include?(@service_info.service_flags))
|
171
171
|
end
|
172
172
|
|
173
|
+
def test_service_info_delayed_start
|
174
|
+
assert_respond_to(@service_info, :delayed_start)
|
175
|
+
assert_boolean(@service_info.delayed_start)
|
176
|
+
end
|
177
|
+
|
173
178
|
def teardown
|
174
179
|
@types = nil
|
175
180
|
@states = nil
|
data/win32-service.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'win32-service'
|
5
|
-
spec.version = '0.8.
|
5
|
+
spec.version = '0.8.4'
|
6
6
|
spec.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
7
|
spec.license = 'Artistic 2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
]
|
22
22
|
|
23
23
|
spec.add_dependency('ffi')
|
24
|
-
spec.add_development_dependency('test-unit'
|
24
|
+
spec.add_development_dependency('test-unit')
|
25
25
|
spec.add_development_dependency('rake')
|
26
26
|
|
27
27
|
spec.description = <<-EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.0.3
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: An interface for MS Windows services
|