win32_service_manager 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,21 +2,19 @@ require 'win32_service_manager/core_ext/struct_to_hash'
2
2
 
3
3
  class Win32ServiceManager
4
4
 
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  def self.version; VERSION; end
7
7
  def self.load_dependencies; require 'win32/service'; end
8
8
 
9
9
  # Construct a new service manager, just sets up a name_key, which is used
10
10
  # as a leading string to the name of all services managed by the instance.
11
- # srv_any_path must be a full path to srvany.exe.
12
11
  def initialize(name_key = '')
13
12
  self.class.load_dependencies
14
13
  @name_key = name_key
15
14
  end
16
15
 
17
16
  # Create a new service. The service name will be appended to the name_key
18
- # and inserted into the registry using Win32::Service. The arguments are
19
- # then adjusted with win32-registry.
17
+ # and inserted into the registry using Win32::Service.
20
18
  # One recommended pattern is to store persisence details about the service
21
19
  # as yaml in the optional description field.
22
20
  def create(name, command, args = '', description = nil, options = {})
@@ -40,21 +38,26 @@ class Win32ServiceManager
40
38
  Win32::Service.delete(n(name))
41
39
  end
42
40
 
41
+ # Schedule the service for start
43
42
  def start(name)
44
43
  Win32::Service.start(n(name))
45
44
  end
46
45
 
46
+ # Schedule the service for stop
47
47
  def stop(name)
48
48
  Win32::Service.stop(n(name))
49
49
  end
50
50
 
51
- # Returns an array of tuples of name and description
51
+ # Returns an array of hashes derived from the Win32::Service::SvcInfo struct
52
+ # The optional argument will cut the array down to a single element for a
53
+ # service with the given name.
52
54
  def status(name = nil)
53
55
  list = name ? services.select { |s| s.display_name == name } : services
54
56
  list.map { |svc_info| svc_info.to_hash }
55
57
  end
56
58
  alias_method :list, :status
57
59
 
60
+ # List all services that have names which start with the name_key.
58
61
  def services
59
62
  Win32::Service.services.select do |svc|
60
63
  # TODO in future, 1.8.7, can use start_with?
data/tasks/git.rake CHANGED
@@ -22,7 +22,7 @@ namespace :git do
22
22
 
23
23
  puts "Creating Git tag '#{tag}'"
24
24
  unless system "git tag -a -m '#{msg}' #{tag}"
25
- # abort "Tag creation failed"
25
+ abort "Tag creation failed"
26
26
  end
27
27
 
28
28
  if %x/git remote/ =~ %r/^origin\s*$/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32_service_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Tucker