From 0d82447a4a0f2c603e648ec5f640f848e6a02208 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Wed, 4 Jan 2012 09:44:02 +0100 Subject: rename examples into example --- examples/layout/css.haml | 5 -- examples/layout/default.haml | 5 -- examples/layout/other.haml | 4 -- examples/sample.ru | 154 ------------------------------------------ examples/view/url1/index.haml | 7 -- examples/view/url1/meth0.haml | 7 -- examples/view/url3/index.haml | 6 -- 7 files changed, 188 deletions(-) delete mode 100644 examples/layout/css.haml delete mode 100644 examples/layout/default.haml delete mode 100644 examples/layout/other.haml delete mode 100644 examples/sample.ru delete mode 100644 examples/view/url1/index.haml delete mode 100644 examples/view/url1/meth0.haml delete mode 100644 examples/view/url3/index.haml (limited to 'examples') diff --git a/examples/layout/css.haml b/examples/layout/css.haml deleted file mode 100644 index fbe0a47..0000000 --- a/examples/layout/css.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1=@title -%p="xx css layout xx" -%p="Css #{inherited_var(:css).inspect}" -%p=@content -%p="xx -- xx" diff --git a/examples/layout/default.haml b/examples/layout/default.haml deleted file mode 100644 index 8df684f..0000000 --- a/examples/layout/default.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1=@title -%p="xx default layout xx" -%p="count #{Zorglub::Node.count}" -%p=@content -%p="xx -- xx" diff --git a/examples/layout/other.haml b/examples/layout/other.haml deleted file mode 100644 index 601b305..0000000 --- a/examples/layout/other.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h1=@title -%p="xx other layout - xx" -%p=@content -%p="xx -- xx" diff --git a/examples/sample.ru b/examples/sample.ru deleted file mode 100644 index 32639b3..0000000 --- a/examples/sample.ru +++ /dev/null @@ -1,154 +0,0 @@ -#! /usr/bin/env ruby -# -$LOAD_PATH << File.join(File.dirname( File.absolute_path(__FILE__)), '..', 'lib') -# -require 'zorglub' -# -require 'haml' -HAML_PROC = Proc.new { |path,obj| Haml::Engine.new( File.open(path,'r').read ).render(obj) } -Zorglub::Config.register_engine 'haml', 'haml', HAML_PROC -Zorglub::Config.register_engine 'tmp-engine', 'haml', HAML_PROC -# -Zorglub::Config.engine = 'haml' -Zorglub::Config.session_on = true -Zorglub::Config.root = File.dirname( File.absolute_path(__FILE__) ) -# -class Zorglub::Node - @count=0 - class << self - attr_accessor :count - end - before_all do |node| - Zorglub::Node.count +=1 - end -end -# -class Node1 < Zorglub::Node - # - def index a1, *a2 - @title='Index' - @links = LINKS - # there's a view so the below will be lost ! - "should never be seeen" - end - # - def meth0 *args - @title='meth0' - @links = LINKS - # method level engine - engine 'tmp-engine' - # there's a view so the below will be lost ! - "should never be seeen" - end - # - def meth1 *args - @title='meth1' - @links = LINKS - # method level engine (layout/other.haml) - layout 'other' - # specific method view (view/url1/meth0.haml) - view File.join( 'url1','meth0') - # there's a view so the below will be lost ! - "should never be seeen" - end - # - def jump *args - redirect r(:index,1,2,3) - end - # -end -# -APP = Zorglub::App.new do - map '/url1', Node1 -end -# -class Node2 < Zorglub::Node - # - map APP, '/url2' - layout 'css' - # class level engine - engine 'tmp-engine' - # class level css - inherited_var :css, 'class_level.css' - # - def index *args - "Node2:indexSTART#{html}next
END" - end - # - def meth0 *args - # instance level css - inherited_var :css, 'instance_level.css' - "Node2:meth0START#{html}next
END" - end - # - def meth1 *args - more = Node2.partial :meth0, *args - "Node2:meth1partial
#{more}
done
back" - end -end -# -class Node3 < Zorglub::Node - # - map APP, '/url3' - layout '' - # - def index *args - @title = "Session tests" - if not session.exists? - @data = "NO SESSION" - else - t = Time.now - if session[:now].nil? - session[:now] = t - @data = "#{t.strftime('%H:%M:%S')} FIRST" - elsif t-session[:now]>5 - session[:now] = t - @data = "#{t.strftime('%H:%M:%S')} UPDATE" - else - @data = "#{session[:now].strftime('%H:%M:%S')} CURRENT" - end - end - end - # -end -# # -# def redir -# redirect Node0.r -# end -# -class Node0 < Zorglub::Node - # - map APP, '/' - # - def index - html = "" - html - end - # -end -# -Node1::LINKS= [ - [Node1.r('index','arg1','arg2','arg3'),'index'], - [Node1.r('meth0'),'meth0'], - [Node1.r('meth1','one','two'),'meth1 with args'], - [Node1.r('jump','one','two'),'test redirect'], - [Node0.r,'back'], -] -# -puts APP.to_hash.inspect -# -map '/' do - use Rack::Lint - use Rack::ShowExceptions - use Rack::Session::Cookie, :key=>Zorglub::Session.session_key, - :secret=>'my-secret-secret', - :path=>'/', - :http_only=>true, - :expire_after=>30 - run APP -end -# diff --git a/examples/view/url1/index.haml b/examples/view/url1/index.haml deleted file mode 100644 index 7bbf8be..0000000 --- a/examples/view/url1/index.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h3='url1 index view' --action.each do |k,v| - %p="#{k} => #{v}" -%p - - @links.each do |href,name| - %a{:href=>href}=name - %br diff --git a/examples/view/url1/meth0.haml b/examples/view/url1/meth0.haml deleted file mode 100644 index 89a7ab9..0000000 --- a/examples/view/url1/meth0.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h3='url1 meth0 view' --action.each do |k,v| - %p="#{k} => #{v}" -%p - - @links.each do |href,name| - %a{:href=>href}=name - %br diff --git a/examples/view/url3/index.haml b/examples/view/url3/index.haml deleted file mode 100644 index ff91a0b..0000000 --- a/examples/view/url3/index.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h2=@title -%p=Time.now.strftime '%H:%M:%S' -%p=@data -%a{:href=>Node3.r}="reload" -%br -%a{:href=>Node0.r}="back" -- cgit v1.2.3