ramaze 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Rakefile +13 -7
  2. data/doc/README +1 -1
  3. data/doc/README.html +729 -0
  4. data/doc/meta/users.kml +61 -59
  5. data/doc/readme_chunks/installing.txt +1 -1
  6. data/examples/auth/auth.rb +13 -8
  7. data/examples/element.rb +1 -2
  8. data/examples/ramaise.rb +139 -0
  9. data/examples/simple.rb +2 -5
  10. data/examples/sourceview/public/coderay.css +104 -0
  11. data/examples/sourceview/public/jquery.treeview.css +10 -9
  12. data/examples/sourceview/public/jquery.treeview.js +7 -7
  13. data/examples/sourceview/public/sourceview.js +43 -7
  14. data/examples/sourceview/sourceview.rb +36 -33
  15. data/examples/sourceview/template/index.haml +33 -17
  16. data/examples/wikore/spec/wikore.rb +1 -0
  17. data/examples/wikore/src/controller.rb +0 -1
  18. data/examples/wikore/src/model.rb +17 -16
  19. data/lib/proto/src/controller/main.rb +1 -1
  20. data/lib/proto/start.rb +2 -3
  21. data/lib/ramaze.rb +3 -0
  22. data/lib/ramaze/contrib/auto_params.rb +3 -3
  23. data/lib/ramaze/contrib/gzip_filter.rb +3 -4
  24. data/lib/ramaze/contrib/route.rb +5 -0
  25. data/lib/ramaze/controller/resolve.rb +1 -1
  26. data/lib/ramaze/dispatcher/action.rb +1 -1
  27. data/lib/ramaze/dispatcher/error.rb +7 -4
  28. data/lib/ramaze/gestalt.rb +1 -2
  29. data/lib/ramaze/helper.rb +8 -4
  30. data/lib/ramaze/helper/auth.rb +1 -1
  31. data/lib/ramaze/helper/cache.rb +4 -0
  32. data/lib/ramaze/helper/identity.rb +2 -2
  33. data/lib/ramaze/snippets/{string/DIVIDE.rb → divide.rb} +11 -8
  34. data/lib/ramaze/snippets/string/unindent.rb +7 -0
  35. data/lib/ramaze/snippets/thread/into.rb +5 -12
  36. data/lib/ramaze/spec/helper/wrap.rb +1 -1
  37. data/lib/ramaze/template/haml.rb +4 -14
  38. data/lib/ramaze/template/sass.rb +4 -14
  39. data/lib/ramaze/trinity/request.rb +34 -1
  40. data/lib/ramaze/version.rb +1 -1
  41. data/rake_tasks/coverage.rake +46 -0
  42. data/rake_tasks/spec.rake +1 -1
  43. data/spec/contrib/auto_params.rb +6 -1
  44. data/spec/contrib/route.rb +0 -2
  45. data/spec/contrib/sequel/fill.rb +6 -4
  46. data/spec/ramaze/controller/resolve.rb +31 -0
  47. data/spec/ramaze/helper/cache.rb +14 -7
  48. data/spec/ramaze/template/haml.rb +14 -0
  49. data/spec/ramaze/template/sass.rb +23 -1
  50. data/spec/ramaze/trinity/request.rb +19 -0
  51. data/spec/snippets/{string/DIVIDE.rb → divide.rb} +5 -1
  52. data/spec/snippets/kernel/__dir__.rb +1 -1
  53. data/spec/snippets/string/unindent.rb +22 -0
  54. data/spec/snippets/thread/into.rb +21 -0
  55. metadata +90 -80
@@ -1,7 +1,5 @@
1
1
  require 'spec/helper'
2
2
 
3
- require 'ramaze/contrib'
4
-
5
3
  class MainController < Ramaze::Controller
6
4
  def float(flt)
7
5
  "Float: #{flt}"
@@ -1,10 +1,12 @@
1
1
  require 'spec/helper'
2
2
 
3
- require 'ramaze/contrib'
3
+ testcase_requires 'sequel'
4
4
 
5
- testcase_requires 'sequel', 'sequel/sqlite'
6
-
7
- DB = Sequel('sqlite:/')
5
+ begin
6
+ DB = Sequel.sqlite
7
+ rescue NoMethodError
8
+ raise LoadError, 'Install latest Sequel gem'
9
+ end
8
10
 
