ramaze 2012.12.08 → 2023.01.06

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/examples/app/whywiki/spec/whywiki.rb +22 -24
  4. data/examples/app/whywiki/start.rb +10 -9
  5. data/examples/app/whywiki/{template → view}/edit.xhtml +2 -2
  6. data/examples/app/whywiki/view/show.xhtml +20 -0
  7. data/examples/app/wikore/spec/wikore.rb +1 -1
  8. data/guide/AUTHORS +11 -3
  9. data/guide/CHANGELOG +3761 -3599
  10. data/guide/general/sessions.md +42 -0
  11. data/lib/proto/Gemfile +2 -2
  12. data/lib/ramaze/cache/memcache.rb +3 -3
  13. data/lib/ramaze/cache/moneta.rb +143 -0
  14. data/lib/ramaze/cache/redis.rb +8 -11
  15. data/lib/ramaze/cache/sequel.rb +2 -2
  16. data/lib/ramaze/cache.rb +1 -0
  17. data/lib/ramaze/files.rb +1 -1
  18. data/lib/ramaze/helper/paginate.rb +5 -0
  19. data/lib/ramaze/helper/request_accessor.rb +3 -1
  20. data/lib/ramaze/helper/stack.rb +1 -1
  21. data/lib/ramaze/helper/upload.rb +1 -1
  22. data/lib/ramaze/log/syslog.rb +1 -1
  23. data/lib/ramaze/request.rb +2 -2
  24. data/lib/ramaze/snippets.rb +0 -1
  25. data/lib/ramaze/version.rb +3 -1
  26. data/lib/ramaze/view/nagoro/render_partial.rb +1 -1
  27. data/lib/ramaze.rb +1 -1
  28. data/ramaze.gemspec +11 -12
  29. data/spec/ramaze/cache/moneta.rb +53 -0
  30. data/spec/ramaze/cache/redis.rb +1 -1
  31. data/spec/ramaze/dispatcher/directory.rb +14 -7
  32. data/spec/ramaze/dispatcher/file.rb +0 -5
  33. data/spec/ramaze/error.rb +13 -17
  34. data/spec/ramaze/helper/paginate.rb +25 -0
  35. data/spec/ramaze/log/syslog.rb +11 -2
  36. data/spec/ramaze/session/redis.rb +2 -2
  37. data/spec/ramaze/view/haml.rb +3 -3
  38. data/spec/ramaze/view/slim.rb +1 -1
  39. metadata +88 -158
  40. data/.gems +0 -28
  41. data/.gitignore +0 -14
  42. data/.mailmap +0 -34
  43. data/.rvmrc +0 -2
  44. data/.travis.yml +0 -16
  45. data/.yardopts +0 -14
  46. data/examples/app/blog/public/.htaccess +0 -24
  47. data/examples/app/whywiki/template/show.xhtml +0 -18
  48. data/lib/ramaze/cache/localmemcache.rb +0 -53
  49. data/lib/ramaze/snippets/ramaze/lru_hash.rb +0 -247
  50. data/spec/ramaze/cache/localmemcache.rb +0 -50
  51. data/spec/ramaze/session/localmemcache.rb +0 -60
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: afe951903b9f669495e60996f5d8709d0b7327b2d0994b3268046f8db3683c96
4
+ data.tar.gz: 87acbc6a7db97ad1c92c7b03572f54d109e86a98bea854eafb6b762d33275191
5
+ SHA512:
6
+ metadata.gz: 5320492673b92af275a7fdf80acd9a153e0522fd009019e6790032e470ca7e67535726441f775a88556593f67a97eb6f0a59feea74ce63e9c12b464c5878b728
7
+ data.tar.gz: 7d656d67c1eaecaee4a53dacc84ef9e27d7c92a12af0c5b4928f551a387709cb5bd8dacf2d4e51cc197f2febbe59f7eba498ad28dff1588177de6a30b3233e89
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -1,58 +1,56 @@
1
+ require 'yaml'
2
+ require 'yaml/store'
1
3
  require 'ramaze'
