plist4r 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.gitignore +4 -0
  2. data/.yardopts +11 -0
  3. data/LICENSE +3 -1
  4. data/README.rdoc +25 -122
  5. data/Rakefile +14 -0
  6. data/VERSION +1 -1
  7. data/bin/plist4r +2 -0
  8. data/ext/osx_plist/Makefile +157 -0
  9. data/ext/osx_plist/extconf.rb +9 -0
  10. data/ext/osx_plist/plist.c +606 -0
  11. data/ext/osx_plist/plist.o +0 -0
  12. data/lib/plist4r.rb +6 -3
  13. data/lib/plist4r/application.rb +1 -2
  14. data/lib/plist4r/backend.rb +102 -34
  15. data/lib/plist4r/backend/c_f_property_list.rb +65 -0
  16. data/lib/plist4r/backend/c_f_property_list/LICENSE +19 -0
  17. data/lib/plist4r/backend/c_f_property_list/README +34 -0
  18. data/lib/plist4r/backend/c_f_property_list/cfpropertylist.rb +6 -0
  19. data/lib/plist4r/backend/c_f_property_list/rbBinaryCFPropertyList.rb +663 -0
  20. data/lib/plist4r/backend/c_f_property_list/rbCFPlistError.rb +26 -0
  21. data/lib/plist4r/backend/c_f_property_list/rbCFPropertyList.rb +348 -0
  22. data/lib/plist4r/backend/c_f_property_list/rbCFTypes.rb +241 -0
  23. data/lib/plist4r/backend/c_f_property_list/rbXMLCFPropertyList.rb +116 -0
  24. data/lib/plist4r/backend/example.rb +37 -52
  25. data/lib/plist4r/backend/haml.rb +47 -36
  26. data/lib/plist4r/backend/libxml4r.rb +24 -20
  27. data/lib/plist4r/backend/osx_plist.rb +82 -0
  28. data/lib/plist4r/backend/ruby_cocoa.rb +172 -54
  29. data/lib/plist4r/backend/test/data_types.rb +163 -0
  30. data/lib/plist4r/backend/test/harness.rb +255 -0
  31. data/lib/plist4r/backend/test/output.rb +47 -0
  32. data/lib/plist4r/backend_base.rb +4 -2
  33. data/lib/plist4r/{options.rb → cli.rb} +2 -1
  34. data/lib/plist4r/commands.rb +13 -8
  35. data/lib/plist4r/config.rb +36 -9
  36. data/lib/plist4r/docs/Backends.html +59 -0
  37. data/lib/plist4r/docs/DeveloperGuide.rdoc +53 -0
  38. data/lib/plist4r/docs/EditingPlistFiles.rdoc +88 -0
  39. data/lib/plist4r/docs/InfoPlistExample.rdoc +33 -0
  40. data/lib/plist4r/docs/LaunchdPlistExample.rdoc +33 -0
  41. data/lib/plist4r/docs/PlistKeyNames.rdoc +47 -0
  42. data/lib/plist4r/mixin/array_dict.rb +61 -0
  43. data/lib/plist4r/mixin/data_methods.rb +178 -54
  44. data/lib/plist4r/mixin/haml4r.rb +4 -0
  45. data/lib/plist4r/mixin/haml4r/css_attributes.rb +19 -0
  46. data/lib/plist4r/mixin/haml4r/examples.rb +261 -0
  47. data/lib/plist4r/mixin/haml4r/haml_table_example.rb +79 -0
  48. data/lib/plist4r/mixin/haml4r/table.rb +157 -0
  49. data/lib/plist4r/mixin/haml4r/table_cell.rb +160 -0
  50. data/lib/plist4r/mixin/haml4r/table_cells.rb +485 -0
  51. data/lib/plist4r/mixin/haml4r/table_section.rb +101 -0
  52. data/lib/plist4r/mixin/ordered_hash.rb +9 -1
  53. data/lib/plist4r/mixin/popen4.rb +1 -1
  54. data/lib/plist4r/mixin/ruby_stdlib.rb +154 -1
  55. data/lib/plist4r/mixin/script.rb +133 -0
  56. data/lib/plist4r/mixin/table.rb +435 -0
  57. data/lib/plist4r/plist.rb +272 -94
  58. data/lib/plist4r/plist_cache.rb +42 -43
  59. data/lib/plist4r/plist_type.rb +31 -74
  60. data/lib/plist4r/plist_type/info.rb +157 -3
  61. data/lib/plist4r/plist_type/launchd.rb +54 -48
  62. data/lib/plist4r/plist_type/plist.rb +1 -3
  63. data/plist4r.gemspec +74 -14
  64. data/spec/{examples.rb → launchd_examples.rb} +131 -139
  65. data/spec/plist4r/application_spec.rb +37 -0
  66. data/spec/plist4r/backend_spec.rb +256 -0
  67. data/spec/plist4r/cli_spec.rb +25 -0
  68. data/spec/plist4r/commands_spec.rb +20 -0
  69. data/spec/plist4r/config_spec.rb +38 -0
  70. data/spec/plist4r/mixin/array_dict_spec.rb +120 -0
  71. data/spec/plist4r/mixin/data_methods_spec.rb +96 -0
  72. data/spec/plist4r/mixin/haml4r/examples.rb +261 -0
  73. data/spec/plist4r/mixin/ruby_stdlib_spec.rb +228 -0
  74. data/spec/plist4r/plist_cache_spec.rb +261 -0
  75. data/spec/plist4r/plist_spec.rb +841 -23
  76. data/spec/plist4r/plist_type_spec.rb +126 -0
  77. data/spec/plist4r_spec.rb +53 -27
  78. data/spec/scratchpad.rb +226 -0
  79. data/spec/spec_helper.rb +5 -1
  80. metadata +109 -23
  81. data/lib/plist4r/backend/plutil.rb +0 -25
  82. data/lib/plist4r/mixin.rb +0 -7
  83. data/plists/array_mini.xml +0 -14
  84. data/plists/example_big_binary.plist +0 -0
  85. data/plists/example_medium_binary_launchd.plist +0 -0
  86. data/plists/example_medium_launchd.xml +0 -53
  87. data/plists/mini.xml +0 -12
  88. data/test.rb +0 -40
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'rubygems'
5
+
3
6
  require 'plist4r'
4
7
  require 'spec'
5
8
  require 'spec/autorun'
6
9
 
7
10
  Spec::Runner.configure do |config|
8
-
9
11
  end
12
+
13
+
metadata CHANGED
@@ -3,10 +3,10 @@ name: plist4r
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
+ - 1
6
7
  - 0
7
- - 2
8
- - 2
9
- version: 0.2.2
8
+ - 0
9
+ version: 1.0.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - dreamcat4
@@ -14,13 +14,49 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-18 00:00:00 +01:00
17
+ date: 2010-07-20 00:00:00 +01:00
18
18
  default_executable: plist4r
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: rspec
21
+ name: libxml-ruby
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: haml
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: libxml4r
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ prerelease: false
59
+ requirement: &id004 !ruby/object:Gem::Requirement
24
60
  requirements:
25
61
  - - ">="
26
62
  - !ruby/object:Gem::Version
@@ -30,11 +66,11 @@ dependencies:
30
66
  - 9
31
67
  version: 1.2.9
32
68
  type: :development
33
- version_requirements: *id001
69
+ version_requirements: *id004
34
70
  - !ruby/object:Gem::Dependency
35
71
  name: yard
36
72
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
73
+ requirement: &id005 !ruby/object:Gem::Requirement
38
74
  requirements:
39
75
  - - ">="
40
76
  - !ruby/object:Gem::Version
@@ -42,11 +78,11 @@ dependencies:
42
78
  - 0
43
79
  version: "0"
44
80
  type: :development
45
- version_requirements: *id002
81
+ version_requirements: *id005
46
82
  - !ruby/object:Gem::Dependency
47
83
  name: cucumber
48
84
  prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
85
+ requirement: &id006 !ruby/object:Gem::Requirement
50
86
  requirements:
