sinatra-xslview 0.1.0
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/LICENSE +19 -0
- data/README +31 -0
- data/README.markdown +31 -0
- data/Rakefile +63 -0
- data/lib/sinatra/xslview.rb +25 -0
- data/sinatra-xslview.gemspec +48 -0
- metadata +71 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2009 Savonix Corporation
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Sinatra-XSLView
|
2
|
+
===============
|
3
|
+
|
4
|
+
## Summary: XSL Sinatra Helper
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
Simple helper function to render XML via an XSL stylesheet.
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
In the Sinatra application (on Debian):
|
14
|
+
|
15
|
+
<pre class="sh_ruby">
|
16
|
+
require 'xml/xslt'
|
17
|
+
require 'sinatra/xslview'
|
18
|
+
|
19
|
+
get '/entries' do
|
20
|
+
# Using DataMapper
|
21
|
+
@myentries = Entry.all
|
22
|
+
# Example of using xslview and how xslviews could be chained together
|
23
|
+
myxml = builder :'xml/entries'
|
24
|
+
stepone = xslview myxml, '/path/to/views/xsl/entries.xsl'
|
25
|
+
stepone
|
26
|
+
end
|
27
|
+
|
28
|
+
</pre>
|
29
|
+
|
30
|
+
|
31
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Sinatra-XSLView
|
2
|
+
===============
|
3
|
+
|
4
|
+
## Summary: XSL Sinatra Helper
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
Simple helper function to render XML via an XSL stylesheet.
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
In the Sinatra application (on Debian):
|
14
|
+
|
15
|
+
<pre class="sh_ruby">
|
16
|
+
require 'xml/xslt'
|
17
|
+
require 'sinatra/xslview'
|
18
|
+
|
19
|
+
get '/entries' do
|
20
|
+
# Using DataMapper
|
21
|
+
@myentries = Entry.all
|
22
|
+
# Example of using xslview and how xslviews could be chained together
|
23
|
+
myxml = builder :'xml/entries'
|
24
|
+
stepone = xslview myxml, '/path/to/views/xsl/entries.xsl'
|
25
|
+
stepone
|
26
|
+
end
|
27
|
+
|
28
|
+
</pre>
|
29
|
+
|
30
|
+
|
31
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "sinatra-xslview"
|
8
|
+
gem.summary = %Q{XSL Sinatra Helper}
|
9
|
+
gem.description = %Q{Simple helper function to render XML via an XSL stylesheet.}
|
10
|
+
gem.email = "albert.lash@docunext.com"
|
11
|
+
gem.homepage = "http://www.docunext.com/"
|
12
|
+
gem.authors = ["Albert Lash"]
|
13
|
+
gem.rubyforge_project = ""
|
14
|
+
gem.add_development_dependency "shoulda"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
19
|
+
rubyforge.doc_task = "rdoc"
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/*_test.rb'
|
39
|
+
test.verbose = true
|
40
|
+
end
|
41
|
+
rescue LoadError
|
42
|
+
task :rcov do
|
43
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
task :test => :check_dependencies
|
48
|
+
|
49
|
+
task :default => :test
|
50
|
+
|
51
|
+
require 'rake/rdoctask'
|
52
|
+
Rake::RDocTask.new do |rdoc|
|
53
|
+
if File.exist?('VERSION')
|
54
|
+
version = File.read('VERSION')
|
55
|
+
else
|
56
|
+
version = ""
|
57
|
+
end
|
58
|
+
|
59
|
+
rdoc.rdoc_dir = 'rdoc'
|
60
|
+
rdoc.title = "sinatra-xslview #{version}"
|
61
|
+
rdoc.rdoc_files.include('README*')
|
62
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
63
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
###
|
2
|
+
# Copyright: 2010 Savonix Corporation
|
3
|
+
# Author: Albert Lash
|
4
|
+
# License: MIT
|
5
|
+
##
|
6
|
+
require 'sinatra/base'
|
7
|
+
|
8
|
+
module Sinatra
|
9
|
+
###
|
10
|
+
# Renders output based upon XML and XSL
|
11
|
+
# In practice, I use Builder to create the XML to be transformed
|
12
|
+
# As such, I do not plan on adding support for parameters, like Rack-XSLView
|
13
|
+
# TODO: cache stylesheets
|
14
|
+
##
|
15
|
+
module XSLView
|
16
|
+
def xslview(myxml,myxsl)
|
17
|
+
xslt = XML::XSLT.new()
|
18
|
+
xslt.xml = myxml
|
19
|
+
xslt.xsl = options.xslviews + myxsl
|
20
|
+
xslt.serve
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
helpers XSLView
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sinatra-xslview}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Albert Lash"]
|
12
|
+
s.date = %q{2010-02-13}
|
13
|
+
s.description = %q{Simple helper function to render XML via an XSL stylesheet.}
|
14
|
+
s.email = %q{albert.lash@docunext.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README",
|
18
|
+
"README.markdown"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"lib/sinatra/xslview.rb",
|
26
|
+
"sinatra-xslview.gemspec"
|
27
|
+
]
|
28
|
+
s.homepage = %q{http://www.docunext.com/}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubyforge_project = %q{}
|
32
|
+
s.rubygems_version = %q{1.3.5}
|
33
|
+
s.summary = %q{XSL Sinatra Helper}
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
41
|
+
else
|
42
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
43
|
+
end
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra-xslview
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Albert Lash
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-13 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Simple helper function to render XML via an XSL stylesheet.
|
26
|
+
email: albert.lash@docunext.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README
|
34
|
+
- README.markdown
|
35
|
+
files:
|
36
|
+
- LICENSE
|
37
|
+
- README
|
38
|
+
- README.markdown
|
39
|
+
- Rakefile
|
40
|
+
- lib/sinatra/xslview.rb
|
41
|
+
- sinatra-xslview.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://www.docunext.com/
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project: ""
|
66
|
+
rubygems_version: 1.3.5
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: XSL Sinatra Helper
|
70
|
+
test_files: []
|
71
|
+
|