9
11
  require 'ramaze/contrib/sequel/fill'
10
12
 
@@ -0,0 +1,31 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'spec/helper'
5
+
6
+ class MainController < Ramaze::Controller
7
+ engine :None
8
+
9
+ define_method('file.ext') { 'file.ext' }
10
+ define_method('css/file.css') { 'file.css' }
11
+ define_method(:path/:to/:js/'file.js') { 'file.js' }
12
+
13
+ define_method(:other/:greet/:other) { @greet = 'hi' }
14
+ end
15
+
16
+ describe 'Controller resolving' do
17
+ ramaze
18
+
19
+ it 'should work with .' do
20
+ get('/file.ext').body.should == 'file.ext'
21
+ end
22
+
23
+ it 'should work with /' do
24
+ get('/css/file.css').body.should == 'file.css'
25
+ get('/path/to/js/file.js').body.should == 'file.js'
26
+ end
27
+
28
+ it 'should find templates' do
29
+ get('/other/greet/other').body.should == '<html>Other: hi</html>'
30
+ end
31
+ end
@@ -17,8 +17,13 @@ class TCCacheHelperController < Ramaze::Controller
17
17
  value_cache[:time] ||= random
18
18
  end
19
19
 
20
- def uncache_value
20
+ def alt_cached_value
21
+ cache[:rand] ||= random
22
+ end
23
+
24
+ def uncache_values
21
25
  value_cache.delete :time
26
+ cache.delete :rand
22
27
  end
23
28
 
24
29
  def cached_action
@@ -96,8 +101,10 @@ describe "CacheHelper" do
96
101
  end
97
102
 
98
103
  3.times do
99
- lambda{ req('/uncache_value') }.should change{ req('/cached_value') }
104
+ lambda{ req('/uncache_values') }.should change{ req('/cached_value') }
100
105
  end
106
+
107
+ lambda{ req('/uncache_values') }.should change{ req('/alt_cached_value') }
101
108
  end
102
109
 
103
110
  it "cached action" do
@@ -111,25 +118,25 @@ describe "CacheHelper" do
111
118
  end
112
119
 
113
120
  it "should support options" do
114
- req('/ttl/cached_list').should == { :index => { :ttl => 1 } }.inspect
121
+ req('/ttl/cached_list').should == {:index=>{:ttl=>1}}.inspect
115
122
  req('/key/cached_list').should =~ /^\{:name=>\{:key=>/
116
123
  end
117
124
 
118
125
  it "should expire cache after time-to-live" do
119
- orig_value = get('/ttl').body
126
+ orig_value = req('/ttl')
120
127
  req('/ttl').should == orig_value
121
128
  sleep 1
122
129
  req('/ttl').should_not == orig_value
123
130
  end
124
131
 
125
132
  it "should cache using key lambda if provided" do
126
- lambda{ req('/key/name', {:name=>'Aman'}) }.should_not change{ req('/key/name', {:name=>'Aman'}) }
127
- req('/key/name', {:name=>'Bob'}).should =~ /^hi Bob/
133
+ lambda{ req('/key/name', :name=>'Aman') }.should_not change{ req('/key/name', :name=>'Aman') }
134
+ req('/key/name', :name=>'Bob').should =~ /^hi Bob/
128
135
  end
129
136
 
130
137
  it "should remain backwards compatible" do
131
138
  lambda{ req('/old') }.should_not change{ req('/old') }
132
- lambda{ req('/old/action/one/two') }.should_not change{ req('/old/action/one/two') }
139
+ lambda{ req('/old/action/two/three') }.should_not change{ req('/old/action/one/two') }
133
140
  req('/old/action/two/three').should =~ /^twothree/
134
141
  end
135
142
  end
@@ -20,6 +20,16 @@ class TCTemplateHamlController < Ramaze::Controller
20
20
  end
21
21
  end
22
22
 
23
+ class TCTemplateHamlLocalsController < Ramaze::Controller
24
+ map '/locals'
25
+ engine :Haml
26
+ trait :haml_options => { :locals => { :localvar => 'abcdefg' } }
27
+
28
+ def test
29
+ %{= localvar}
30
+ end
31
+ end
32
+
23
33
  describe "Haml templates" do
24
34
  ramaze(:compile => true)
25
35
 
@@ -43,4 +53,8 @@ describe "Haml templates" do
43
53
  </div>
44
54
  </div>}
45
55
  end
56
+
57
+ it "should have access to locals defined" do
58
+ get('/locals/test').body.strip.should == 'abcdefg'
59
+ end
46
60
  end
@@ -7,7 +7,7 @@ testcase_requires 'sass/engine'
7
7
 
8
8
  class TCTemplateSassController < Ramaze::Controller
9
9
  map '/'
10
- template_root 'spec/ramaze/template/sass/'
10
+ template_root __DIR__/:sass
11
11
  engine :Sass
12
12
 
13
13
  define_method('style.css') do
@@ -21,6 +21,24 @@ body
21
21
  end
22
22
  end
23
23
 
24
+ class TCTemplateSassLocalsController < Ramaze::Controller
25
+ map '/options'
26
+ engine :Sass
27
+ trait :sass_options => { :style => :compact }
28
+
29
+ def test
30
+ %{
31
+ body
32
+ margin: 1em
33
+
34
+ #content
35
+ font:
36
+ family: monospace
37
+ size: 10pt
38
+ }
39
+ end
40
+ end
41
+
24
42
  describe "Sass templates" do
25
43
  ramaze(:compile => true)
26
44
 
@@ -43,4 +61,8 @@ describe "Sass templates" do
43
61
  body #content {
44
62
  text-align: center; }"
