manveru-innate 2009.02.06
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1409 -0
- data/COPYING +18 -0
- data/MANIFEST +100 -0
- data/README.md +485 -0
- data/Rakefile +139 -0
- data/example/app/retro_games.rb +57 -0
- data/example/app/whywiki_erb/layout/wiki.html.erb +15 -0
- data/example/app/whywiki_erb/spec/wiki.rb +19 -0
- data/example/app/whywiki_erb/start.rb +45 -0
- data/example/app/whywiki_erb/view/edit.html.erb +6 -0
- data/example/app/whywiki_erb/view/index.html.erb +10 -0
- data/example/custom_middleware.rb +43 -0
- data/example/error_handling.rb +31 -0
- data/example/hello.rb +12 -0
- data/example/howto_spec.rb +60 -0
- data/example/link.rb +35 -0
- data/example/providing_hash.rb +46 -0
- data/example/session.rb +42 -0
- data/innate.gemspec +118 -0
- data/lib/innate.rb +191 -0
- data/lib/innate/action.rb +156 -0
- data/lib/innate/adapter.rb +89 -0
- data/lib/innate/cache.rb +117 -0
- data/lib/innate/cache/api.rb +106 -0
- data/lib/innate/cache/drb.rb +58 -0
- data/lib/innate/cache/file_based.rb +39 -0
- data/lib/innate/cache/marshal.rb +17 -0
- data/lib/innate/cache/memory.rb +22 -0
- data/lib/innate/cache/yaml.rb +17 -0
- data/lib/innate/core_compatibility/basic_object.rb +9 -0
- data/lib/innate/core_compatibility/string.rb +3 -0
- data/lib/innate/current.rb +37 -0
- data/lib/innate/dynamap.rb +81 -0
- data/lib/innate/helper.rb +195 -0
- data/lib/innate/helper/aspect.rb +62 -0
- data/lib/innate/helper/cgi.rb +39 -0
- data/lib/innate/helper/flash.rb +36 -0
- data/lib/innate/helper/link.rb +55 -0
- data/lib/innate/helper/partial.rb +90 -0
- data/lib/innate/helper/redirect.rb +85 -0
- data/lib/innate/helper/send_file.rb +18 -0
- data/lib/innate/log.rb +23 -0
- data/lib/innate/log/color_formatter.rb +43 -0
- data/lib/innate/log/hub.rb +72 -0
- data/lib/innate/mock.rb +49 -0
- data/lib/innate/node.rb +471 -0
- data/lib/innate/options.rb +91 -0
- data/lib/innate/options/dsl.rb +155 -0
- data/lib/innate/request.rb +165 -0
- data/lib/innate/response.rb +18 -0
- data/lib/innate/route.rb +109 -0
- data/lib/innate/session.rb +104 -0
- data/lib/innate/session/flash.rb +94 -0
- data/lib/innate/setup.rb +23 -0
- data/lib/innate/spec.rb +42 -0
- data/lib/innate/state.rb +22 -0
- data/lib/innate/state/accessor.rb +130 -0
- data/lib/innate/state/fiber.rb +68 -0
- data/lib/innate/state/thread.rb +39 -0
- data/lib/innate/traited.rb +20 -0
- data/lib/innate/trinity.rb +22 -0
- data/lib/innate/version.rb +3 -0
- data/lib/innate/view.rb +67 -0
- data/lib/innate/view/erb.rb +17 -0
- data/lib/innate/view/none.rb +9 -0
- data/lib/rack/middleware_compiler.rb +62 -0
- data/lib/rack/reloader.rb +192 -0
- data/spec/example/hello.rb +14 -0
- data/spec/example/link.rb +29 -0
- data/spec/helper.rb +2 -0
- data/spec/innate/cache/common.rb +45 -0
- data/spec/innate/cache/marshal.rb +5 -0
- data/spec/innate/cache/memory.rb +5 -0
- data/spec/innate/cache/yaml.rb +5 -0
- data/spec/innate/dynamap.rb +22 -0
- data/spec/innate/helper.rb +66 -0
- data/spec/innate/helper/aspect.rb +80 -0
- data/spec/innate/helper/cgi.rb +37 -0
- data/spec/innate/helper/flash.rb +148 -0
- data/spec/innate/helper/link.rb +82 -0
- data/spec/innate/helper/partial.rb +66 -0
- data/spec/innate/helper/redirect.rb +148 -0
- data/spec/innate/helper/send_file.rb +21 -0
- data/spec/innate/helper/view/aspect_hello.erb +1 -0
- data/spec/innate/helper/view/locals.erb +1 -0
- data/spec/innate/helper/view/loop.erb +4 -0
- data/spec/innate/helper/view/num.erb +1 -0
- data/spec/innate/helper/view/partial.erb +1 -0
- data/spec/innate/helper/view/recursive.erb +8 -0
- data/spec/innate/mock.rb +84 -0
- data/spec/innate/node.rb +180 -0
- data/spec/innate/node/bar.html +1 -0
- data/spec/innate/node/foo.html.erb +1 -0
- data/spec/innate/node/with_layout.erb +3 -0
- data/spec/innate/options.rb +90 -0
- data/spec/innate/parameter.rb +154 -0
- data/spec/innate/request.rb +73 -0
- data/spec/innate/route.rb +129 -0
- data/spec/innate/session.rb +59 -0
- data/spec/innate/traited.rb +55 -0
- metadata +160 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
|
3
|
+
class SessionSpec
|
4
|
+
include Innate::Node
|
5
|
+
map '/'
|
6
|
+
provide :html => :none
|
7
|
+
|
8
|
+
def index
|
9
|
+
'No session here'
|
10
|
+
end
|
11
|
+
|
12
|
+
def init
|
13
|
+
session[:counter] = 0
|
14
|
+
end
|
15
|
+
|
16
|
+
def view
|
17
|
+
session[:counter]
|
18
|
+
end
|
19
|
+
|
20
|
+
def increment
|
21
|
+
session[:counter] += 1
|
22
|
+
end
|
23
|
+
|
24
|
+
def decrement
|
25
|
+
session[:counter] -= 1
|
26
|
+
end
|
27
|
+
|
28
|
+
def reset
|
29
|
+
session.clear
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Innate.options.cache.default = Innate::Cache::Memory
|
34
|
+
|
35
|
+
Innate.setup_dependencies
|
36
|
+
|
37
|
+
describe 'Innate::Session' do
|
38
|
+
should 'initiate session as needed' do
|
39
|
+
Innate::Mock.session do |session|
|
40
|
+
response = session.get('/')
|
41
|
+
response.body.should == 'No session here'
|
42
|
+
response['Set-Cookie'].should == nil
|
43
|
+
|
44
|
+
session.get('/init').body.should == '0'
|
45
|
+
|
46
|
+
1.upto(10) do |n|
|
47
|
+
session.get('/increment').body.should == n.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
session.get('/reset')
|
51
|
+
session.get('/view').body.should == ''
|
52
|
+
session.get('/init').body.should == '0'
|
53
|
+
|
54
|
+
-1.downto(-10) do |n|
|
55
|
+
session.get('/decrement').body.should == n.to_s
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
|
3
|
+
class Animal
|
4
|
+
include Innate::Traited
|
5
|
+
end
|
6
|
+
|
7
|
+
class Cat < Animal
|
8
|
+
end
|
9
|
+
|
10
|
+
class Tiger < Animal
|
11
|
+
end
|
12
|
+
|
13
|
+
describe Innate::Traited do
|
14
|
+
should 'set trait on superclass' do
|
15
|
+
Animal.trait :wild => :depends
|
16
|
+
Animal.trait[:wild].should == :depends
|
17
|
+
end
|
18
|
+
|
19
|
+
should 'reset trait on superclass' do
|
20
|
+
Animal.trait :wild => :naturally
|
21
|
+
Animal.trait[:wild].should == :naturally
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'set trait on instance' do
|
25
|
+
animal = Animal.new
|
26
|
+
animal.trait[:wild].should == nil
|
27
|
+
animal.trait :wild => :depends
|
28
|
+
animal.trait[:wild].should == :depends
|
29
|
+
end
|
30
|
+
|
31
|
+
should 'get ancestral trait from instance' do
|
32
|
+
animal = Animal.new
|
33
|
+
animal.ancestral_trait[:wild].should == :naturally
|
34
|
+
animal.trait :wild => :depends
|
35
|
+
animal.ancestral_trait[:wild].should == :depends
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'set trait on subclass' do
|
39
|
+
Cat.trait :sound => :meow
|
40
|
+
Cat.trait[:sound].should == :meow
|
41
|
+
end
|
42
|
+
|
43
|
+
should 'not modify traits of other classes' do
|
44
|
+
Animal.trait[:sound].should == nil
|
45
|
+
Tiger.trait[:sound].should == nil
|
46
|
+
end
|
47
|
+
|
48
|
+
should 'get ancestral trait from class in superclass' do
|
49
|
+
Cat.ancestral_trait[:wild].should == :naturally
|
50
|
+
end
|
51
|
+
|
52
|
+
should 'get ancestral trait from instance in superclass' do
|
53
|
+
Cat.new.ancestral_trait[:wild].should == :naturally
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: manveru-innate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2009.02.06
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael 'manveru' Fellinger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-05 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.4.0
|
23
|
+
version:
|
24
|
+
description: Simple, straight-forward, base for web-frameworks.
|
25
|
+
email: m.fellinger@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- CHANGELOG
|
34
|
+
- COPYING
|
35
|
+
- MANIFEST
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- example/app/retro_games.rb
|
39
|
+
- example/app/whywiki_erb/layout/wiki.html.erb
|
40
|
+
- example/app/whywiki_erb/spec/wiki.rb
|
41
|
+
- example/app/whywiki_erb/start.rb
|
42
|
+
- example/app/whywiki_erb/view/edit.html.erb
|
43
|
+
- example/app/whywiki_erb/view/index.html.erb
|
44
|
+
- example/custom_middleware.rb
|
45
|
+
- example/error_handling.rb
|
46
|
+
- example/hello.rb
|
47
|
+
- example/howto_spec.rb
|
48
|
+
- example/link.rb
|
49
|
+
- example/providing_hash.rb
|
50
|
+
- example/session.rb
|
51
|
+
- innate.gemspec
|
52
|
+
- lib/innate.rb
|
53
|
+
- lib/innate/action.rb
|
54
|
+
- lib/innate/adapter.rb
|
55
|
+
- lib/innate/cache.rb
|
56
|
+
- lib/innate/cache/api.rb
|
57
|
+
- lib/innate/cache/drb.rb
|
58
|
+
- lib/innate/cache/file_based.rb
|
59
|
+
- lib/innate/cache/marshal.rb
|
60
|
+
- lib/innate/cache/memory.rb
|
61
|
+
- lib/innate/cache/yaml.rb
|
62
|
+
- lib/innate/core_compatibility/basic_object.rb
|
63
|
+
- lib/innate/core_compatibility/string.rb
|
64
|
+
- lib/innate/current.rb
|
65
|
+
- lib/innate/dynamap.rb
|
66
|
+
- lib/innate/helper.rb
|
67
|
+
- lib/innate/helper/aspect.rb
|
68
|
+
- lib/innate/helper/cgi.rb
|
69
|
+
- lib/innate/helper/flash.rb
|
70
|
+
- lib/innate/helper/link.rb
|
71
|
+
- lib/innate/helper/partial.rb
|
72
|
+
- lib/innate/helper/redirect.rb
|
73
|
+
- lib/innate/helper/send_file.rb
|
74
|
+
- lib/innate/log.rb
|
75
|
+
- lib/innate/log/color_formatter.rb
|
76
|
+
- lib/innate/log/hub.rb
|
77
|
+
- lib/innate/mock.rb
|
78
|
+
- lib/innate/node.rb
|
79
|
+
- lib/innate/options.rb
|
80
|
+
- lib/innate/options/dsl.rb
|
81
|
+
- lib/innate/request.rb
|
82
|
+
- lib/innate/response.rb
|
83
|
+
- lib/innate/route.rb
|
84
|
+
- lib/innate/session.rb
|
85
|
+
- lib/innate/session/flash.rb
|
86
|
+
- lib/innate/setup.rb
|
87
|
+
- lib/innate/spec.rb
|
88
|
+
- lib/innate/state.rb
|
89
|
+
- lib/innate/state/accessor.rb
|
90
|
+
- lib/innate/state/fiber.rb
|
91
|
+
- lib/innate/state/thread.rb
|
92
|
+
- lib/innate/traited.rb
|
93
|
+
- lib/innate/trinity.rb
|
94
|
+
- lib/innate/version.rb
|
95
|
+
- lib/innate/view.rb
|
96
|
+
- lib/innate/view/erb.rb
|
97
|
+
- lib/innate/view/none.rb
|
98
|
+
- lib/rack/middleware_compiler.rb
|
99
|
+
- lib/rack/reloader.rb
|
100
|
+
- spec/example/hello.rb
|
101
|
+
- spec/example/link.rb
|
102
|
+
- spec/helper.rb
|
103
|
+
- spec/innate/cache/common.rb
|
104
|
+
- spec/innate/cache/marshal.rb
|
105
|
+
- spec/innate/cache/memory.rb
|
106
|
+
- spec/innate/cache/yaml.rb
|
107
|
+
- spec/innate/dynamap.rb
|
108
|
+
- spec/innate/helper.rb
|
109
|
+
- spec/innate/helper/aspect.rb
|
110
|
+
- spec/innate/helper/cgi.rb
|
111
|
+
- spec/innate/helper/flash.rb
|
112
|
+
- spec/innate/helper/link.rb
|
113
|
+
- spec/innate/helper/partial.rb
|
114
|
+
- spec/innate/helper/redirect.rb
|
115
|
+
- spec/innate/helper/send_file.rb
|
116
|
+
- spec/innate/helper/view/aspect_hello.erb
|
117
|
+
- spec/innate/helper/view/locals.erb
|
118
|
+
- spec/innate/helper/view/loop.erb
|
119
|
+
- spec/innate/helper/view/num.erb
|
120
|
+
- spec/innate/helper/view/partial.erb
|
121
|
+
- spec/innate/helper/view/recursive.erb
|
122
|
+
- spec/innate/mock.rb
|
123
|
+
- spec/innate/node.rb
|
124
|
+
- spec/innate/node/bar.html
|
125
|
+
- spec/innate/node/foo.html.erb
|
126
|
+
- spec/innate/node/with_layout.erb
|
127
|
+
- spec/innate/options.rb
|
128
|
+
- spec/innate/parameter.rb
|
129
|
+
- spec/innate/request.rb
|
130
|
+
- spec/innate/route.rb
|
131
|
+
- spec/innate/session.rb
|
132
|
+
- spec/innate/traited.rb
|
133
|
+
has_rdoc: true
|
134
|
+
homepage: http://github.com/manveru/innate
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: "0"
|
145
|
+
version:
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: "0"
|
151
|
+
version:
|
152
|
+
requirements: []
|
153
|
+
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 1.2.0
|
156
|
+
signing_key:
|
157
|
+
specification_version: 2
|
158
|
+
summary: Powerful web-framework wrapper for Rack.
|
159
|
+
test_files: []
|
160
|
+
|