rails-ess 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +127 -0
- data/Rakefile +5 -0
- data/lib/rails-ess/ess_feed_helper.rb +25 -0
- data/lib/rails-ess/version.rb +5 -0
- data/lib/rails-ess.rb +6 -0
- data/rails-ess.gemspec +22 -0
- metadata +89 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hypecal
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
rails-ess
|
2
|
+
========
|
3
|
+
|
4
|
+
#### https://github.com/essfeed/rails-ess
|
5
|
+
|
6
|
+
[![ESS Feed Standard](http://essfeed.org/images/8/87/ESS_logo_32x32.png)](http://essfeed.org/)
|
7
|
+
|
8
|
+
Generate ESS XML feeds with Ruby-on-Rails
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'rails-ess', '~> 0.9.1'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install rails-ess -v "0.9.0"
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
This little gem extends Rails so that it becomes easy to create ESS feeds
|
27
|
+
in your web application.
|
28
|
+
|
29
|
+
It adds the 'application/ess+xml' MIME type, which means that to add
|
30
|
+
an auto discovery link tag for an ESS feed, it's enough to add the
|
31
|
+
following to the head section of a web page:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
|
35
|
+
auto_discovery_link_tag(:ess, {:controller => "events", :action => "feed"})
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
And also, in a controller to respond with an ESS document:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
|
43
|
+
def feed
|
44
|
+
@events = Event.all(:limit => 20)
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
format.html
|
48
|
+
format.ess { render :layout => false } #feed.ess.builder
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
```
|
53
|
+
|
54
|
+
This gem also adds a helper method which can be used in builder
|
55
|
+
templates:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
|
59
|
+
ess_feed(:push => true, :request => request) do |ess|
|
60
|
+
ess.channel do |channel|
|
61
|
+
channel.title "National Stadium Football events"
|
62
|
+
channel.link "http://sample.com/feeds/sample.ess"
|
63
|
+
|
64
|
+
...
|
65
|
+
|
66
|
+
@events.each do |event|
|
67
|
+
channel.add_feed do |feed|
|
68
|
+
feed.title event.title
|
69
|
+
feed.uri event.link
|
70
|
+
feed.description event.description
|
71
|
+
|
72
|
+
feed.tags do |tags|
|
73
|
+
tags.tag "Sport"
|
74
|
+
tags.tag "Team Sport"
|
75
|
+
tags.tag "Stadium"
|
76
|
+
end
|
77
|
+
|
78
|
+
...
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
More information on building a feed in Ruby can be found in the README
|
88
|
+
of the 'ess' gem: https://github.com/essfeed/ruby-ess .
|
89
|
+
|
90
|
+
More information on ESS and what tags and options are available can
|
91
|
+
be found on http://essfeed.org/ .
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
Contributions to the project are welcome. Feel free to fork and improve. I accept pull requests and issues,
|
96
|
+
especially when tests are included.
|
97
|
+
|
98
|
+
1. Fork it
|
99
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
100
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
101
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
102
|
+
5. Create new Pull Request
|
103
|
+
|
104
|
+
# License
|
105
|
+
|
106
|
+
(The MIT License)
|
107
|
+
|
108
|
+
Copyright (c) 2013 Hypecal
|
109
|
+
|
110
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
111
|
+
a copy of this software and associated documentation files (the
|
112
|
+
'Software'), to deal in the Software without restriction, including
|
113
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
114
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
115
|
+
permit persons to whom the Software is furnished to do so, subject to
|
116
|
+
the following conditions:
|
117
|
+
|
118
|
+
The above copyright notice and this permission notice shall be
|
119
|
+
included in all copies or substantial portions of the Software.
|
120
|
+
|
121
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
122
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
123
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
124
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
125
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
126
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
127
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
require 'ess'
|
3
|
+
|
4
|
+
module ActionView
|
5
|
+
module Helpers
|
6
|
+
module ESSFeedHelper
|
7
|
+
def ess_feed(options = {}, &block)
|
8
|
+
xml = eval("xml", block.binding)
|
9
|
+
maker_options = options.clone
|
10
|
+
maker_options[:push => "false"]
|
11
|
+
maker_options[:aggregators => nil]
|
12
|
+
ess = ESS::Maker.make(maker_options, &block)
|
13
|
+
output = ess.to_xml!
|
14
|
+
if options[:aggregators] || options[:push]
|
15
|
+
ESS::Pusher.push_to_aggregators(options.merge(:data => output))
|
16
|
+
end
|
17
|
+
xml << output
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
autoload :ESSFeedHelper
|
22
|
+
include ESSFeedHelper
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/rails-ess.rb
ADDED
data/rails-ess.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails-ess/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rails-ess"
|
8
|
+
gem.version = ESS::Rails::VERSION
|
9
|
+
gem.authors = ["Marjan Povolni","Brice Pissard"]
|
10
|
+
gem.email = ["marian.povolny@gmail.com"]
|
11
|
+
gem.description = %q{This gem extends Rails with the support for ESS feed generation using Builder like sintax.}
|
12
|
+
gem.summary = %q{Rails extensions for ESS XML Feeds}
|
13
|
+
gem.homepage = "https://github.com/essfeed/rails-ess"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_runtime_dependency "ess", "0.9.1"
|
21
|
+
gem.add_runtime_dependency "rails"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-ess
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marjan Povolni
|
9
|
+
- Brice Pissard
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ess
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - '='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - '='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.9.1
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rails
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: This gem extends Rails with the support for ESS feed generation using
|
48
|
+
Builder like sintax.
|
49
|
+
email:
|
50
|
+
- marian.povolny@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .rspec
|
57
|
+
- Gemfile
|
58
|
+
- LICENSE.txt
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- lib/rails-ess.rb
|
62
|
+
- lib/rails-ess/ess_feed_helper.rb
|
63
|
+
- lib/rails-ess/version.rb
|
64
|
+
- rails-ess.gemspec
|
65
|
+
homepage: https://github.com/essfeed/rails-ess
|
66
|
+
licenses: []
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.8.24
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Rails extensions for ESS XML Feeds
|
89
|
+
test_files: []
|