45
63
  end
64
+
65
+ it "should use sass options" do
66
+ get('/options/test').body.should_not =~ /^ +/
67
+ end
46
68
  end
@@ -0,0 +1,19 @@
1
+ require 'spec/helper'
2
+
3
+ describe 'Ramaze::Request' do
4
+ def request(env = {})
5
+ Ramaze::Request.new(env)
6
+ end
7
+
8
+ it 'should show request_uri' do
9
+ request('REQUEST_URI' => '/?a=b').request_uri.should == '/?a=b'
10
+ request( 'PATH_INFO' => '/' ).request_uri.should == '/'
11
+ end
12
+
13
+ it 'should show local_net?' do
14
+ request.local_net?('192.168.0.1').to_s.should == '192.168.0.0'
15
+ request.local_net?('252.168.0.1').should be_nil
16
+ request('REMOTE_ADDR' => '211.3.129.47, 66.249.85.131').local_net?.should be_nil
17
+ request('REMOTE_ADDR' => '211.3.129.47').local_net?.should be_nil
18
+ end
19
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec/helper'
2
2
 
3
- describe 'String#/' do
3
+ describe 'String#/ and Symbol#/' do
4
4
 
5
5
  # check if this is ok in win32
6
6
  it 'should join two strings' do
@@ -11,6 +11,10 @@ describe 'String#/' do
11
11
  ('a' / :b).should == 'a/b'
12
12
  end
13
13
 
14
+ it 'should join two symbols' do
15
+ (:a / :b).should == 'a/b'
16
+ end
17
+
14
18
  it 'should be usable in concatenation' do
15
19
  ('a' / :b / :c).should == 'a/b/c'
16
20
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec/helper'
2
2
 
3
3
  describe '__DIR__' do
4
- # this is hardly exhaustive, but better tha anything
4
+ # this is hardly exhaustive, but better than nothing
5
5
  it 'should report the directory of the current file' do
6
6
  __DIR__.should == File.dirname(File.expand_path(__FILE__))
7
7
  end
@@ -0,0 +1,22 @@
1
+ require 'spec/helper'
2
+
3
+ describe "String#unindent" do
4
+ it "should remove indentation" do
5
+ %(
6
+ hello
7
+ how
8
+ are
9
+ you
10
+ doing
11
+ ).ui.should == \
12
+ %(hello
13
+ how
14
+ are
15
+ you
16
+ doing)
17
+ end
18
+
19
+ it 'should not break on a single line' do
20
+ 'word'.unindent.should == 'word'
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require 'spec/helper'
5
+
6
+ class TCThreadIntoController < Ramaze::Controller
7
+ map :/
8
+
9
+ def hello
10
+ Thread.into('goodbye') do |str|
11
+ "#{Ramaze::Action.current.name}, #{str}"
12
+ end.value
13
+ end
14
+ end
15
+
16
+ describe 'Thread.into' do
17
+ ramaze
18
+ it 'should provide access to thread vars' do
19
+ get('/hello').body.should == 'hello, goodbye'
20
+ end
21
+ end
metadata CHANGED
@@ -1,49 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4.7
3
- specification_version: 2
4
2
  name: ramaze
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2007-11-20 00:00:00 +09:00
8
- summary: Ramaze is a simple and modular web framework
9
- require_paths:
10
- - lib
11
- email: m.fellinger@gmail.com
12
- homepage: http://ramaze.rubyforge.org
13
- rubyforge_project:
14
- description: Ramaze is a simple and modular web framework
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - manveru
15
8
  autorequire:
