manveru-ramaze 2008.10 → 2008.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. data/benchmark/run.rb +1 -1
  2. data/examples/app/blog/spec/blog.rb +2 -2
  3. data/examples/app/rapaste/spec/rapaste.rb +1 -1
  4. data/examples/app/rapaste/start.rb +2 -2
  5. data/examples/app/todolist/spec/todolist.rb +1 -1
  6. data/examples/app/whywiki/spec/whywiki.rb +1 -1
  7. data/examples/app/wikore/spec/wikore.rb +1 -1
  8. data/examples/app/wikore/src/model.rb +1 -1
  9. data/examples/app/wiktacular/spec/wiktacular.rb +1 -1
  10. data/examples/app/wiktacular/src/model.rb +1 -1
  11. data/examples/basic/partial.rb +28 -0
  12. data/examples/misc/ramaise.rb +2 -2
  13. data/examples/templates/template_amrita2.rb +1 -1
  14. data/examples/templates/template_erubis.rb +1 -1
  15. data/examples/templates/template_ezamar.rb +1 -1
  16. data/examples/templates/template_haml.rb +2 -2
  17. data/examples/templates/template_liquid.rb +1 -1
  18. data/examples/templates/template_markaby.rb +2 -2
  19. data/examples/templates/template_nagoro.rb +1 -1
  20. data/examples/templates/template_redcloth.rb +1 -1
  21. data/examples/templates/template_remarkably.rb +2 -2
  22. data/examples/templates/template_tenjin.rb +1 -1
  23. data/examples/templates/template_xslt.rb +1 -1
  24. data/lib/proto/public/dispatch.fcgi +2 -2
  25. data/lib/proto/spec/main.rb +3 -3
  26. data/lib/ramaze/action.rb +7 -1
  27. data/lib/ramaze/cache/file.rb +71 -0
  28. data/lib/ramaze/cache.rb +1 -0
  29. data/lib/ramaze/contrib/email.rb +2 -0
  30. data/lib/ramaze/contrib/facebook.rb +2 -2
  31. data/lib/ramaze/contrib/file_cache.rb +2 -64
  32. data/lib/ramaze/contrib/sequel/image.rb +1 -1
  33. data/lib/ramaze/controller.rb +6 -1
  34. data/lib/ramaze/current/request.rb +85 -68
  35. data/lib/ramaze/current/session/hash.rb +7 -11
  36. data/lib/ramaze/current/session.rb +3 -5
  37. data/lib/ramaze/dispatcher/action.rb +2 -0
  38. data/lib/ramaze/dispatcher/file.rb +4 -0
  39. data/lib/ramaze/helper/aspect.rb +2 -2
  40. data/lib/ramaze/helper/form.rb +5 -2
  41. data/lib/ramaze/helper/formatting.rb +4 -0
  42. data/lib/ramaze/helper/gravatar.rb +18 -1
  43. data/lib/ramaze/helper/maruku.rb +2 -0
  44. data/lib/ramaze/helper/redirect.rb +22 -4
  45. data/lib/ramaze/helper.rb +9 -2
  46. data/lib/ramaze/reloader/watch_inotify.rb +73 -0
  47. data/lib/ramaze/reloader/watch_stat.rb +62 -0
  48. data/lib/ramaze/reloader.rb +25 -41
  49. data/lib/ramaze/snippets/object/__dir__.rb +3 -3
  50. data/lib/ramaze/snippets/ramaze/acquire.rb +31 -0
  51. data/lib/ramaze/spec/helper/mock_http.rb +6 -5
  52. data/lib/ramaze/template/ezamar/render_partial.rb +8 -0
  53. data/lib/ramaze.rb +4 -0
  54. data/ramaze.gemspec +757 -756
  55. data/spec/contrib/profiling.rb +1 -1
  56. data/spec/ramaze/action/file_cache.rb +1 -1
  57. data/spec/ramaze/action/layout.rb +1 -1
  58. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  59. data/spec/ramaze/controller/resolve.rb +1 -1
  60. data/spec/ramaze/controller/template_resolving.rb +1 -1
  61. data/spec/ramaze/dispatcher/directory.rb +3 -3
  62. data/spec/ramaze/helper/aspect.rb +1 -1
  63. data/spec/ramaze/helper/partial.rb +1 -1
  64. data/spec/ramaze/localize.rb +1 -1
  65. data/spec/ramaze/rewrite.rb +1 -1
  66. data/spec/ramaze/template/amrita2.rb +1 -1
  67. data/spec/ramaze/template/erubis.rb +1 -1
  68. data/spec/ramaze/template/ezamar.rb +1 -1
  69. data/spec/ramaze/template/haml.rb +2 -2
  70. data/spec/ramaze/template/nagoro.rb +1 -1
  71. data/spec/ramaze/template/redcloth.rb +1 -1
  72. data/spec/ramaze/template/sass.rb +1 -1
  73. data/spec/ramaze/template/tenjin.rb +1 -1
  74. data/spec/ramaze/template.rb +3 -3
  75. data/spec/snippets/object/__dir__.rb +6 -0
  76. data/spec/snippets/ramaze/acquire.rb +77 -0
  77. metadata +8 -8
