ramaze 2010.06.18 → 2011.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +1 -0
  2. data/MANIFEST +9 -16
  3. data/README.md +37 -30
  4. data/Rakefile +5 -1
  5. data/TODO.md +19 -0
  6. data/doc/AUTHORS +5 -1
  7. data/doc/CHANGELOG +3553 -3272
  8. data/doc/tutorial/todolist.html +1512 -1512
  9. data/examples/app/blog/app.rb +2 -0
  10. data/examples/app/todolist/controller/init.rb +1 -2
  11. data/examples/app/wiktacular/mkd/main/2007-07-20_19-21-12.mkd +1 -1
  12. data/examples/app/wiktacular/mkd/main/2007-07-20_19-23-10.mkd +1 -1
  13. data/examples/app/wiktacular/mkd/main/2007-07-20_19-45-07.mkd +1 -1
  14. data/examples/app/wiktacular/mkd/main/current.mkd +1 -1
  15. data/examples/app/wiktacular/mkd/testing/2007-07-20_16-43-46.mkd +1 -1
  16. data/examples/app/wiktacular/mkd/testing/2007-07-20_19-43-50.mkd +2 -2
  17. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-08.mkd +16 -16
  18. data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-54.mkd +16 -16
  19. data/examples/app/wiktacular/mkd/testing/current.mkd +16 -16
  20. data/lib/proto/model/init.rb +1 -1
  21. data/lib/proto/public/js/jquery.js +2034 -1095
  22. data/lib/proto/start.rb +2 -0
  23. data/lib/proto/view/index.xhtml +3 -3
  24. data/lib/ramaze.rb +1 -2
  25. data/lib/ramaze/cache.rb +1 -0
  26. data/lib/ramaze/cache/sequel.rb +131 -37
  27. data/lib/ramaze/controller.rb +1 -0
  28. data/lib/ramaze/gestalt.rb +75 -46
  29. data/lib/ramaze/helper.rb +1 -0
  30. data/lib/ramaze/helper/auth.rb +38 -4
  31. data/lib/ramaze/helper/blue_form.rb +498 -78
  32. data/lib/ramaze/helper/cache.rb +2 -2
  33. data/lib/ramaze/helper/csrf.rb +225 -0
  34. data/lib/ramaze/helper/erector.rb +67 -9
  35. data/lib/ramaze/helper/flash.rb +4 -2
  36. data/lib/ramaze/helper/gestalt.rb +2 -0
  37. data/lib/ramaze/helper/gravatar.rb +1 -1
  38. data/lib/ramaze/helper/localize.rb +4 -0
  39. data/lib/ramaze/helper/send_file.rb +30 -0
  40. data/lib/ramaze/helper/thread.rb +5 -0
  41. data/lib/ramaze/helper/user.rb +4 -3
  42. data/lib/ramaze/helper/xhtml.rb +87 -8
  43. data/lib/ramaze/log.rb +13 -0
  44. data/lib/ramaze/log/analogger.rb +15 -5
  45. data/lib/ramaze/log/growl.rb +28 -13
  46. data/lib/ramaze/log/hub.rb +12 -4
  47. data/lib/ramaze/log/informer.rb +28 -11
  48. data/lib/ramaze/log/knotify.rb +7 -2
  49. data/lib/ramaze/log/logger.rb +12 -4
  50. data/lib/ramaze/log/logging.rb +40 -14
  51. data/lib/ramaze/log/rotatinginformer.rb +47 -23
  52. data/lib/ramaze/log/syslog.rb +37 -31
  53. data/lib/ramaze/log/xosd.rb +7 -4
  54. data/lib/ramaze/middleware_compiler.rb +2 -2
  55. data/lib/ramaze/snippets/fiber.rb +63 -63
  56. data/lib/ramaze/snippets/ramaze/lru_hash.rb +1 -1
  57. data/lib/ramaze/tool/bin.rb +1 -1
  58. data/lib/ramaze/version.rb +1 -1
  59. data/lib/ramaze/view.rb +4 -4
  60. data/lib/ramaze/view/erector.rb +88 -13
  61. data/ramaze.gemspec +65 -65
  62. data/spec/ramaze/bin/ramaze.rb +1 -1
  63. data/spec/ramaze/cache/localmemcache.rb +20 -12
  64. data/spec/ramaze/cache/sequel.rb +19 -19
  65. data/spec/ramaze/helper/blue_form.rb +549 -257
  66. data/spec/ramaze/helper/csrf.rb +109 -0
  67. data/spec/ramaze/helper/httpdigest.rb +31 -29
  68. data/spec/ramaze/helper/user.rb +1 -1
  69. data/spec/ramaze/helper/xhtml.rb +17 -0
  70. data/spec/ramaze/log/growl.rb +34 -0
  71. data/spec/ramaze/log/informer.rb +1 -0
  72. data/spec/ramaze/view/erector.rb +49 -71
  73. data/spec/ramaze/view/erector/external_view.erector +5 -0
  74. data/spec/ramaze/view/erector/index.erector +5 -0
  75. data/spec/ramaze/view/erector/layout.erector +13 -3
  76. data/spec/ramaze/view/erector/tables.erector +23 -0
  77. data/spec/ramaze/view/erector/view.erector +6 -0
  78. data/tasks/git.rake +2 -2
  79. metadata +133 -176
  80. data/examples/helpers/form_with_sequel.rb +0 -24
  81. data/examples/helpers/nitro_form.rb +0 -23
  82. data/lib/ramaze/helper/form.rb +0 -133
  83. data/lib/ramaze/helper/nitroform.rb +0 -14
  84. data/lib/ramaze/helper/pager.rb +0 -367
  85. data/lib/ramaze/helper/partial.rb +0 -100
  86. data/lib/ramaze/helper/sequel.rb +0 -55
  87. data/lib/ramaze/helper/sequel_form.rb +0 -284
  88. data/lib/vendor/etag.rb +0 -22
  89. data/spec/ramaze/helper/form.rb +0 -360
  90. data/spec/ramaze/helper/pager.rb +0 -96
  91. data/spec/ramaze/helper/sequel_form.rb +0 -94
  92. data/spec/ramaze/view/erector/external.erector +0 -1
  93. data/spec/ramaze/view/erector/invoke_helper_method.erector +0 -1
  94. data/spec/ramaze/view/erector/strict_xhtml.erector +0 -3
  95. data/spec/ramaze/view/erector/sum.erector +0 -1
@@ -1,94 +0,0 @@
1
- # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
2
- # All files in this distribution are subject to the terms of the Ruby license.
3
-
4
- require File.expand_path('../../../../spec/helper', __FILE__)
5
-
6
- spec_requires 'hpricot', 'sequel'
7
-
8
- DB = Sequel.sqlite
9
-
10
- class User < Sequel::Model(:user)
11
- plugin :schema
12
-
13
- set_schema do
14
- primary_key :id
15
-
16
- boolean :online
17
- varchar :name
18
- integer :level
19
- text :description
20
- date :birthday
21
- time :created
22
- end
23
-
24
- create_table unless table_exists?
25
- end
26
-
27
- class FormController < Ramaze::Controller
28
- map '/'
29
- helper :sequel_form
30
-
31
- def new
32
- sequel_form(User).to_s
33
- end
34
-
35
- def new_with_options
36
- sequel_form(User, :method => :post, :action => r(:create)).to_s
37
- end
38
-
39
- def edit(id)
40
- sequel_form(User[id]).to_s
41
- end
42
-
43
- def edit_with_options(id)
44
- sequel_form(User[id], :method => :post, :action => r(:create)).to_s
45
- end
46
- end
47
-
48
- describe Ramaze::Helper::SequelForm do
49
- behaves_like :rack_test
50
-
51
- def hget(uri)
52
- got = get(uri)
53
- got.status.should == 200
54
- Hpricot(got.body)
55
- end
56
-
57
- it 'provides forms for model class' do
58
- form = hget('/new').at(:form)
59
- (form/:input).size.should == 5
60
- (form/:input).map{|i| i[:name] }.compact.sort.should == %w[level name online]
61
- form.at(:textarea)[:name].should == 'description'
62
- end
63
-
64
- it 'provides form for model class with options' do
65
- form = hget('/new_with_options').at(:form)
66
- form.raw_attributes.should == {'action' => '/create', 'method' => 'post'}
67
- end
68
-
69
- data = {
70
- :name => 'manveru',
71
- :description => 'Ramaze dev',
72
- :online => true,
73
- :level => 2,
74
- :birthday => Time.now,
75
- :created => Time.now,
76
- }
77
- User.create(data)
78
-
79
- it 'provides form for instance of model' do
80
- form = hget('/edit/1').at(:form)
81
- form.at('input[@name=name]').raw_attributes.should ==
82
- { 'name' => 'name', 'type' => 'text', 'value' => data[:name] }
83
- form.at('input[@name=online]').raw_attributes.should ==
84
- { "name" => "online", "type" => "checkbox", "checked" => "checked",
85
- "value" => data[:online].to_s }
86
- form.at('input[@name=level]').raw_attributes.should ==
87
- { "name" => "level", "type" => "text", "value" => data[:level].to_s }
88
- end
89
-
90
- it 'provides form with options for instance of model' do
91
- hget('/edit_with_options/1').at(:form).raw_attributes.should ==
92
- {"action" => "/create", "method" => "post"}
93
- end
94
- end
@@ -1 +0,0 @@
1
- h1 "External Erector View Template"
@@ -1 +0,0 @@
1
- a(:href => r(:index)) { text "Index page" }
@@ -1,3 +0,0 @@
1
- strict_xhtml {
2
- p "STRICT!"
3
- }
@@ -1 +0,0 @@
1
- p @num1 + @num2