16
- default_executable:
17
9
  bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- required_rubygems_version: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: "0"
30
- version:
31
- platform: ruby
32
- signing_key:
33
10
  cert_chain: []
34
11
 
35
- post_install_message: |-
36
- ============================================================
37
-
38
- Thank you for installing Ramaze!
39
- You can now do following:
40
-
41
- * Create a new project using the `ramaze' command:
42
- ramaze --create yourproject
43
-
44
- ============================================================
45
- authors:
46
- - manveru
12
+ date: 2007-11-29 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.7.3
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: rspec
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.0.2
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: rack
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.0
41
+ version:
42
+ description: Ramaze is a simple and modular web framework
43
+ email: m.fellinger@gmail.com
44
+ executables:
45
+ - ramaze
46
+ extensions: []
47
+
48
+ extra_rdoc_files:
49
+ - lib
50
+ - doc
51
+ - doc/README
52
+ - doc/FAQ
53
+ - doc/CHANGELOG
47
54
  files:
48
55
  - lib
49
56
  - doc
@@ -126,6 +133,7 @@ files:
126
133
  - examples/sourceview/public/images/tv-expandable.gif
127
134
  - examples/sourceview/public/images/tv-item-last.gif
128
135
  - examples/sourceview/public/images/tv-expandable-last.gif
136
+ - examples/sourceview/public/coderay.css
129
137
  - examples/sourceview/public/sourceview.js
130
138
  - examples/sourceview/sourceview.rb
131
139
  - examples/simple_auth.rb
@@ -172,6 +180,7 @@ files:
172
180
  - examples/whywiki/template/show.xhtml
173
181
  - examples/whywiki/template/edit.xhtml
174
182
  - examples/whywiki/start.rb
183
+ - examples/ramaise.rb
175
184
  - examples/hello.rb
176
185
  - examples/templates
177
186
  - examples/templates/template_ezamar.rb
@@ -218,6 +227,7 @@ files:
218
227
  - doc/tutorial/todolist.html
219
228
  - doc/tutorial/todolist.mkd
220
229
  - doc/AUTHORS
230
+ - doc/README.html
221
231
  - doc/INSTALL
222
232
  - doc/COPYING
223
233
  - doc/ProjectInfo
@@ -331,6 +341,7 @@ files:
331
341
  - spec/ramaze/inform/informer.rb
332
342
  - spec/ramaze/inform/syslog.rb
333
343
  - spec/ramaze/trinity
344
+ - spec/ramaze/trinity/request.rb
334
345
  - spec/ramaze/trinity/session.rb
335
346
  - spec/ramaze/adapter
336
347
  - spec/ramaze/adapter/mongrel.rb
@@ -338,6 +349,7 @@ files:
338
349
  - spec/ramaze/adapter/record.rb
339
350
  - spec/ramaze/request.rb
340
351
  - spec/ramaze/controller
352
+ - spec/ramaze/controller/resolve.rb
341
353
  - spec/ramaze/controller/template_resolving.rb
342
354
  - spec/ramaze/controller/template
343
355
  - spec/ramaze/controller/template/other
@@ -382,6 +394,7 @@ files:
382
394
  - spec/snippets/ordered_set.rb
383
395
  - spec/snippets/array
384
396
  - spec/snippets/array/put_within.rb
397
+ - spec/snippets/divide.rb
385
398
  - spec/snippets/kernel
386
399
  - spec/snippets/kernel/constant.rb
387
400
  - spec/snippets/kernel/aquire.rb
@@ -389,9 +402,11 @@ files:
389
402
  - spec/snippets/ramaze
390
403
  - spec/snippets/ramaze/caller_lines.rb
391
404
  - spec/snippets/ramaze/caller_info.rb
405
+ - spec/snippets/thread
406
+ - spec/snippets/thread/into.rb
392
407
  - spec/snippets/string
393
408
  - spec/snippets/string/color.rb
394
- - spec/snippets/string/DIVIDE.rb
409
+ - spec/snippets/string/unindent.rb
395
410
  - spec/snippets/string/camel_case.rb
396
411
  - spec/snippets/string/snake_case.rb
397
412
  - spec/snippets/struct
@@ -540,6 +555,7 @@ files:
540
555
  - lib/ramaze/snippets/ordered_set.rb
541
556
  - lib/ramaze/snippets/array
542
557
  - lib/ramaze/snippets/array/put_within.rb
558
+ - lib/ramaze/snippets/divide.rb
543
559
  - lib/ramaze/snippets/kernel
544
560
  - lib/ramaze/snippets/kernel/constant.rb
545
561
  - lib/ramaze/snippets/kernel/aquire.rb
@@ -555,7 +571,7 @@ files:
555
571
  - lib/ramaze/snippets/string
556
572
  - lib/ramaze/snippets/string/each.rb
557
573
  - lib/ramaze/snippets/string/color.rb
558
- - lib/ramaze/snippets/string/DIVIDE.rb
574
+ - lib/ramaze/snippets/string/unindent.rb
559
575
  - lib/ramaze/snippets/string/camel_case.rb
560
576
  - lib/ramaze/snippets/string/snake_case.rb
561
577
  - lib/ramaze/snippets/struct
@@ -568,11 +584,22 @@ files:
568
584
  - lib/ramaze/version.rb
569
585
  - lib/ramaze/inform.rb
570
586
  - rake_tasks/conf.rake
587
+ - rake_tasks/coverage.rake
571
588
  - rake_tasks/gem.rake
572
589
  - rake_tasks/maintenance.rake
573
590
  - rake_tasks/spec.rake
574
- test_files: []
575
-
591
+ has_rdoc: true
592
+ homepage: http://ramaze.rubyforge.org
593
+ post_install_message: |-
594
+ ============================================================
595
+
596
+ Thank you for installing Ramaze!
597
+ You can now do following:
598
+
599
+ * Create a new project using the `ramaze' command:
600
+ ramaze --create yourproject
601
+
602
+ ============================================================
576
603
  rdoc_options:
577
604
  - --all
578
605
  - --quiet
@@ -594,43 +621,26 @@ rdoc_options:
594
621
  - "\"doc\""
595
622
  - --accessor
596
623
  - "\"trait\""
597
- extra_rdoc_files:
624
+ require_paths:
598
625
  - lib
599
- - doc
600
- - doc/README
601
- - doc/FAQ
602
- - doc/CHANGELOG
603
- executables:
604
- - ramaze
605
- extensions: []
606
-
626
+ required_ruby_version: !ruby/object:Gem::Requirement
627
+ requirements:
628
+ - - ">="
629
+ - !ruby/object:Gem::Version
630
+ version: "0"
631
+ version:
632
+ required_rubygems_version: !ruby/object:Gem::Requirement
633
+ requirements:
634
+ - - ">="
635
+ - !ruby/object:Gem::Version
636
+ version: "0"
637
+ version:
607
638
  requirements: []
608
639
 
609
- dependencies:
610
- - !ruby/object:Gem::Dependency
611
- name: rake
612
- version_requirement:
613
- version_requirements: !ruby/object:Gem::Requirement
614
- requirements:
615
- - - ">="
616
- - !ruby/object:Gem::Version
617
- version: 0.7.3
618
- version:
619
- - !ruby/object:Gem::Dependency
620
- name: rspec
621
- version_requirement:
622
- version_requirements: !ruby/object:Gem::Requirement
623
- requirements:
624
- - - ">="
625
- - !ruby/object:Gem::Version
626
- version: 1.0.2
627
- version:
628
- - !ruby/object:Gem::Dependency
629
- name: rack
630
- version_requirement:
631
- version_requirements: !ruby/object:Gem::Requirement
632
- requirements:
633
- - - ">="
634
- - !ruby/object:Gem::Version
635
- version: 0.2.0
636
- version:
640
+ rubyforge_project:
641
+ rubygems_version: 0.9.5
642
+ signing_key:
643
+ specification_version: 2
644
+ summary: Ramaze is a simple and modular web framework
645
+ test_files: []
646
+