2
- require 'ramaze/spec/helper'
4
+ require 'ramaze/spec/bacon'
3
5
 
4
- spec_require 'bluecloth', 'hpricot'
6
+ spec_require 'bluecloth', 'nokogiri'
5
7
 
6
- $LOAD_PATH.unshift base = __DIR__('..')
8
+ DB = YAML::Store.new('whywikitest.yaml')
9
+ END{ FileUtils.rm_f('whyikitest.yaml') }
7
10
 
8
- Db = Ramaze::YAMLStoreCache.new("#{base}/testwiki.yaml")
9
- require 'start'
11
+ require_relative '../start'
10
12
 
11
13
  describe 'WikiController' do
12
- behaves_like 'http'
14
+ behaves_like :rack_test
13
15
 
14
16
  def page(name)
15
17
  page = get(name)
16
18
  page.status.should == 200
17
19
  page.body.should.not == nil
18
20
 
19
- doc = Hpricot(page.body)
20
- title = doc.at('title').inner_html
21
+ doc = Nokogiri::HTML(page.body)
22
+ title = doc.at('title').inner_text
21
23
 
22
24
  body = doc.at('body')
23
25
  return title, body
24
26
  end
25
27
 
26
28
  it 'should start' do
27
- ramaze :public_root => base/:public,
28
- :view_root => base/:template
29
29
  get('/').status.should == 302
30
30
  end
31
31
 
32
32
  it 'should have main page' do
33
- t,body = page('/show/Home')
34
- t.should.match(/^MicroWiki Home$/)
35
- body.at('h1').inner_html.should == 'Home'
36
- body.at('a[@href=/edit/Home]').inner_html.should == 'Create Home'
33
+ title, body = page('/show/Home')
34
+ title.should.match(/^MicroWiki Home$/)
35
+ body.at('h1').inner_text.should == 'Home'
36
+ body.css('a[@href="/edit/Home"]').inner_text.should == 'Create Home'
37
37
  end
38
38
 
39
39
  it 'should have edit page' do
40
- t,body = page('/edit/Home')
41
- t.should.match(/^MicroWiki Edit Home$/)
40
+ title, body = page('/edit/Home')
41
+ title.should.match(/^MicroWiki Edit Home$/)
42
42
 
43
- body.at('a[@href=/]').inner_html.should == '< Home'
44
- body.at('h1').inner_html.should == 'Edit Home'
45
- body.at('form/textarea').should.not == nil
43
+ body.css('a[@href="/"]').inner_text.should == '< Home'
44
+ body.at('h1').inner_text.should == 'Edit Home'
45
+ body.at('form textarea').should.not == nil
46
46
  end
47
47
 
48
48
  it 'should create pages' do
49
49
  post('/save','text'=>'the text','page'=>'ThePage').status.should == 302
50
- page = Hpricot(get('/show/ThePage').body)
50
+ page = Nokogiri::HTML(get('/show/ThePage').body)
51
51
  body = page.at('body>div')
52
52
  body.should.not == nil
53
- body.at('a[@href=/edit/ThePage]').inner_html.should =='Edit ThePage'
54
- body.at('p').inner_html.should == 'the text'
53
+ body.at('a[@href="/edit/ThePage"]').inner_text.should =='Edit ThePage'
54
+ body.at('p').inner_text.should == 'the text'
55
55
  end
56
-
57
- FileUtils.rm("#{base}/testwiki.yaml")
58
56
  end
@@ -2,25 +2,26 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'ramaze'
5
+ require 'yaml/store'
5
6
  require 'bluecloth'
6
7
 
7
- Db = Ramaze::YAMLStoreCache.new('wiki.yaml') unless defined?(Db)
8
+ DB = YAML::Store.new('whywiki.yaml') unless defined?(DB)
8
9
 
