win32-service 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +21 -0
- data/MANIFEST +6 -5
- data/README +2 -1
- data/Rakefile +128 -0
- data/doc/daemon.txt +5 -3
- data/doc/service.txt +13 -10
- data/examples/demo_daemon_ctl.rb +122 -0
- data/examples/demo_services.rb +23 -0
- data/ext/extconf.rb +5 -5
- data/ext/win32/daemon.c +107 -107
- data/lib/win32/daemon.so +0 -0
- data/lib/win32/service.rb +52 -24
- data/test/{tc_daemon.rb → test_win32_daemon.rb} +4 -1
- data/test/{tc_service.rb → test_win32_service.rb} +5 -14
- data/test/test_win32_service_configure.rb +86 -0
- data/test/test_win32_service_create.rb +103 -0
- data/test/{tc_service_info.rb → test_win32_service_info.rb} +12 -3
- data/test/{tc_service_status.rb → test_win32_service_status.rb} +3 -0
- data/win32-service.gemspec +49 -0
- metadata +42 -21
- data/test/tc_service_create.rb +0 -83
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
spec = Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'win32-service'
|
5
|
+
gem.version = '0.7.0'
|
6
|
+
gem.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
|
+
gem.email = 'djberg96@gmail.com'
|
8
|
+
gem.license = 'Artistic 2.0'
|
9
|
+
gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
+
gem.platform = Gem::Platform::RUBY
|
11
|
+
gem.summary = 'An interface for MS Windows services'
|
12
|
+
gem.test_files = Dir['test/test*.rb']
|
13
|
+
gem.has_rdoc = true
|
14
|
+
gem.extensions = ['ext/extconf.rb']
|
15
|
+
|
16
|
+
# Don't include daemon.rb for now
|
17
|
+
gem.files = Dir['**/*'].delete_if{ |f|
|
18
|
+
f.include?('CVS') || f.include?('daemon.rb')
|
19
|
+
}
|
20
|
+
|
21
|
+
gem.extra_rdoc_files = [
|
22
|
+
'CHANGES',
|
23
|
+
'README',
|
24
|
+
'MANIFEST',
|
25
|
+
'doc/service.txt',
|
26
|
+
'doc/daemon.txt',
|
27
|
+
'ext/win32/daemon.c'
|
28
|
+
]
|
29
|
+
|
30
|
+
gem.rubyforge_project = 'win32utils'
|
31
|
+
gem.required_ruby_version = '>= 1.8.2'
|
32
|
+
|
33
|
+
gem.add_dependency('windows-pr', '>= 1.0.5')
|
34
|
+
gem.add_dependency('test-unit', '>= 2.0.2')
|
35
|
+
|
36
|
+
gem.description = <<-EOF
|
37
|
+
The win32-service library provides a Ruby interface to services on
|
38
|
+
MS Windows. You can create new services, or control, configure and
|
39
|
+
inspect existing services.
|
40
|
+
|
41
|
+
In addition, you can create a pure Ruby service by using the Daemon
|
42
|
+
class that is included as part of the library.
|
43
|
+
EOF
|
44
|
+
end
|
45
|
+
|
46
|
+
if $PROGRAM_NAME == __FILE__
|
47
|
+
Gem.manage_gems if Gem::RubyGemsVersion.to_f < 1.0
|
48
|
+
Gem::Builder.new(spec).build
|
49
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
+
- Park Heesob
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2009-06-30 00:00:00 -06:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: windows-pr
|
18
|
+
type: :runtime
|
17
19
|
version_requirement:
|
18
20
|
version_requirements: !ruby/object:Gem::Requirement
|
19
21
|
requirements:
|
20
22
|
- - ">="
|
21
23
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
24
|
+
version: 1.0.5
|
23
25
|
version:
|
24
|
-
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: test-unit
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.0.2
|
35
|
+
version:
|
36
|
+
description: " The win32-service library provides a Ruby interface to services on\n MS Windows. You can create new services, or control, configure and\n inspect existing services.\n\n In addition, you can create a pure Ruby service by using the Daemon\n class that is included as part of the library.\n"
|
25
37
|
email: djberg96@gmail.com
|
26
38
|
executables: []
|
27
39
|
|
@@ -31,24 +43,32 @@ extra_rdoc_files:
|
|
31
43
|
- CHANGES
|
32
44
|
- README
|
33
45
|
- MANIFEST
|
34
|
-
- ext/win32/daemon.c
|
35
46
|
- doc/service.txt
|
36
47
|
- doc/daemon.txt
|
48
|
+
- ext/win32/daemon.c
|
37
49
|
files:
|
50
|
+
- CHANGES
|
38
51
|
- doc/daemon.txt
|
39
52
|
- doc/service.txt
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
- test/tc_service_info.rb
|
44
|
-
- test/tc_service_status.rb
|
45
|
-
- lib/win32/service.rb
|
53
|
+
- examples/demo_daemon_ctl.rb
|
54
|
+
- examples/demo_services.rb
|
55
|
+
- ext/extconf.rb
|
46
56
|
- ext/win32/daemon.c
|
47
|
-
-
|
48
|
-
-
|
57
|
+
- lib/win32/daemon.so
|
58
|
+
- lib/win32/service.rb
|
49
59
|
- MANIFEST
|
60
|
+
- Rakefile
|
61
|
+
- README
|
62
|
+
- test/test_win32_service.rb
|
63
|
+
- test/test_win32_service_configure.rb
|
64
|
+
- test/test_win32_service_create.rb
|
65
|
+
- test/test_win32_service_info.rb
|
66
|
+
- test/test_win32_service_status.rb
|
67
|
+
- win32-service.gemspec
|
50
68
|
has_rdoc: true
|
51
69
|
homepage: http://www.rubyforge.org/projects/win32utils
|
70
|
+
licenses:
|
71
|
+
- Artistic 2.0
|
52
72
|
post_install_message:
|
53
73
|
rdoc_options: []
|
54
74
|
|
@@ -69,13 +89,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
89
|
requirements: []
|
70
90
|
|
71
91
|
rubyforge_project: win32utils
|
72
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.3.4
|
73
93
|
signing_key:
|
74
|
-
specification_version:
|
75
|
-
summary: An
|
94
|
+
specification_version: 3
|
95
|
+
summary: An interface for MS Windows services
|
76
96
|
test_files:
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/
|
80
|
-
- test/
|
81
|
-
- test/
|
97
|
+
- test/test_win32_daemon.rb
|
98
|
+
- test/test_win32_service.rb
|
99
|
+
- test/test_win32_service_configure.rb
|
100
|
+
- test/test_win32_service_create.rb
|
101
|
+
- test/test_win32_service_info.rb
|
102
|
+
- test/test_win32_service_status.rb
|
data/test/tc_service_create.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
########################################################################
|
2
|
-
# tc_service_create.rb
|
3
|
-
#
|
4
|
-
# Test case for the Service.create method. This test case will create
|
5
|
-
# a dummy (notepad) service. It won't actually run of course.
|
6
|
-
########################################################################
|
7
|
-
require 'win32/service'
|
8
|
-
require 'test/unit'
|
9
|
-
|
10
|
-
class TC_Service_Create < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@notepad = "C:\\windows\\system32\\notepad.exe"
|
13
|
-
@service = 'notepad'
|
14
|
-
@info = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_create_basic
|
18
|
-
assert_respond_to(Win32::Service, :new)
|
19
|
-
assert_respond_to(Win32::Service, :create)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_create_with_minimal_options
|
23
|
-
assert_nothing_raised{
|
24
|
-
Win32::Service.new(@service, nil, :binary_path_name => @notepad)
|
25
|
-
}
|
26
|
-
|
27
|
-
assert_equal(true, Win32::Service.exists?(@service))
|
28
|
-
assert_nothing_raised{ @info = Win32::Service.config_info(@service) }
|
29
|
-
|
30
|
-
assert_equal('own process, interactive', @info.service_type)
|
31
|
-
assert_equal('demand start', @info.start_type)
|
32
|
-
assert_equal('normal', @info.error_control)
|
33
|
-
assert_equal(@notepad, @info.binary_path_name)
|
34
|
-
assert_equal('', @info.load_order_group)
|
35
|
-
assert_equal(0, @info.tag_id)
|
36
|
-
assert_equal([], @info.dependencies)
|
37
|
-
assert_equal('LocalSystem', @info.service_start_name)
|
38
|
-
assert_equal('notepad', @info.display_name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_create_with_most_options
|
42
|
-
assert_nothing_raised{
|
43
|
-
Win32::Service.new(@service, nil,
|
44
|
-
:display_name => 'Notepad Test',
|
45
|
-
:desired_access => Win32::Service::ALL_ACCESS,
|
46
|
-
:service_type => Win32::Service::WIN32_OWN_PROCESS,
|
47
|
-
:start_type => Win32::Service::DISABLED,
|
48
|
-
:error_control => Win32::Service::ERROR_IGNORE,
|
49
|
-
:binary_path_name => @notepad,
|
50
|
-
:load_order_group => 'Network',
|
51
|
-
:dependencies => 'W32Time',
|
52
|
-
:description => 'Test service. Please delete me'
|
53
|
-
)
|
54
|
-
}
|
55
|
-
assert_equal(true, Win32::Service.exists?(@service))
|
56
|
-
assert_nothing_raised{ @info = Win32::Service.config_info(@service) }
|
57
|
-
|
58
|
-
assert_equal('own process', @info.service_type)
|
59
|
-
assert_equal('disabled', @info.start_type)
|
60
|
-
assert_equal('ignore', @info.error_control)
|
61
|
-
assert_equal(@notepad, @info.binary_path_name)
|
62
|
-
assert_equal('Network', @info.load_order_group)
|
63
|
-
assert_equal(0, @info.tag_id)
|
64
|
-
assert_equal(['W32Time'], @info.dependencies)
|
65
|
-
assert_equal('LocalSystem', @info.service_start_name)
|
66
|
-
assert_equal('Notepad Test', @info.display_name)
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_create_expected_errors
|
70
|
-
assert_raise(ArgumentError){ Win32::Service.new }
|
71
|
-
assert_raise(ArgumentError){ Win32::Service.new(@service) }
|
72
|
-
assert_raise(ArgumentError){ Win32::Service.new(@service, 'bogus') }
|
73
|
-
end
|
74
|
-
|
75
|
-
def teardown
|
76
|
-
Win32::Service.delete(@service) if Win32::Service.exists?(@service)
|
77
|
-
sleep 1 while Win32::Service.exists?(@service)
|
78
|
-
|
79
|
-
@notepad = nil
|
80
|
-
@service = nil
|
81
|
-
@status = nil
|
82
|
-
end
|
83
|
-
end
|