plist4r 1.1.5 → 1.1.6

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.5
1
+ 1.1.6
@@ -10,13 +10,14 @@ module Plist4r
10
10
  ClassesForKeyType =
11
11
  {
12
12
  :string => [String],
13
+ :string_or_integer => [String,Integer,Fixnum],
13
14
  :bool => [TrueClass,FalseClass],
14
15
  :bool_or_string => [TrueClass,FalseClass,String],
15
- :integer => [Fixnum],
16
+ :integer => [Integer,Fixnum],
16
17
  :array_of_strings => [Array],
17
18
  :array_of_hashes => [Array],
18
19
  :array => [Array],
19
- :array_or_integer => [Array,Fixnum],
20
+ :array_or_integer => [Array,Integer,Fixnum],
20
21
  :array_or_hash => [Array, Hash],
21
22
  :hash_of_bools => [Hash],
22
23
  :hash_of_strings => [Hash],
@@ -116,7 +117,7 @@ module Plist4r
116
117
  end
117
118
  end
118
119
 
119
- unless @plist.strict_keys
120
+ if (! @plist) || (@plist && @plist.strict_keys == false)
120
121
  key_type = nil
121
122
  return set_or_return_of_type key_type, key, value
122
123
  else
@@ -13,19 +13,20 @@ module Plist4r
13
13
  # @see Plist4r::DataMethods
14
14
  ValidKeys =
15
15
  {
16
- :string => %w[ Label UserName GroupName LimitLoadToSessionType Program RootDirectory \
16
+ :string => %w[ Label UserName GroupName LimitLoadToSessionType Program RootDirectory
17
17
  WorkingDirectory StandardInPath StandardOutPath StandardErrorPath ],
18
18
 
19
- :bool => %w[ Disabled EnableGlobbing EnableTransactions OnDemand RunAtLoad InitGroups \
20
- StartOnMount Debug WaitForDebugger AbandonProcessGroup HopefullyExitsFirst \
21
- HopefullyExitsLast LowPriorityIO LaunchOnlyOnce ],
19
+ :bool => %w[ Disabled EnableGlobbing EnableTransactions OnDemand RunAtLoad InitGroups
20
+ StartOnMount Debug WaitForDebugger AbandonProcessGroup HopefullyExitsFirst
21
+ HopefullyExitsLast LowPriorityIO LaunchOnlyOnce SessionCreate ServiceIPC
22
+ IgnoreProcessGroupAtShutdown ],
22
23
 
23
24
  :integer => %w[ Umask TimeOut ExitTimeOut ThrottleInterval StartInterval Nice ],
24
25
 
25
26
  :array_of_strings => %w[ LimitLoadToHosts LimitLoadFromHosts ProgramArguments WatchPaths QueueDirectories ],
26
27
 
27
- :method_defined => %w[ inetdCompatibility KeepAlive EnvironmentVariables StartCalendarInterval
28
- SoftResourceLimits, HardResourceLimits MachServices Socket ]
28
+ :method_defined => %w[ inetdCompatibility KeepAlive EnvironmentVariables UserEnvironmentVariables
29
+ StartCalendarInterval SoftResourceLimits, HardResourceLimits MachServices Socket ]
29
30
  }
30
31
 
31
32
 
@@ -69,8 +70,8 @@ module Plist4r
69
70
  class KeepAlive < ArrayDict
70
71
  ValidKeys =
71
72
  {
72
- :bool => %w[SuccessfulExit NetworkState],
73
- :bool_or_hash_of_bools => %w[PathState OtherJobEnabled]
73
+ :bool => %w[SuccessfulExit NetworkState AfterInitialDemand],
74
+ :bool_or_hash_of_bools => %w[PathState OtherJobEnabled OtherJobActive]
74
75
  }
75
76
  end
76
77
 
@@ -169,6 +170,39 @@ module Plist4r
169
170
  end
170
171
  end
171
172
 
173
+ # Set or return the plist key +UserEnvironmentVariables+
174
+ #
175
+ # @example
176
+ # # Set user environment variables
177
+ # launchd_plist.user_environment_variables({ "VAR1" => "VAL1", "VAR2" => "VAL2" })
178
+ #
179
+ # # Return user environment variables
180
+ # launchd_plist.user_environment_variables => { "VAR1" => "VAL1", "VAR2" => "VAL2" }
181
+ #
182
+ # @param [Hash <String>] value
183
+ # This optional key is used to specify additional user environmental variables to be set before running the job.
184
+ # UserEnvironmentVariables is not a documented feature of Apple Launchd. So it might not be supported.
185
+ # If in doubt, use "EnvironmentVariables".
186
+ def user_environment_variables value=nil, &blk
187
+ key = "UserEnvironmentVariables"
188
+ case value
189
+ when Hash
190
+ value.each do |k,v|
191
+ unless k.class == String
192
+ raise "Invalid key: #{method_name}[#{k.inspect}]. Should be of type String"
193
+ end
194
+ unless v.class == String
195
+ raise "Invalid value: #{method_name}[#{k.inspect}] = #{v.inspect}. Should be of type String"
196
+ end
197
+ end
198
+ @hash[key] = value
199
+ when nil
200
+ @hash[key]
201
+ else
202
+ raise "Invalid value: #{method_name} #{value.inspect}. Should be: #{method_name} { hash_of_strings }"
203
+ end
204
+ end
205
+
172
206
  class StartCalendarInterval < ArrayDict
173
207
  ValidKeys = { :integer => %w[ Minute Hour Day Weekday Month ] }
174
208
  end
@@ -378,7 +412,7 @@ module Plist4r
378
412
 
379
413
  class MachServices < ArrayDict
380
414
  class MachService < ArrayDict
381
- ValidKeys = { :bool => %w[ ResetAtClose HideUntilCheckIn ] }
415
+ ValidKeys = { :bool => %w[ ResetAtClose HideUntilCheckIn DrainMessagesOnCrash ] }
382
416
  end
383
417
 
384
418
  def add service, value=nil, &blk
@@ -447,9 +481,11 @@ module Plist4r
447
481
  class Socket < ArrayDict
448
482
  ValidKeys =
449
483
  {
450
- :string => %w[ SockType SockNodeName SockServiceName SockFamily SockProtocol \
484
+ :string => %w[ SockType SockNodeName SockFamily SockProtocol
451
485
  SockPathName SecureSocketWithKey MulticastGroup ],
452
486
 
487
+ :string_or_integer => %w[ SockServiceName ],
488
+
453
489
  :bool => %w[ SockPassive ],
454
490
 
455
491
  :integer => %w[ SockPathMode ],
data/plist4r.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{plist4r}
8
- s.version = "1.1.5"
8
+ s.version = "1.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["dreamcat4"]
12
- s.date = %q{2010-08-18}
12
+ s.date = %q{2010-09-14}
13
13
  s.default_executable = %q{plist4r}
14
14
  s.description = %q{Plist4r is for editing Plist files in an easy-to-use, fast, and reliabile way. A comprehensive and fully featured Ruby library. Xml and Binary file formats are supported, with backends for Linux and Mac.}
15
15
  s.email = %q{dreamcat4@gmail.com}
@@ -109,7 +109,7 @@ Gem::Specification.new do |s|
109
109
  s.homepage = %q{http://github.com/dreamcat4/plist4r}
110
110
  s.rdoc_options = ["--charset=UTF-8"]
111
111
  s.require_paths = ["lib"]
112
- s.rubygems_version = %q{1.3.6}
112
+ s.rubygems_version = %q{1.3.7}
113
113
  s.summary = %q{Dreamcat4's plist4r gem. For reading/writing plists in ruby}
114
114
  s.test_files = [
115
115
  "spec/launchd_examples.rb",
@@ -134,7 +134,7 @@ Gem::Specification.new do |s|
134
134
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
135
135
  s.specification_version = 3
136
136
 
137
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
137
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
138
138
  s.add_runtime_dependency(%q<libxml-ruby>, [">= 0"])
139
139
  s.add_runtime_dependency(%q<haml>, [">= 0"])
140
140
  s.add_runtime_dependency(%q<libxml4r>, [">= 0"])
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plist4r
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 5
9
- version: 1.1.5
9
+ - 6
10
+ version: 1.1.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - dreamcat4
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-18 00:00:00 +01:00
18
+ date: 2010-09-14 00:00:00 +01:00
18
19
  default_executable: plist4r
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: libxml-ruby
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: haml
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 3
39
44
  segments:
40
45
  - 0
41
46
  version: "0"
@@ -45,9 +50,11 @@ dependencies:
45
50
  name: libxml4r
46
51
  prerelease: false
47
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
48
54
  requirements:
49
55
  - - ">="
50
56
  - !ruby/object:Gem::Version
57
+ hash: 3
51
58
  segments:
52
59
  - 0
53
60
  version: "0"
@@ -57,9 +64,11 @@ dependencies:
57
64
  name: rspec
58
65
  prerelease: false
59
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
69
  - - ">="
62
70
  - !ruby/object:Gem::Version
71
+ hash: 13
63
72
  segments:
64
73
  - 1
65
74
  - 2
@@ -71,9 +80,11 @@ dependencies:
71
80
  name: yard
72
81
  prerelease: false
73
82
  requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
74
84
  requirements:
75
85
  - - ">="
76
86
  - !ruby/object:Gem::Version
87
+ hash: 3
77
88
  segments:
78
89
  - 0
79
90
  version: "0"
@@ -83,9 +94,11 @@ dependencies:
83
94
  name: cucumber
84
95
  prerelease: false
85
96
  requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ">="
88
100
  - !ruby/object:Gem::Version
101
+ hash: 3
89
102
  segments:
90
103
  - 0
91
104
  version: "0"
@@ -196,23 +209,27 @@ rdoc_options:
196
209
  require_paths:
197
210
  - lib
198
211
  required_ruby_version: !ruby/object:Gem::Requirement
212
+ none: false
199
213
  requirements:
200
214
  - - ">="
201
215
  - !ruby/object:Gem::Version
216
+ hash: 3
202
217
  segments:
203
218
  - 0
204
219
  version: "0"
205
220
  required_rubygems_version: !ruby/object:Gem::Requirement
221
+ none: false
206
222
  requirements:
207
223
  - - ">="
208
224
  - !ruby/object:Gem::Version
225
+ hash: 3
209
226
  segments:
210
227
  - 0
211
228
  version: "0"
212
229
  requirements: []
213
230
 
214
231
  rubyforge_project:
215
- rubygems_version: 1.3.6
232
+ rubygems_version: 1.3.7
216
233
  signing_key:
217
234
  specification_version: 3
218
235
  summary: Dreamcat4's plist4r gem. For reading/writing plists in ruby