capcode-render-markaby 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 ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 glejeune
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.
@@ -0,0 +1,3 @@
1
+ = capcode-render-markaby
2
+
3
+ Capcode plugin to render via Markaby
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "capcode-render-markaby"
8
+ gem.summary = %Q{Capcode plugin to render via Markaby}
9
+ gem.description = gem.summary
10
+ gem.email = "gregoire.lejeune@free.fr"
11
+ gem.homepage = "http://github.com/glejeune/Capcode.more/tree/master/%s" % gem.name
12
+ gem.authors = ["Gregoire Lejeune"]
13
+
14
+ gem.add_dependency('Markaby')
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,46 @@
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{capcode-render-markaby}
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 = ["Gregoire Lejeune"]
12
+ s.date = %q{2010-01-06}
13
+ s.description = %q{Capcode plugin to render via Markaby}
14
+ s.email = %q{gregoire.lejeune@free.fr}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "capcode-render-markaby.gemspec",
24
+ "examples/render-markaby.rb",
25
+ "lib/capcode/render/markaby.rb"
26
+ ]
27
+ s.homepage = %q{http://github.com/glejeune/Capcode.more/tree/master/capcode-render-markaby}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.5}
31
+ s.summary = %q{Capcode plugin to render via Markaby}
32
+
33
+ if s.respond_to? :specification_version then
34
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
35
+ s.specification_version = 3
36
+
37
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
+ s.add_runtime_dependency(%q<Markaby>, [">= 0"])
39
+ else
40
+ s.add_dependency(%q<Markaby>, [">= 0"])
41
+ end
42
+ else
43
+ s.add_dependency(%q<Markaby>, [">= 0"])
44
+ end
45
+ end
46
+
@@ -0,0 +1,32 @@
1
+ require 'rubygems'
2
+ require 'capcode'
3
+ $:.unshift( "../lib" )
4
+ require 'capcode/render/markaby'
5
+
6
+ module Capcode
7
+ set :markaby, { :indent => 2 }
8
+
9
+ class Index < Route '/'
10
+ def get
11
+ @time = Time.now()
12
+ render :markaby => :index, :layout => :glop
13
+ end
14
+ end
15
+ end
16
+
17
+ module Capcode::Views
18
+ def glop
19
+ html do
20
+ body do
21
+ yield
22
+ end
23
+ end
24
+ end
25
+
26
+ def index
27
+ h1 "Hello !"
28
+ p "il est #{@time}"
29
+ end
30
+ end
31
+
32
+ Capcode.run( )
@@ -0,0 +1,41 @@
1
+ begin
2
+ require 'markaby'
3
+ rescue LoadError => e
4
+ raise MissingLibrary, "Markaby could not be loaded (is it installed?): #{e.message}"
5
+ end
6
+
7
+ module Capcode
8
+ class Mab < Markaby::Builder
9
+ include Views
10
+ end
11
+
12
+ module Helpers
13
+ def render_markaby( f, opts = {} ) #:nodoc:
14
+ f = f.to_s
15
+ layout = opts.delete(:layout)||:layout
16
+
17
+ # Update options
18
+ (Capcode.options[:markaby] || {}).merge(opts).each do |k, v|
19
+ Markaby::Builder.set(k, v)
20
+ end
21
+
22
+ assigns = {}
23
+ self.instance_variables.delete_if {|x| ["@response", "@env", "@request"].include?(x) }.each do |ivar|
24
+ assigns[ivar.gsub( /^@/, "" )] = self.instance_variable_get(ivar)
25
+ end
26
+
27
+ __mab = Mab.new(assigns.merge( opts ), self) {
28
+ if self.respond_to?(layout)
29
+ self.send(layout.to_s) { |*args|
30
+ # @@__ARGS__ = args
31
+ Capcode::Helpers.args = args
32
+ self.send(f)
33
+ }
34
+ else
35
+ self.send(f)
36
+ end
37
+ }
38
+ __mab.to_s
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capcode-render-markaby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gregoire Lejeune
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-06 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: Markaby
17
+ type: :runtime
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: Capcode plugin to render via Markaby
26
+ email: gregoire.lejeune@free.fr
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ files:
34
+ - LICENSE
35
+ - README.rdoc
36
+ - Rakefile
37
+ - VERSION
38
+ - capcode-render-markaby.gemspec
39
+ - examples/render-markaby.rb
40
+ - lib/capcode/render/markaby.rb
41
+ has_rdoc: true
42
+ homepage: http://github.com/glejeune/Capcode.more/tree/master/capcode-render-markaby
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options:
47
+ - --charset=UTF-8
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ requirements: []
63
+
64
+ rubyforge_project:
65
+ rubygems_version: 1.3.5
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Capcode plugin to render via Markaby
69
+ test_files: []
70
+