9
10
  class WikiController < Ramaze::Controller
10
11
  map :/
11
12
 
12
13
  def index
13
- redirect R(:show, 'Home')
14
+ redirect r(:show, 'Home')
14
15
  end
15
16
 
16
17
  def show page = 'Home'
17
18
  @page = url_decode(page)
18
- @text = Db[page].to_s
19
+ @text = DB.transaction{|db| db[page] }.to_s
19
20
  @edit_link = "/edit/#{page}"
20
21
 
21
22
  @text.gsub!(/\[\[(.*?)\]\]/) do |m|
22
- exists = Db[$1] ? 'exists' : 'nonexists'
23
- A($1, :href => Rs(:show, url_encode($1)), :class => exists)
23
+ exists = DB.transaction{|db| db[$1] } ? 'exists' : 'nonexists'
24
+ A($1, :href => rs(:show, url_encode($1)), :class => exists)
24
25
  end
25
26
 
26
27
  @text = BlueCloth.new(@text).to_html
@@ -28,7 +29,7 @@ class WikiController < Ramaze::Controller
28
29
 
29
30
  def edit page = 'Home'
30
31
  @page = url_decode(page)
31
- @text = Db[page]
32
+ @text = DB.transaction{|db| db[page] }
32
33
  end
33
34
 
34
35
  def save
@@ -37,10 +38,10 @@ class WikiController < Ramaze::Controller
37
38
  page = request['page'].to_s
38
39
  text = request['text'].to_s
39
40
 
40
- Db[page] = text
41
+ DB.transaction{|db| db[page] = text }
41
42
 
42
- redirect Rs(:show, url_encode(page))
43
+ redirect rs(:show, url_encode(page))
43
44
  end
44
45
  end
45
46
 
46
- Ramaze.start :adapter => :mongrel
47
+ Ramaze.start host: '0.0.0.0'
@@ -4,8 +4,8 @@
4
4
  </head>
5
5
  <body>
6
6
  <h1>Edit #{@page}</h1>
7
- #{ A("&lt; Home", :href => Rs()) }
8
- <form method="POST" action="#{Rs(:save)}">
7
+ #{a("&lt; Home", '/')}
8
+ <form method="POST" action="#{r(:save)}">
9
9
  <input type="hidden" name="page" value="#{url_encode(@page)}" />
10
10
  <textarea name="text" style="width: 90%; height: 20em;">#{@text}</textarea>