@@ -15,7 +15,7 @@ Ramaze::Log.loggers << Ramaze::Logger::Informer.new(output)
15
15
 
16
16
  describe 'Profiling' do
17
17
  behaves_like "http"
18
- ramaze :public_root => File.join(__DIR__, 'public')
18
+ ramaze :public_root => __DIR__(:public)
19
19
 
20
20
  it "should profile" do
21
21
  output = StringIO.new
@@ -37,7 +37,7 @@ end
37
37
  describe 'Action rendering' do
38
38
  behaves_like 'http'
39
39
 
40
- FileUtils.mkdir_p(public_root = __DIR__/:public)
40
+ FileUtils.mkdir_p(public_root = __DIR__(:public))
41
41
 
42
42
  ramaze :file_cache => true, :public_root => public_root
43
43
 
@@ -20,7 +20,7 @@ end
20
20
  class TCActionOtherLayout < Ramaze::Controller
21
21
  map '/other'
22
22
  layout '/other_wrapper'
23
- view_root __DIR__/:view
23
+ view_root __DIR__(:view)
24
24
 
25
25
  def index
26
26
  "Others Hello"
@@ -19,7 +19,7 @@ end
19
19
  describe "Testing Actionless Templates" do
20
20
  behaves_like 'http'
21
21
  ramaze :actionless_templates => false,
22
- :view_root => __DIR__/:view, :error_page => true
22
+ :view_root => __DIR__(:view), :error_page => true
23
23
 
24
24
  it "should not find template file for non existant method" do
25
25
  get('/non_existant_method').status.should == 404
@@ -15,7 +15,7 @@ end
15
15
 
16
16
  describe 'Controller resolving' do
17
17
  behaves_like 'http'
18
- ramaze :view_root => __DIR__/:view
18
+ ramaze :view_root => __DIR__(:view)
19
19
 
20
20
  it 'should work with .' do
21
21
  get('/file.ext').body.should == 'file.ext'
@@ -4,7 +4,7 @@
4
4
  require 'spec/helper'
5
5
 
6
6
  class MainController < Ramaze::Controller
7
- view_root __DIR__/:view
7
+ view_root __DIR__(:view)
8
8
 
9
9
  def greet(type, message = "Message")
10
10
  @greet = "#{type} : #{message}"
@@ -12,8 +12,8 @@ describe 'Dispatcher::Directory' do
12
12
  /test/six.txt ]
13
13
 
14
14
  @hierarchy.each do |path|
15
- FileUtils.mkdir_p(__DIR__/:public/File.dirname(path))
16
- FileUtils.touch(__DIR__/:public/path)
15
+ FileUtils.mkdir_p(__DIR__(:public, File.dirname(path)))
16
+ FileUtils.touch(__DIR__(:public, path))
17
17
  end
18
18
 
19
19
  def build_listing(path)
@@ -51,5 +51,5 @@ describe 'Dispatcher::Directory' do
51
51
  check '/test', 'Directory listing of /test', files
52
52
  end
53
53
 
54
- FileUtils.rm_rf(__DIR__/:public/:test)
54
+ FileUtils.rm_rf(__DIR__('public/test'))
55
55
  end
@@ -24,7 +24,7 @@ class TCAspectAllController < Ramaze::Controller
24
24
  map '/all'
25
25
 
26
26
  helper :aspect
27
- view_root __DIR__/:view
27
+ view_root __DIR__(:view)
28
28
 
