GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
added helpers for templates, blackboard functionality
Pascal (author)
Fri May 30 00:46:03 -0700 2008
commit  b2afb99741c52794f5dd4504986a1981d6e61255
tree    fc38f6244068b848238ca5bd35756a1ed78c7a29
parent  5f0749e16d2356a2fc8e067b3f3db37e514f6ded
...
103
104
105
106
 
 
 
107
108
109
...
103
104
105
 
106
107
108
109
110
111
0
@@ -103,7 +103,9 @@ module Waves
0
         end
0
       end
0
 
0
- def initialize( request ); @request = request; end
0
+ def initialize( request )
0
+ @request = request
0
+ end
0
 
0
       # The params variable is taken from the request object and "destructured", so that
0
       # a parameter named 'blog.title' becomes:
...
7
8
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
11
12
...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
0
@@ -7,6 +7,22 @@ module Waves
0
         value.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] }
0
       end
0
       
0
+ # Returns an empty HTML tag of type +name+ which by default is XHTML
0
+ # compliant. Setting +open+ to true will create an open tag compatible
0
+ # with HTML 4.0 and below. Add HTML attributes by passing an attributes
0
+ # hash to +options+. For attributes with no value like (disabled and
0
+ # readonly), give it a value of true in the +options+ hash. You can use
0
+ # symbols or strings for the attribute names.
0
+ #
0
+ # tag("br")
0
+ # # => <br />
0
+ # tag("br", nil, true)
0
+ # # => <br>
0
+ # tag("input", { :type => 'text', :disabled => true })
0
+ # # => <input type="text" disabled="disabled" />
0
+ def tag(name, options = nil, open = false)
0
+ "<#{name}#{tag_options(options) if options}" + (open ? ">" : " />")
0
+ end
0
       
0
       # Returns the escaped +html+ without affecting existing escaped entities.
0
       #
...
1
 
2
3
4
...
15
16
17
18
 
19
20
21
22
 
23
24
25
 
26
27
28
...
 
1
2
3
4
...
15
16
17
 
18
19
20
21
 
22
23
24
25
26
27
28
29
0
@@ -1,4 +1,4 @@
0
-gem 'dm-core'
0
+gem 'dm-core', '=0.9.0'
0
 
0
 require 'data_mapper'
0
 
0
@@ -15,14 +15,15 @@ module Waves
0
           end
0
           
0
           app.instance_eval do
0
-
0
+
0
             auto_eval :Models do
0
               auto_load true, :directories => [:models]
0
             end
0
-
0
+
0
             auto_eval :Configurations do
0
               auto_eval :Mapping do
0
                 before true do
0
+ app.database #force adapter init if not already done
0
                   ::DataMapper::Repository.context.push(::DataMapper::Repository.new(:main_repository))
0
                 end
0
                 always true do
...
12
13
14
15
 
16
17
18
...
12
13
14
 
15
16
17
18
0
@@ -12,7 +12,7 @@ module Waves
0
           
0
           auto_create_module( :Configurations ) do
0
             include AutoCode
0
- auto_create_module( :Mapping ) { extend Waves::Mapping }
0
+ auto_eval( :Mapping ) { extend Waves::Mapping }
0
             auto_create_class true, Waves::Configurations::Default
0
             auto_load :Mapping, :directories => [:configurations]
0
             auto_load true, :directories => [:configurations]
...
7
8
9
 
 
10
11
12
...
7
8
9
10
11
12
13
14
0
@@ -7,6 +7,8 @@ module Erubis
0
   class Context
0
     include Waves::Helpers::UrlHelper
0
     include Waves::Helpers::TagHelper
0
+ include Waves::Helpers::AssetHelper
0
+ include Waves::Helpers::NumberHelper
0
     
0
     def <<(s)
0
       eval("_buf", @binding).concat s # add to rendered output
...
6
7
8
9
 
10
11
12
...
14
15
16
 
17
18
19
...
6
7
8
 
9
10
11
12
...
14
15
16
17
18
19
20
0
@@ -6,7 +6,7 @@ module Waves
0
 
0
     class ParseError < Exception ; end
0
 
0
- attr_reader :response, :session
0
+ attr_reader :response, :session, :blackboard
0
 
0
     # Create a new request. Takes a env parameter representing the request passed in from Rack.
0
     # You shouldn't need to call this directly.
0
@@ -14,6 +14,7 @@ module Waves
0
       @request = Rack::Request.new( env )
0
       @response = Waves::Response.new( self )
0
       @session = Waves::Session.new( self )
0
+ @blackboard = Waves::Blackboard.new( self )
0
     end
0
 
0
     # Accessor not explicitly defined by Waves::Request are delegated to Rack::Request.
...
30
31
32
 
 
 
33
34
35
...
30
31
32
33
34
35
36
37
38
0
@@ -30,6 +30,9 @@ module Waves
0
     def not_found; request.not_found; end
0
     # Access the Waves::Logger.
0
     def log; Waves::Logger; end
0
+ # Access the Blackboard
0
+ def blackboard; request.blackboard; end
0
+
0
   end
0
 
0
 end
...
6
7
8
9
 
 
 
10
11
12
...
6
7
8
 
9
10
11
12
13
14
0
@@ -6,7 +6,9 @@ module Waves
0
 
0
     include ResponseMixin
0
 
0
- def initialize(request); @request = request; end
0
+ def initialize(request)
0
+ @request = request
0
+ end
0
 
0
     def resource( resource, &block )
0
       @resource = resource; yield.call
...
7
8
9
 
 
 
 
 
 
 
 
 
 
 
10
11
12
...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
0
@@ -7,5 +7,16 @@ class Hash
0
     end
0
   end
0
 
0
+ # Destructively convert all keys to symbols.
0
+ def symbolize_keys!
0
+ keys.each do |key|
0
+ unless key.is_a?(Symbol)
0
+ self[key.to_sym] = self[key]
0
+ delete(key)
0
+ end
0
+ end
0
+ self
0
+ end
0
+
0
 
0
 end
0
\ No newline at end of file
...
45
46
47
 
48
49
50
...
58
59
60
 
 
61
62
63
...
45
46
47
48
49
50
51
...
59
60
61
62
63
64
65
66
0
@@ -45,6 +45,7 @@ require 'runtime/response'
0
 require 'runtime/response_mixin'
0
 require 'runtime/response_proxy'
0
 require 'runtime/session'
0
+require 'runtime/blackboard'
0
 require 'runtime/configuration'
0
 
0
 # waves URI mapping
0
@@ -58,6 +59,8 @@ require 'views/mixin'
0
 require 'views/base'
0
 require 'renderers/mixin'
0
 require 'renderers/markaby'
0
+require 'helpers/asset_helper'
0
+require 'helpers/number_helper'
0
 require 'helpers/tag_helper'
0
 require 'helpers/url_helper'
0
 require 'renderers/erubis'

Comments

    No one has commented yet.