win32-service 0.6.1-x86-mswin32-60 → 0.7.0-x86-mswin32-60
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.rb +89 -0
- data/examples/demo_daemon_ctl.rb +122 -0
- data/examples/demo_services.rb +23 -0
- data/ext/win32/daemon.c +596 -0
- 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 -19
- 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: x86-mswin32-60
|
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
|
|
@@ -33,21 +45,31 @@ extra_rdoc_files:
|
|
33
45
|
- MANIFEST
|
34
46
|
- doc/service.txt
|
35
47
|
- doc/daemon.txt
|
48
|
+
- ext/win32/daemon.c
|
36
49
|
files:
|
50
|
+
- CHANGES
|
37
51
|
- doc/daemon.txt
|
38
52
|
- doc/service.txt
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
- test/tc_service_info.rb
|
43
|
-
- test/tc_service_status.rb
|
53
|
+
- examples/demo_daemon.rb
|
54
|
+
- examples/demo_daemon_ctl.rb
|
55
|
+
- examples/demo_services.rb
|
44
56
|
- lib/win32/daemon.so
|
45
57
|
- lib/win32/service.rb
|
46
|
-
- CHANGES
|
47
|
-
- README
|
48
58
|
- MANIFEST
|
59
|
+
- Rakefile
|
60
|
+
- README
|
61
|
+
- test/test_win32_daemon.rb
|
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
|
68
|
+
- ext/win32/daemon.c
|
49
69
|
has_rdoc: true
|
50
70
|
homepage: http://www.rubyforge.org/projects/win32utils
|
71
|
+
licenses:
|
72
|
+
- Artistic 2.0
|
51
73
|
post_install_message:
|
52
74
|
rdoc_options: []
|
53
75
|
|
@@ -68,13 +90,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
90
|
requirements: []
|
69
91
|
|
70
92
|
rubyforge_project: win32utils
|
71
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.3.4
|
72
94
|
signing_key:
|
73
|
-
specification_version:
|
74
|
-
summary: An
|
95
|
+
specification_version: 3
|
96
|
+
summary: An interface for MS Windows services
|
75
97
|
test_files:
|
76
|
-
- test/
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/
|
80
|
-
- test/
|
98
|
+
- test/test_win32_daemon.rb
|
99
|
+
- test/test_win32_service.rb
|
100
|
+
- test/test_win32_service_configure.rb
|
101
|
+
- test/test_win32_service_create.rb
|
102
|
+
- test/test_win32_service_info.rb
|
103
|
+
- 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
|