svutil 0.0.12 → 0.0.13

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.
Files changed (3) hide show
  1. data/lib/svutil.rb +1 -1
  2. data/lib/svutil/config.rb +18 -1
  3. metadata +3 -3
@@ -6,5 +6,5 @@ require 'svutil/log'
6
6
  require 'svutil/process_manager'
7
7
 
8
8
  module SVUtil
9
- VERSION = '0.0.12'
9
+ VERSION = '0.0.13'
10
10
  end
@@ -23,10 +23,22 @@ module SVUtil
23
23
  def load_and_parse
24
24
  process_options
25
25
  load_config_file
26
+ set_defaults
26
27
  apply_all
27
28
  validate
28
29
  end
29
30
 
31
+ def set_defaults
32
+ # Overide this method in subclasses
33
+ end
34
+
35
+ def default(name, value)
36
+ @temp_hash ||= {}
37
+ if !@temp_hash.has_key?(name) || @temp_hash[name].nil?
38
+ set(name, value)
39
+ end
40
+ end
41
+
30
42
  def set(name, value)
31
43
  @temp_hash ||= {}
32
44
  @temp_hash[name.to_s] = value
@@ -44,7 +56,11 @@ module SVUtil
44
56
 
45
57
  def method_missing(method_id, *args)
46
58
  return nil unless @hash
47
- @hash[method_id.to_s]
59
+ if method_id.to_s =~ /=$/
60
+ @hash[method_id.to_s[0...-1]] = args.first
61
+ else
62
+ @hash[method_id.to_s]
63
+ end
48
64
  end
49
65
 
50
66
  def validate
@@ -53,6 +69,7 @@ module SVUtil
53
69
  STDERR.puts "PID file must be a writable file"
54
70
  exit 1
55
71
  end
72
+ true
56
73
  end
57
74
 
58
75
  def process_options
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 12
9
- version: 0.0.12
8
+ - 13
9
+ version: 0.0.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Draper
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-31 00:00:00 +10:30
17
+ date: 2011-02-03 00:00:00 +10:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency