CFPropertyList-rails 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "CFPropertyList-rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "CFPropertyList-rails"
7
+ s.version = CFPropertyList::Rails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Matthias Schmidt"]
10
+ s.email = ["mail@m-schmidt.eu"]
11
+ s.homepage = "https://github.com/MSchmidt/CFPropertyList-rails"
12
+ s.summary = %q{CFPropertyList for rails3}
13
+ s.description = %q{Binary Plist (CFPropertyList) renderer for rails3 apps.}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_runtime_dependency(%q<CFPropertyList>, ["= 2.0.16"])
21
+ s.add_runtime_dependency(%q<railties>, ["~> 3.0"])
22
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in CFPropertyList-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2011 Matthias Schmidt
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ CFPropertyList-rails
2
+ ====================
3
+
4
+ Render CFPropertyLists in Rails3 apps. Plists are generated in binary format.
5
+
6
+ Binary Plists are small in size and therefore ideal for usage with mobile iOS clients, such as iPhone and iPad.
7
+
8
+
9
+ Usage
10
+ -----
11
+
12
+ In your Gemfile:
13
+
14
+ ``` ruby
15
+ gem 'CFPropertyList-rails'
16
+ ```
17
+
18
+ In a controller, use something like this:
19
+
20
+ ``` ruby
21
+ respond_to do |format|
22
+ format.html
23
+ format.plist { render :plist => posts }
24
+ end
25
+ ```
26
+
27
+ You can use all the options you would use with the json renderer, e.g.:
28
+
29
+ ``` ruby
30
+ respond_to do |format|
31
+ format.plist { render :plist => posts, :include => :comments }
32
+ end
33
+ ```
34
+
35
+
36
+ License
37
+ -------
38
+
39
+ Copyright (c) 2011 Matthias Schmidt, [http://m-schmidt.eu/](http://m-schmidt.eu/)
40
+
41
+ CFPropertyList-rails is released under the MIT License
42
+
43
+
44
+ Credits
45
+ -------
46
+
47
+ Written by [Matthias Schmidt](http://www.m-schmidt.eu/)
48
+
49
+ Thanks to [Christian Kruse](https://github.com/ckruse) for
50
+ the [CFPropertyList ruby implementation](https://github.com/ckruse/CFPropertyList)!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,8 @@
1
+ require 'CFPropertyList-rails/plist'
2
+ require 'CFPropertyList-rails/railtie'
3
+
4
+ module CFPropertyList
5
+ module Rails
6
+ MIME_TYPE = 'application/octet-stream'
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ require 'cfpropertylist'
2
+
3
+ # Monkey Patching support for Date and DateTime objects in CFPropertyList
4
+ # TODO: Remove as soon as pull request 10 is accepted:
5
+ # https://github.com/ckruse/CFPropertyList/pull/10
6
+ module CFPropertyList
7
+ class CFDate < CFType
8
+ def initialize(value = nil,format=CFDate::TIMESTAMP_UNIX)
9
+ if(value.is_a?(Time) || value.nil?) then
10
+ @value = value.nil? ? Time.now : value
11
+ elsif value.instance_of? Date
12
+ @value = Time.utc(value.year, value.month, value.day, 0, 0, 0)
13
+ elsif value.instance_of? DateTime
14
+ @value = value.to_time.utc
15
+ else
16
+ set_value(value,format)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ module CFPropertyList
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie
4
+ initializer 'cfpropertylist-rails.initialize' do
5
+ Mime::Type.register CFPropertyList::Rails::MIME_TYPE, :plist
6
+
7
+ ActionController::Renderers.add :plist do |data, options|
8
+ data = data.as_json(options)
9
+
10
+ self.content_type ||= Mime::PLIST
11
+ self.response_body = data.to_plist(:convert_unknown_to_string => true)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module CFPropertyList
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: CFPropertyList-rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Matthias Schmidt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-13 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: CFPropertyList
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.16
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: railties
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: "3.0"
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ description: Binary Plist (CFPropertyList) renderer for rails3 apps.
38
+ email:
39
+ - mail@m-schmidt.eu
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - CFPropertyList-rails.gemspec
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - lib/CFPropertyList-rails.rb
54
+ - lib/CFPropertyList-rails/plist.rb
55
+ - lib/CFPropertyList-rails/railtie.rb
56
+ - lib/CFPropertyList-rails/version.rb
57
+ homepage: https://github.com/MSchmidt/CFPropertyList-rails
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.7.2
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: CFPropertyList for rails3
84
+ test_files: []
85
+
86
+ has_rdoc: