win32_service_manager 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,44 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'yaml'
2
3
 
3
4
  require File.expand_path(
4
5
  File.join(File.dirname(__FILE__), '..', 'lib', 'win32_service_manager'))
5
6
 
6
- # Put your code here
7
+ def help
8
+ abort <<-EOHELP
9
+ Usage: #{File.basename($0)}
10
+ Commands:
11
+ - create
12
+ - start
13
+ - stop
14
+ - delete
15
+ - status
16
+ - list
17
+
18
+ Create takes 3 arguments, name, command and description.
19
+ All other commands take a single argument, the name of the service.
20
+ The list command takes no further arguments
21
+ EOHELP
22
+ end
23
+
24
+ y case ARGV.shift
25
+ when /create/
26
+ unless ARGV.size >= 2
27
+ puts "Need more for create: name, command, and optional description"
28
+ help
29
+ end
30
+ args = [ARGV.shift, ARGV.shift, ARGV.shift].compact.map { |a| a.dup }
31
+ Win32ServiceManager.new.create(*args)
32
+ when /start/
33
+ Win32ServiceManager.new.start(ARGV.shift)
34
+ when /stop/
35
+ Win32ServiceManager.new.stop(ARGV.shift)
36
+ when /delete/
37
+ Win32ServiceManager.new.delete(ARGV.shift)
38
+ when /status/
39
+ Win32ServiceManager.new.status(ARGV.shift)
40
+ when /list/
41
+ Win32ServiceManager.new.list
42
+ else
43
+ help
44
+ end
@@ -2,7 +2,7 @@ require 'win32_service_manager/core_ext/struct_to_hash'
2
2
 
3
3
  class Win32ServiceManager
4
4
 
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  def self.version; VERSION; end
7
7
  def self.load_dependencies; require 'win32/service'; end
8
8
 
@@ -17,7 +17,7 @@ class Win32ServiceManager
17
17
  # and inserted into the registry using Win32::Service.
18
18
  # One recommended pattern is to store persisence details about the service
19
19
  # as yaml in the optional description field.
20
- def create(name, command, args = '', description = nil, options = {})
20
+ def create(name, command, description = nil, options = {})
21
21
  defaults = {
22
22
  :service_type => Win32::Service::WIN32_OWN_PROCESS,
23
23
  :start_type => Win32::Service::AUTO_START,
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Tucker