11
11
  <input type="submit" />
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <title>MicroWiki #{@page}</title>
4
+ <style>
5
+ a.exists{ color: #00f; }
6
+ a.nonexists{ color: #f00; }
7
+ </style>
8
+ </head>
9
+ <body>
10
+ <?r unless @page == "Home" ?><a href="/show/Home">&lt; Home</a><?r end ?>
11
+ <h1>#{@page}</h1>
12
+ <?r if @text.empty? ?><a href="#@edit_link">Create #@page</a><?r end ?>
13
+ <?r unless @text.empty? ?>
14
+ <div>
15
+ <a href="#@edit_link">Edit #@page</a>
16
+ #@text
17
+ </div>
18
+ <?r end ?>
19
+ </body>
20
+ </html>
@@ -1,7 +1,7 @@
1
1
  require 'ramaze'
2
2
  require 'ramaze/spec/bacon'
3
3
 
4
- spec_requires 'hpricot', 'sequel'
4
+ spec_requires 'sequel'
5
5
 
6
6
  $LOAD_PATH.unshift base = __DIR__('..')
7
7
  require 'start'
data/guide/AUTHORS CHANGED
@@ -1,8 +1,8 @@
1
1
  Following persons have contributed to ramaze.
2
2
  (Sorted by number of submitted patches, then alphabetically)
3
3
 
4
- 2740 Michael Fellinger <m.fellinger@gmail.com>
5
- 238 Yorick Peterse <yorickpeterse@gmail.com>
4
+ 2754 Michael Fellinger <m.fellinger@gmail.com>
5
+ 247 Yorick Peterse <yorickpeterse@gmail.com>
6
6
  216 Aman Gupta <aman@ramaze.net>
7
7
  89 Jonathan Buch <jonathan.buch@gmail.com>
8
8
  77 Pistos <gitsomegrace.5.pistos@geoshell.com>
@@ -15,8 +15,9 @@ Following persons have contributed to ramaze.
15
15
  16 TJ Vanderpoel <bougy.man@gmail.com>
16
16
  11 Wang, Jinjing <nfjinjing@gmail.com>
17
17
  10 Lee Jarvis <lee@jarvis.co>
18
+ 10 Michel Blanc <mb@mbnet.fr>
19
+ 9 Michael Faughn <michael.faughn@nist.gov>
18
20
  8 Mario Gutierrez <mgutz@mgutz-mbp.local>
19
- 8 Michel Blanc <mb@mbnet.fr>
20
21
  7 Tadahiko Uehara <kikofx@gmail.com>
21
22
  6 Aki Reijonen <aki.reijonen@gmail.com>
22
23
  6 Antti Tuomi <antti.tuomi@tkk.fi>
@@ -39,6 +40,7 @@ Following persons have contributed to ramaze.
39
40
  2 jShaf <joshua.shaffner@gmail.com>
40
41
  2 Yutaka HARA <yutaka.hara+github@gmail.com>
41
42
  1 Aaron Mueller <mail@aaron-mueller.de>
43
+ 1 Anton Ovchinnikov <revolver112@gmail.com>
42
44
  1 Ara T. Howard <ara.t.howard@gmail.com>
43
45
  1 Arnaud Meuret <arnaud@meuret.name>
44
46
  1 Bruno Rohée <bruno@rohee.com>
@@ -47,14 +49,18 @@ Following persons have contributed to ramaze.
47
49
  1 Christian Neukirchen <chneukirchen@gmail.com>
48
50
  1 Colin Shea <colin@centuar.(none)>
49
51
  1 crab <crabtw@gmail.com>
52
+ 1 Daniel Mendler <mail@daniel-mendler.de>
50
53
  1 Dmitry Gorbik <dmitrygorbik@isengard.local>
54
+ 1 E0 <shan.huang@me.com>
51
55
  1 Esad Hajdarevic <esad@esse.at>
52
56
  1 Fabian Buch <fabian.buch@fabian-buch.de>
53
57
  1 Francesc Esplugas <francesc.esplugas@gmail.com>
54
58
  1 Gavin Kistner <gavin@phrogz.net>
55
59
  1 huma <huma@boxbot.org>
56
60
  1 Isak Andersson <IcePapih@lavabit.com>
61
+ 1 Jack Polgar <jack.polgar@gmail.com>
57
62
  1 Jason Torres <jason.e.torres@gmail.com>
63
+ 1 Javier Donaire <jdonaire@gmail.com>
58
64
  1 Jean-Francois Chevrette <jfchevrette@iweb.ca>
59
65
  1 Jeremy Evans <code@jeremyevans.net>
60
66
  1 kez <kdobson@gmail.com>
@@ -62,7 +68,9 @@ Following persons have contributed to ramaze.
62
68
  1 Marc Weber <marco-oweber@gmx.de>
63
69
  1 Martin Hilbig <blueonyx@dev-area.net>
64
70
  1 Matt Rubens <mrubens@goldencookie.localdomain>
71
+ 1 Michael Faughn <mike.faughn@gmail.com>
65
72
  1 Pistos <github.pistos@purepistos.net>
73
+ 1 Richard Fisher <richardfsr@gmail.com>
66
74
  1 Rob Lievaart <rob@rebeltechnologies.nl>
67
75
  1 sean <sean@sean-t61p.(none)>
68
76
  1 Thomas Leitner <thomas.leitner@gmail.com>