29
29
  def test_all_first() 'first' end
30
30
  def test_all_second() 'second' end
@@ -48,7 +48,7 @@ end
48
48
 
49
49
  describe "PartialHelper" do
50
50
  behaves_like 'http'
51
- ramaze :view_root => __DIR__/:view
51
+ ramaze :view_root => __DIR__(:view)
52
52
 
53
53
  it "should render partials" do
54
54
  get('/').body.should == '<html><head><title>Title</title></head></html>'
@@ -42,7 +42,7 @@ end
42
42
  describe "Localize" do
43
43
  behaves_like 'http'
44
44
 
45
- @dir = __DIR__ / :conf
45
+ @dir = __DIR__(:conf)
46
46
  FileUtils.mkdir_p(@dir)
47
47
 
48
48
  dict = {
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  describe 'Route' do
14
14
  behaves_like 'http'
15
- ramaze :public_root => __DIR__/:rewrite
15
+ ramaze :public_root => __DIR__(:rewrite)
16
16
 
17
17
  Ramaze::Rewrite[%r|^/index.php(.*)$|] = "%s"
18
18
 
@@ -6,7 +6,7 @@ require 'spec/helper'
6
6
  spec_require 'amrita2'
7
7
 
8
8
  class TCTemplateAmritaController < Ramaze::Controller
9
- view_root __DIR__/:amrita2
9
+ view_root __DIR__(:amrita2)
10
10
  engine :Amrita2
11
11
 
12
12
  def internal
@@ -6,7 +6,7 @@ require 'spec/helper'
6
6
  spec_require 'erubis'
7
7
 
8
8
  class TCTemplateErubisController < Ramaze::Controller
9
- view_root __DIR__/:erubis
9
+ view_root __DIR__(:erubis)
10
10
  engine :Erubis
11
11
 
12
12
  def index
@@ -5,7 +5,7 @@ require 'spec/helper'
5
5
 
6
6
  class TCTemplateController < Ramaze::Controller
7
7
  map :/
8
- view_root __DIR__/:ezamar
8
+ view_root __DIR__(:ezamar)
9
9
  engine :Ezamar
10
10
 
11
11
  def index text
@@ -7,7 +7,7 @@ spec_require 'ramaze/template/haml'
7
7
 
8
8
  class TCTemplateHamlController < Ramaze::Controller
9
9
  map :/
10
- view_root __DIR__/:haml
10
+ view_root __DIR__(:haml)
11
11
  engine :Haml
12
12
 
13
13
  helper :link
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  class TCRamazeLocals < Ramaze::Controller
24
24
  map '/locals'
25
- view_root __DIR__/:haml
25
+ view_root __DIR__(:haml)
26
26
 
27
27
  def output
28
28
  render_template 'locals.haml', :abc => 'def'
@@ -6,7 +6,7 @@ spec_require 'nagoro'
6
6
 
7
7
  class TCTemplateNagoroController < Ramaze::Controller
8
8
  map :/
9
- view_root __DIR__/:nagoro
9
+ view_root __DIR__(:nagoro)
10
10
  engine :Nagoro
11
11
 
12
12
  def index text
@@ -4,7 +4,7 @@ spec_require 'erubis'
4
4
  spec_require 'redcloth'
5
5
 
6
6
  class TCTemplateRedClothController < Ramaze::Controller
7
- view_root __DIR__/:redcloth
7
+ view_root __DIR__(:redcloth)
8
8
  engine :RedCloth
9
9
 
10
10
  def index
@@ -7,7 +7,7 @@ spec_require 'sass/engine'
7
7
 
8
8
  class TCTemplateSassController < Ramaze::Controller
9
9
  map '/'
10
- view_root __DIR__/:sass
10
+ view_root __DIR__(:sass)
11
11
  engine :Sass
12
12
 
13
13
  define_method('style.css') do
@@ -3,7 +3,7 @@ require 'spec/helper'
3
3
  spec_require 'tenjin'
4
4
 
5
5
  class TCTemplateTenjinController < Ramaze::Controller
6
- view_root __DIR__/:tenjin
6
+ view_root __DIR__(:tenjin)
7
7
  engine :Tenjin
8
8
 
9
9
  def index
@@ -21,7 +21,7 @@ end
21
21
  class TCTemplateController < Ramaze::Controller
22
22
  map '/'
23
23
  engine :TestTemplate
24
- view_root __DIR__/:template/:ramaze
24
+ view_root __DIR__('template/ramaze')
25
25
 
26
26
  def index *args
27
27
  end
@@ -32,7 +32,7 @@ end
32
32
 
33
33
  class TCMultipleTemplateRoots < Ramaze::Controller
34
34
  map '/multiple'
35
- view_root __DIR__/:helper/:view, __DIR__/:template/:ezamar
35
+ view_root __DIR__('helper/view'), __DIR__('template/ezamar')
36
36
 
37
37
  def sum
38
38
  @num1, @num2 = 1, 2
@@ -49,7 +49,7 @@ class TCMultipleTemplateRoots < Ramaze::Controller
49
49
  end
50
50
 
51
51
  describe "testing ramaze template" do
52
- ramaze :view_root => __DIR__/:view
52
+ ramaze :view_root => __DIR__(:view)
53
53
 
54
54
  def getpage page
55
55
  content = Ramaze::Controller.handle(page)
@@ -5,4 +5,10 @@ describe '__DIR__' do
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
8
+
9
+ should 'join passed arguments and prefix with directory of current file' do
10
+ __DIR__(:foo).should == File.join(File.dirname(File.expand_path(__FILE__)), 'foo')
11
+ __DIR__('foo/bar').should == File.join(File.dirname(File.expand_path(__FILE__)), 'foo/bar')
12
+ __DIR__(:foo, :bar).should == File.join(File.dirname(File.expand_path(__FILE__)), 'foo/bar')
13
+ end
8
14
  end
@@ -0,0 +1,77 @@
1
+ require 'lib/ramaze/spec/helper/snippets'
2
+ require 'fileutils'
3
+
4
+
5
+ # Mock require to only record attempts
6
+ $required = []
7
+
8
+ module Ramaze
9
+ def self.require(name)
10
+ $required << name
11
+ end
12
+ end
13
+
14
+ describe 'Ramaze::acquire' do
15
+ before do
16
+ dir = 'tmp_dir_for_acquire'
17
+ FileUtils.mkdir_p(dir + '/sub')
18
+
19
+ %w[ foo.rb bar.rb baz.so baz.yml sub/baz.rb ].
20
+ each do |path|
21
+ FileUtils.touch("#{dir}/#{path}")
22
+ end
23
+
24
+ $required = []
25
+ end
26
+
27
+ it 'should not load a single file' do
28
+ Ramaze::acquire 'tmp_dir_for_acquire/foo'
29
+ $required.should == []
30
+ end
31
+
32
+ it 'should load dir' do
33
+ Ramaze::acquire 'tmp_dir_for_acquire/sub/*'
34
+ $required.should == %w[
35
+ tmp_dir_for_acquire/sub/baz.rb]
36
+ end
37
+
38
+ it 'should be aliased to acquire' do
39
+ Ramaze::acquire 'tmp_dir_for_acquire/sub/*'
40
+ $required.should.not.be.empty
41
+ end
42
+
43
+ it 'should load {so,rb}, not others' do
44
+ Ramaze::acquire 'tmp_dir_for_acquire/*'
45
+ $required.sort.should == %w[
46
+ tmp_dir_for_acquire/bar.rb
47
+ tmp_dir_for_acquire/baz.so
48
+ tmp_dir_for_acquire/foo.rb]
49
+ end
50
+
51
+ it 'should use globbing' do
52
+ Ramaze::acquire 'tmp_dir_for_acquire/ba*'
53
+ $required.sort.should == %w[
54
+ tmp_dir_for_acquire/bar.rb
55
+ tmp_dir_for_acquire/baz.so]
56
+ end
57
+
58
+ it 'should use recursive globbing' do
59
+ Ramaze::acquire 'tmp_dir_for_acquire/**/*'
60
+ $required.sort.should == %w[
61
+ tmp_dir_for_acquire/bar.rb
62
+ tmp_dir_for_acquire/baz.so
63
+ tmp_dir_for_acquire/foo.rb
64
+ tmp_dir_for_acquire/sub/baz.rb]
65
+ end
66
+
67
+ it 'should accept multiple arguments' do
68
+ Ramaze::acquire 'tmp_dir_for_acquire/*', 'tmp_dir_for_acquire/sub/*'
69
+ $required.sort.should == %w[
70
+ tmp_dir_for_acquire/bar.rb
71
+ tmp_dir_for_acquire/baz.so
72
+ tmp_dir_for_acquire/foo.rb
73
+ tmp_dir_for_acquire/sub/baz.rb]
74
+ end
75
+
76
+ FileUtils.rm_rf('tmp_dir_for_acquire')
77
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manveru-ramaze
3
3
  version: !ruby/object:Gem::Version
4
- version: "2008.10"
4
+ version: "2008.12"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael 'manveru' Fellinger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-15 00:00:00 -08:00
12
+ date: 2008-12-22 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -264,6 +264,7 @@ files:
264
264
  - examples/basic/hello.rb
265
265
  - examples/basic/layout.rb
266
266
  - examples/basic/linking.rb
267
+ - examples/basic/partial.rb
267
268
  - examples/basic/simple.rb
268
269
  - examples/helpers
269
270
  - examples/helpers/cache.rb
@@ -352,14 +353,12 @@ files:
352
353
  - lib/ramaze/adapter/webrick.rb
353
354
  - lib/ramaze/cache
354
355
  - lib/ramaze/cache.rb
356
+ - lib/ramaze/cache/file.rb
355
357
  - lib/ramaze/cache/memcached.rb
356
358
  - lib/ramaze/cache/memory.rb
357
359
  - lib/ramaze/cache/yaml_store.rb
358
360
  - lib/ramaze/contrib
359
361
  - lib/ramaze/contrib.rb
360
- - lib/ramaze/contrib/auto_params
361
- - lib/ramaze/contrib/auto_params.rb
362
- - lib/ramaze/contrib/auto_params/get_args.rb
363
362
  - lib/ramaze/contrib/email.rb
364
363
  - lib/ramaze/contrib/facebook
365
364
  - lib/ramaze/contrib/facebook.rb
@@ -452,6 +451,8 @@ files:
452
451
  - lib/ramaze/option/holder.rb
453
452
  - lib/ramaze/option/merger.rb
454
453
  - lib/ramaze/reloader.rb
454
+ - lib/ramaze/reloader/watch_inotify.rb
455
+ - lib/ramaze/reloader/watch_stat.rb
455
456
  - lib/ramaze/route.rb
456
457
  - lib/ramaze/setup.rb
457
458
  - lib/ramaze/snippets
@@ -482,6 +483,7 @@ files:
482
483
  - lib/ramaze/snippets/proc
483
484
  - lib/ramaze/snippets/proc/locals.rb
484
485
  - lib/ramaze/snippets/ramaze
486
+ - lib/ramaze/snippets/ramaze/acquire.rb
485
487
  - lib/ramaze/snippets/ramaze/caller_info.rb
486
488
  - lib/ramaze/snippets/ramaze/caller_lines.rb
487
489
  - lib/ramaze/snippets/ramaze/deprecated.rb
@@ -562,7 +564,6 @@ files:
562
564
  - ramaze.gemspec
563
565
  - spec
564
566
  - spec/contrib
565
- - spec/contrib/auto_params.rb
566
567
  - spec/contrib/profiling.rb
567
568
  - spec/contrib/sequel
568
569
  - spec/contrib/sequel/fill.rb
@@ -765,7 +766,6 @@ files:
765
766
  - spec/snippets/array/put_within.rb
766
767
  - spec/snippets/binding
767
768
  - spec/snippets/binding/locals.rb
768
- - spec/snippets/divide.rb
769
769
  - spec/snippets/kernel
770
770
  - spec/snippets/kernel/constant.rb
771
771
  - spec/snippets/numeric
@@ -773,9 +773,9 @@ files:
773
773
  - spec/snippets/numeric/time.rb
774
774
  - spec/snippets/object
775
775
  - spec/snippets/object/__dir__.rb
776
- - spec/snippets/object/acquire.rb
777
776
  - spec/snippets/ordered_set.rb
778
777
  - spec/snippets/ramaze
778
+ - spec/snippets/ramaze/acquire.rb
779
779
  - spec/snippets/ramaze/caller_info.rb
780
780
  - spec/snippets/ramaze/caller_lines.rb
781
781
  - spec/snippets/string