merb-builder 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 YOUR NAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,4 @@
1
+ merb-builder
2
+ =========
3
+
4
+ A plugin for the Merb framework that provides ...
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+
4
+ PLUGIN = "merb-builder"
5
+ NAME = "merb-builder"
6
+ VERSION = "0.9.2"
7
+ AUTHOR = "Jonathan Younger"
8
+ EMAIL = "jonathan@daikini.com"
9
+ HOMEPAGE = "http://merb-plugins.rubyforge.org/merb-builder/"
10
+ SUMMARY = "Merb plugin that provides Builder support"
11
+
12
+ spec = Gem::Specification.new do |s|
13
+ s.name = NAME
14
+ s.version = VERSION
15
+ s.platform = Gem::Platform::RUBY
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
18
+ s.summary = SUMMARY
19
+ s.description = s.summary
20
+ s.author = AUTHOR
21
+ s.email = EMAIL
22
+ s.homepage = HOMEPAGE
23
+ s.add_dependency('merb-core', '>= 0.9.2')
24
+ s.require_path = 'lib'
25
+ s.autorequire = PLUGIN
26
+ s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
27
+ end
28
+
29
+ Rake::GemPackageTask.new(spec) do |pkg|
30
+ pkg.gem_spec = spec
31
+ end
32
+
33
+ task :install => [:package] do
34
+ sh %{sudo gem install pkg/#{NAME}-#{VERSION} --no-update-sources}
35
+ end
36
+
37
+ namespace :jruby do
38
+
39
+ desc "Run :package and install the resulting .gem with jruby"
40
+ task :install => :package do
41
+ sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
42
+ end
43
+
44
+ end
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ TODO:
2
+ Fix LICENSE with your name
3
+ Fix Rakefile with your name and contact info
4
+ Add your code to lib/merb-builder.rb
5
+ Add your Merb rake tasks to lib/merb-builder/merbtasks.rb
@@ -0,0 +1,2 @@
1
+ require "builder"
2
+ require "merb-builder/template"
@@ -0,0 +1,34 @@
1
+ module Merb::Template
2
+
3
+ class Builder
4
+
5
+ # Defines a method for calling a specific Builder template.
6
+ #
7
+ # ==== Parameters
8
+ # path<String>:: Path to the template file.
9
+ # name<~to_s>:: The name of the template method.
10
+ # mod<Class, Module>::
11
+ # The class or module wherein this method should be defined.
12
+ def self.compile_template(path, name, mod)
13
+ path = File.expand_path(path)
14
+ method = mod.is_a?(Module) ? :module_eval : :instance_eval
15
+ mod.send(method, %{
16
+ def #{name}
17
+ @_engine = 'builder'
18
+ config = (Merb.config[:builder] || {}).inject({}) do |c, (k, v)|
19
+ c[k.to_sym] = v
20
+ c
21
+ end
22
+ xml = ::Builder::XmlMarkup.new(config)
23
+ self.instance_eval %{#{File.read(path)}}
24
+ xml.target!
25
+ end
26
+ })
27
+
28
+ name
29
+ end
30
+
31
+ module Mixin; end
32
+ Merb::Template.register_extensions(self, %w[builder])
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: merb-builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.2
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Younger
8
+ autorequire: merb-builder
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-24 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: merb-core
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.9.2
23
+ version:
24
+ description: Merb plugin that provides Builder support
25
+ email: jonathan@daikini.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README
32
+ - LICENSE
33
+ - TODO
34
+ files:
35
+ - LICENSE
36
+ - README
37
+ - Rakefile
38
+ - TODO
39
+ - lib/merb-builder
40
+ - lib/merb-builder/template.rb
41
+ - lib/merb-builder.rb
42
+ has_rdoc: true
43
+ homepage: http://merb-plugins.rubyforge.org/merb-builder/
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.0.1
65
+ signing_key:
66
+ specification_version: 2
67
+ summary: Merb plugin that provides Builder support
68
+ test_files: []
69
+