51
87
  - - ">="
52
88
  - !ruby/object:Gem::Version
@@ -54,13 +90,13 @@ dependencies:
54
90
  - 0
55
91
  version: "0"
56
92
  type: :development
57
- version_requirements: *id003
93
+ version_requirements: *id006
58
94
  description: "In development. Plist4R is a gem which is striving for 3 things: ease of use, speed, and reliability handling of plists. To help achieve these goals, we may plug-in or re-write this gem with one or several backends. Notably, we try to distinguish this gem by providing easy-to use DSL interface for users. For common plist type(s), such as convenience methods for Launchd Plist"
59
95
  email: dreamcat4@gmail.com
60
96
  executables:
61
97
  - plist4r
62
- extensions: []
63
-
98
+ extensions:
99
+ - ext/osx_plist/extconf.rb
64
100
  extra_rdoc_files:
65
101
  - LICENSE
66
102
  - README.rdoc
@@ -74,28 +110,60 @@ files:
74
110
  - Rakefile
75
111
  - VERSION
76
112
  - bin/plist4r
113
+ - ext/osx_plist/Makefile
114
+ - ext/osx_plist/extconf.rb
115
+ - ext/osx_plist/plist.c
116
+ - ext/osx_plist/plist.o
77
117
  - features/plist4r.feature
78
118
  - features/step_definitions/plist4r_steps.rb
79
119
  - features/support/env.rb
80
120
  - lib/plist4r.rb
81
121
  - lib/plist4r/application.rb
82
122
  - lib/plist4r/backend.rb
123
+ - lib/plist4r/backend/c_f_property_list.rb
124
+ - lib/plist4r/backend/c_f_property_list/LICENSE
125
+ - lib/plist4r/backend/c_f_property_list/README
126
+ - lib/plist4r/backend/c_f_property_list/cfpropertylist.rb
127
+ - lib/plist4r/backend/c_f_property_list/rbBinaryCFPropertyList.rb
128
+ - lib/plist4r/backend/c_f_property_list/rbCFPlistError.rb
129
+ - lib/plist4r/backend/c_f_property_list/rbCFPropertyList.rb
130
+ - lib/plist4r/backend/c_f_property_list/rbCFTypes.rb
131
+ - lib/plist4r/backend/c_f_property_list/rbXMLCFPropertyList.rb
83
132
  - lib/plist4r/backend/example.rb
84
133
  - lib/plist4r/backend/haml.rb
85
134
  - lib/plist4r/backend/libxml4r.rb
86
- - lib/plist4r/backend/plutil.rb
135
+ - lib/plist4r/backend/osx_plist.rb
87
136
  - lib/plist4r/backend/ruby_cocoa.rb
137
+ - lib/plist4r/backend/test/data_types.rb
138
+ - lib/plist4r/backend/test/harness.rb
139
+ - lib/plist4r/backend/test/output.rb
88
140
  - lib/plist4r/backend_base.rb
141
+ - lib/plist4r/cli.rb
89
142
  - lib/plist4r/commands.rb
90
143
  - lib/plist4r/config.rb
91
- - lib/plist4r/mixin.rb
144
+ - lib/plist4r/docs/Backends.html
145
+ - lib/plist4r/docs/DeveloperGuide.rdoc
146
+ - lib/plist4r/docs/EditingPlistFiles.rdoc
147
+ - lib/plist4r/docs/InfoPlistExample.rdoc
148
+ - lib/plist4r/docs/LaunchdPlistExample.rdoc
149
+ - lib/plist4r/docs/PlistKeyNames.rdoc
150
+ - lib/plist4r/mixin/array_dict.rb
92
151
  - lib/plist4r/mixin/data_methods.rb
152
+ - lib/plist4r/mixin/haml4r.rb
153
+ - lib/plist4r/mixin/haml4r/css_attributes.rb
154
+ - lib/plist4r/mixin/haml4r/examples.rb
155
+ - lib/plist4r/mixin/haml4r/haml_table_example.rb
156
+ - lib/plist4r/mixin/haml4r/table.rb
157
+ - lib/plist4r/mixin/haml4r/table_cell.rb
158
+ - lib/plist4r/mixin/haml4r/table_cells.rb
159
+ - lib/plist4r/mixin/haml4r/table_section.rb
93
160
  - lib/plist4r/mixin/mixlib_cli.rb
94
161
  - lib/plist4r/mixin/mixlib_config.rb
95
162
  - lib/plist4r/mixin/ordered_hash.rb
96
163
  - lib/plist4r/mixin/popen4.rb
97
164
  - lib/plist4r/mixin/ruby_stdlib.rb
98
- - lib/plist4r/options.rb
165
+ - lib/plist4r/mixin/script.rb
166
+ - lib/plist4r/mixin/table.rb
99
167
  - lib/plist4r/plist.rb
100
168
  - lib/plist4r/plist_cache.rb
101
169
  - lib/plist4r/plist_type.rb
@@ -103,17 +171,23 @@ files:
103
171
  - lib/plist4r/plist_type/launchd.rb
104
172
  - lib/plist4r/plist_type/plist.rb
105
173
  - plist4r.gemspec
106
- - plists/array_mini.xml
107
- - plists/example_big_binary.plist
108
- - plists/example_medium_binary_launchd.plist
109
- - plists/example_medium_launchd.xml
110
- - plists/mini.xml
111
- - spec/examples.rb
174
+ - spec/launchd_examples.rb
175
+ - spec/plist4r/application_spec.rb
176
+ - spec/plist4r/backend_spec.rb
177
+ - spec/plist4r/cli_spec.rb
178
+ - spec/plist4r/commands_spec.rb
179
+ - spec/plist4r/config_spec.rb
180
+ - spec/plist4r/mixin/array_dict_spec.rb
181
+ - spec/plist4r/mixin/data_methods_spec.rb
182
+ - spec/plist4r/mixin/haml4r/examples.rb
183
+ - spec/plist4r/mixin/ruby_stdlib_spec.rb
184
+ - spec/plist4r/plist_cache_spec.rb
112
185
  - spec/plist4r/plist_spec.rb
186
+ - spec/plist4r/plist_type_spec.rb
113
187
  - spec/plist4r_spec.rb
188
+ - spec/scratchpad.rb
114
189
  - spec/spec.opts
115
190
  - spec/spec_helper.rb
116
- - test.rb
117
191
  has_rdoc: true
118
192
  homepage: http://github.com/dreamcat4/plist4r
119
193
  licenses: []
@@ -145,7 +219,19 @@ signing_key:
145
219
  specification_version: 3
146
220
  summary: Dreamcat4's plist4r gem. For reading/writing plists in ruby
147
221
  test_files:
148
- - spec/examples.rb
222
+ - spec/launchd_examples.rb
223
+ - spec/plist4r/application_spec.rb
224
+ - spec/plist4r/backend_spec.rb
225
+ - spec/plist4r/cli_spec.rb
226
+ - spec/plist4r/commands_spec.rb
227
+ - spec/plist4r/config_spec.rb
228
+ - spec/plist4r/mixin/array_dict_spec.rb
229
+ - spec/plist4r/mixin/data_methods_spec.rb
230
+ - spec/plist4r/mixin/haml4r/examples.rb
231
+ - spec/plist4r/mixin/ruby_stdlib_spec.rb
232
+ - spec/plist4r/plist_cache_spec.rb
149
233
  - spec/plist4r/plist_spec.rb
234
+ - spec/plist4r/plist_type_spec.rb
150
235
  - spec/plist4r_spec.rb
236
+ - spec/scratchpad.rb
151
237
  - spec/spec_helper.rb
@@ -1,25 +0,0 @@
1
-
2
- require 'plist4r/backend_base'
3
-
4
- # This backend does not implement any official Plist4r API methods.
5
- # But can be used to enhance and add functionality to other backends.
6
- #
7
- # (Mac OSX operating systems only)
8
- module Plist4r::Backend::Plutil
9
- class << self
10
- def convert_file_to_xml
11
- system "plutil -convert xml1 #{@filename}"
12
- end
13
-
14
- def convert_file_to_binary
15
- system "plutil -convert binary1 #{@filename}"
16
- end
17
-
18
- def validate
19
- system "plutil #{@filename}"
20
- end
21
- end
22
- end
23
-
24
-
25
-
data/lib/plist4r/mixin.rb DELETED
@@ -1,7 +0,0 @@
1
-
2
- require 'plist4r/mixin/object'
3
- require 'plist4r/mixin/string'
4
- require 'plist4r/mixin/ordered_hash'
5
- require 'plist4r/mixin/popen4'
6
- require 'plist4r/mixin/data_methods'
7
-
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <array>
5
- <dict>
6
- <key>WebIconDatabaseDirectoryDefaultsKey</key>
7
- <string>~/Library/Icons</string>
8
- <key>WebKitDefaultFontSize</key>
9
- <integer>11</integer>
10
- <key>WebKitStandardFont</key>
11
- <string>Lucida Grande</string>
12
- </dict>
13
- </array>
14
- </plist>
Binary file
@@ -1,53 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>EnableTransactions</key>
6
- <true/>
7
- <key>ExitTimeOut</key>
8
- <integer>60</integer>
9
- <key>KeepAlive</key>
10
- <dict>
11
- <key>PathState</key>
12
- <dict>
13
- <key>/private/var/spool/cups/cache/org.cups.cupsd</key>
14
- <true/>
15
- </dict>
16
- </dict>
17
- <key>Label</key>
18
- <string>org.cups.cupsd</string>
19
- <key>ProgramArguments</key>
20
- <array>
21
- <string>/usr/sbin/cupsd</string>
22
- <string>-l</string>
23
- </array>
24
- <key>SHAuthorizationRight</key>
25
- <string>system.preferences</string>
26
- <key>ServiceIPC</key>
27
- <true/>
28
- <key>Sockets</key>
29
- <dict>
30
- <key>Listeners</key>
31
- <array>
32
- <dict>
33
- <key>SockNodeName</key>
34
- <string>::1</string>
35
- <key>SockServiceName</key>
36
- <string>ipp</string>
37
- </dict>
38
- <dict>
39
- <key>SockNodeName</key>
40
- <string>127.0.0.1</string>
41
- <key>SockServiceName</key>
42
- <string>ipp</string>
43
- </dict>
44
- <dict>
45
- <key>SockPathMode</key>
46
- <integer>49663</integer>
47
- <key>SockPathName</key>
48
- <string>/private/var/run/cupsd</string>
49
- </dict>
50
- </array>
51
- </dict>
52
- </dict>
53
- </plist>
data/plists/mini.xml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>WebIconDatabaseDirectoryDefaultsKey</key>
6
- <string>~/Library/Icons</string>
7
- <key>WebKitDefaultFontSize</key>
8
- <integer>11</integer>
9
- <key>WebKitStandardFont</key>
10
- <string>Lucida Grande</string>
11
- </dict>
12
- </plist>
data/test.rb DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'lib/plist4r'
4
-
5
- # puts "Backends = #{::Plist4r::Config[:backends].inspect}"
6
- # Plist4r.new
7
-
8
- Plist4r::Config[:backends].replace ["haml","libxml4r"]
9
- p = Plist4r.open "plists/array_mini.xml"
10
-
11
- puts p.inspect
12
- # puts p.to_hash.inspect
13
- # puts p.to_xml
14
-
15
- # b = p.to_binary
16
- # puts b.inspect
17
-
18
-
19
- # p2 = b.to_plist
20
- # puts p2.inspect
21
- # puts p2.to_xml
22
-
23
- # puts p2.to_xml
24
- # puts "plist type is"
25
- # puts p2.plist_type.inspect
26
-
27
- # p2.strict_keys false
28
- # puts p2.strict_keys.inspect
29
- # p2.<< do
30
- # somekey "append"
31
- # end
32
-
33
- # puts p2.to_hash.inspect
34
- # puts p2.to_xml
35
-
36
-
37
-
38
-
39
-
40
-