Pistos-ramaze 2008.09 → 2008.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) 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/rapaste/view/view.xhtml +3 -0
  6. data/examples/app/todolist/spec/todolist.rb +1 -1
  7. data/examples/app/whywiki/spec/whywiki.rb +1 -1
  8. data/examples/app/wikore/spec/wikore.rb +1 -1
  9. data/examples/app/wikore/src/model.rb +1 -1
  10. data/examples/app/wiktacular/spec/wiktacular.rb +1 -1
  11. data/examples/app/wiktacular/src/model.rb +1 -1
  12. data/examples/basic/partial.rb +28 -0
  13. data/examples/helpers/httpdigest.rb +68 -10
  14. data/examples/misc/ramaise.rb +2 -2
  15. data/examples/templates/template_amrita2.rb +1 -1
  16. data/examples/templates/template_erubis.rb +1 -1
  17. data/examples/templates/template_ezamar.rb +1 -1
  18. data/examples/templates/template_haml.rb +2 -2
  19. data/examples/templates/template_liquid.rb +1 -1
  20. data/examples/templates/template_markaby.rb +2 -2
  21. data/examples/templates/template_nagoro.rb +1 -1
  22. data/examples/templates/template_redcloth.rb +1 -1
  23. data/examples/templates/template_remarkably.rb +2 -2
  24. data/examples/templates/template_tenjin.rb +1 -1
  25. data/examples/templates/template_xslt.rb +1 -1
  26. data/lib/proto/controller/init.rb +2 -1
  27. data/lib/proto/model/init.rb +3 -3
  28. data/lib/proto/public/dispatch.fcgi +2 -2
  29. data/lib/proto/spec/main.rb +3 -3
  30. data/lib/proto/start.rb +4 -0
  31. data/lib/ramaze/action/render.rb +6 -5
  32. data/lib/ramaze/action.rb +7 -1
  33. data/lib/ramaze/cache/file.rb +71 -0
  34. data/lib/ramaze/cache.rb +1 -0
  35. data/lib/ramaze/contrib/email.rb +2 -0
  36. data/lib/ramaze/contrib/facebook.rb +2 -2
  37. data/lib/ramaze/contrib/file_cache.rb +2 -64
  38. data/lib/ramaze/contrib/sequel/image.rb +1 -1
  39. data/lib/ramaze/contrib.rb +1 -1
  40. data/lib/ramaze/controller/resolve.rb +8 -3
  41. data/lib/ramaze/controller.rb +9 -1
  42. data/lib/ramaze/current/request.rb +85 -68
  43. data/lib/ramaze/current/session/hash.rb +7 -11
  44. data/lib/ramaze/current/session.rb +3 -5
  45. data/lib/ramaze/dispatcher/action.rb +2 -0
  46. data/lib/ramaze/dispatcher/file.rb +6 -1
  47. data/lib/ramaze/helper/aspect.rb +2 -2
  48. data/lib/ramaze/helper/form.rb +5 -2
  49. data/lib/ramaze/helper/formatting.rb +4 -0
  50. data/lib/ramaze/helper/gravatar.rb +18 -1
  51. data/lib/ramaze/helper/httpdigest.rb +57 -28
  52. data/lib/ramaze/helper/maruku.rb +2 -0
  53. data/lib/ramaze/helper/paginate.rb +2 -3
  54. data/lib/ramaze/helper/partial.rb +1 -1
  55. data/lib/ramaze/helper/redirect.rb +22 -4
  56. data/lib/ramaze/helper/user.rb +4 -4
  57. data/lib/ramaze/helper.rb +12 -4
  58. data/lib/ramaze/log/rotatinginformer.rb +168 -0
  59. data/lib/ramaze/option/holder.rb +3 -3
  60. data/lib/ramaze/option.rb +1 -1
  61. data/lib/ramaze/reloader/watch_inotify.rb +85 -0
  62. data/lib/ramaze/reloader/watch_stat.rb +58 -0
  63. data/lib/ramaze/reloader.rb +25 -41
  64. data/lib/ramaze/snippets/divide.rb +2 -0
  65. data/lib/ramaze/snippets/numeric/time.rb +1 -1
  66. data/lib/ramaze/snippets/object/__dir__.rb +3 -3
  67. data/lib/ramaze/snippets/object/acquire.rb +3 -6
  68. data/lib/ramaze/snippets/ramaze/acquire.rb +31 -0
  69. data/lib/ramaze/snippets/ramaze/deprecated.rb +2 -1
  70. data/lib/ramaze/spec/helper/mock_http.rb +6 -5
  71. data/lib/ramaze/template/ezamar/render_partial.rb +8 -0
  72. data/lib/ramaze/tool/mime.rb +1 -1
  73. data/lib/ramaze/tool/project_creator.rb +2 -1
  74. data/lib/ramaze/version.rb +1 -1
  75. data/lib/ramaze.rb +6 -0
  76. data/rake_tasks/coverage.rake +4 -5
  77. data/rake_tasks/spec.rake +6 -6
  78. data/ramaze.gemspec +769 -756
  79. data/spec/contrib/profiling.rb +2 -2
  80. data/spec/ramaze/action/file_cache.rb +1 -1
  81. data/spec/ramaze/action/layout.rb +1 -1
  82. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  83. data/spec/ramaze/controller/resolve.rb +1 -1
  84. data/spec/ramaze/controller/template_resolving.rb +1 -1
  85. data/spec/ramaze/dispatcher/directory.rb +3 -3
  86. data/spec/ramaze/helper/aspect.rb +1 -1
  87. data/spec/ramaze/helper/partial.rb +1 -1
  88. data/spec/ramaze/localize.rb +1 -1
  89. data/spec/ramaze/rewrite.rb +1 -1
  90. data/spec/ramaze/template/amrita2.rb +1 -1
  91. data/spec/ramaze/template/erubis.rb +1 -1
  92. data/spec/ramaze/template/ezamar.rb +1 -1
  93. data/spec/ramaze/template/haml.rb +2 -2
  94. data/spec/ramaze/template/nagoro.rb +1 -1
  95. data/spec/ramaze/template/redcloth.rb +1 -1
  96. data/spec/ramaze/template/sass.rb +1 -1
  97. data/spec/ramaze/template/tenjin.rb +1 -1
  98. data/spec/ramaze/template.rb +3 -3
  99. data/spec/snippets/object/__dir__.rb +6 -0
  100. data/spec/snippets/{object → ramaze}/acquire.rb +24 -18
  101. metadata +15 -12
  102. data/lib/ramaze/contrib/auto_params/get_args.rb +0 -58
  103. data/lib/ramaze/contrib/auto_params.rb +0 -135
  104. data/spec/contrib/auto_params.rb +0 -121
  105. data/spec/snippets/divide.rb +0 -19
@@ -15,14 +15,14 @@ Ramaze::Log.loggers << Ramaze::Logger::Informer.new(output)
15
15
 
16
16
  describe 'Profiling' do
17
17
  behaves_like "http"
18
- ramaze :public_root => __DIR__/:public
18
+ ramaze :public_root => __DIR__(:public)
19
19
 
20
20
  it "should profile" do
21
21
  output = StringIO.new
22
22
  Ramaze::Log.loggers << Ramaze::Logger::Informer.new(output)
23
23
 
24
24
  get('/')
25
- output.string.should =~ /Thread ID:\s\d+/
25
+ output.string.should =~ /Thread ID:\s-?\d+/
26
26
  output.string.should =~ /Total:/
27
27
  output.string.should =~ /self\s+total\s+self\s+wait\s+child\s+call/
28
28
  end
@@ -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
@@ -1,11 +1,17 @@
1
1
  require 'lib/ramaze/spec/helper/snippets'
2
2
  require 'fileutils'
3
3
 
4
- describe 'acquire' do
5
- def require(name)
6
- @required << name
4
+
5
+ # Mock require to only record attempts
6
+ $required = []
7
+
8
+ module Ramaze
9
+ def self.require(name)
10
+ $required << name
7
11
  end
12
+ end
8
13
 
14
+ describe 'Ramaze::acquire' do
9
15
  before do
10
16
  dir = 'tmp_dir_for_acquire'
11
17
  FileUtils.mkdir_p(dir + '/sub')
@@ -15,43 +21,43 @@ describe 'acquire' do
15
21
  FileUtils.touch("#{dir}/#{path}")
16
22
  end
17
23
 
18
- @required = []
24
+ $required = []
19
25
  end
20
26
 
21
27
  it 'should not load a single file' do
22
- acquire 'tmp_dir_for_acquire/foo'
23
- @required.should == []
28
+ Ramaze::acquire 'tmp_dir_for_acquire/foo'
29
+ $required.should == []
24
30
  end
25
31
 
26
32
  it 'should load dir' do
27
- acquire 'tmp_dir_for_acquire/sub/*'
28
- @required.should == %w[
33
+ Ramaze::acquire 'tmp_dir_for_acquire/sub/*'
34
+ $required.should == %w[
29
35
  tmp_dir_for_acquire/sub/baz.rb]
30
36
  end
31
37
 
32
38
  it 'should be aliased to acquire' do
33
- acquire 'tmp_dir_for_acquire/sub/*'
34
- @required.should.not.be.empty
39
+ Ramaze::acquire 'tmp_dir_for_acquire/sub/*'
40
+ $required.should.not.be.empty
35
41
  end
36
42
 
37
43
  it 'should load {so,rb}, not others' do
38
- acquire 'tmp_dir_for_acquire/*'
39
- @required.sort.should == %w[
44
+ Ramaze::acquire 'tmp_dir_for_acquire/*'
45
+ $required.sort.should == %w[
40
46
  tmp_dir_for_acquire/bar.rb
41
47
  tmp_dir_for_acquire/baz.so
42
48
  tmp_dir_for_acquire/foo.rb]
43
49
  end
44
50
 
45
51
  it 'should use globbing' do
46
- acquire 'tmp_dir_for_acquire/ba*'
47
- @required.sort.should == %w[
52
+ Ramaze::acquire 'tmp_dir_for_acquire/ba*'
53
+ $required.sort.should == %w[
48
54
  tmp_dir_for_acquire/bar.rb
49
55
  tmp_dir_for_acquire/baz.so]
50
56
  end
51
57
 
52
58
  it 'should use recursive globbing' do
53
- acquire 'tmp_dir_for_acquire/**/*'
54
- @required.sort.should == %w[
59
+ Ramaze::acquire 'tmp_dir_for_acquire/**/*'
60
+ $required.sort.should == %w[
55
61
  tmp_dir_for_acquire/bar.rb
56
62
  tmp_dir_for_acquire/baz.so
57
63
  tmp_dir_for_acquire/foo.rb
@@ -59,8 +65,8 @@ describe 'acquire' do
59
65
  end
60
66
 
61
67
  it 'should accept multiple arguments' do
62
- acquire 'tmp_dir_for_acquire/*', 'tmp_dir_for_acquire/sub/*'
63
- @required.sort.should == %w[
68
+ Ramaze::acquire 'tmp_dir_for_acquire/*', 'tmp_dir_for_acquire/sub/*'
69
+ $required.sort.should == %w[
64
70
  tmp_dir_for_acquire/bar.rb
65
71
  tmp_dir_for_acquire/baz.so
66
72
  tmp_dir_for_acquire/foo.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Pistos-ramaze
3
3
  version: !ruby/object:Gem::Version
4
- version: "2008.09"
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-10-09 00:00:00 -07: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
@@ -443,6 +442,7 @@ files:
443
442
  - lib/ramaze/log/knotify.rb
444
443
  - lib/ramaze/log/logger.rb
445
444
  - lib/ramaze/log/logging.rb
445
+ - lib/ramaze/log/rotatinginformer.rb
446
446
  - lib/ramaze/log/syslog.rb
447
447
  - lib/ramaze/log/xosd.rb
448
448
  - lib/ramaze/option
@@ -451,6 +451,8 @@ files:
451
451
  - lib/ramaze/option/holder.rb
452
452
  - lib/ramaze/option/merger.rb
453
453
  - lib/ramaze/reloader.rb
454
+ - lib/ramaze/reloader/watch_inotify.rb
455
+ - lib/ramaze/reloader/watch_stat.rb
454
456
  - lib/ramaze/route.rb
455
457
  - lib/ramaze/setup.rb
456
458
  - lib/ramaze/snippets
@@ -481,6 +483,7 @@ files:
481
483
  - lib/ramaze/snippets/proc
482
484
  - lib/ramaze/snippets/proc/locals.rb
483
485
  - lib/ramaze/snippets/ramaze
486
+ - lib/ramaze/snippets/ramaze/acquire.rb
484
487
  - lib/ramaze/snippets/ramaze/caller_info.rb
485
488
  - lib/ramaze/snippets/ramaze/caller_lines.rb
486
489
  - lib/ramaze/snippets/ramaze/deprecated.rb
@@ -561,7 +564,6 @@ files:
561
564
  - ramaze.gemspec
562
565
  - spec
563
566
  - spec/contrib
564
- - spec/contrib/auto_params.rb
565
567
  - spec/contrib/profiling.rb
566
568
  - spec/contrib/sequel
567
569
  - spec/contrib/sequel/fill.rb
@@ -764,7 +766,6 @@ files:
764
766
  - spec/snippets/array/put_within.rb
765
767
  - spec/snippets/binding
766
768
  - spec/snippets/binding/locals.rb
767
- - spec/snippets/divide.rb
768
769
  - spec/snippets/kernel
769
770
  - spec/snippets/kernel/constant.rb
770
771
  - spec/snippets/numeric
@@ -772,9 +773,9 @@ files:
772
773
  - spec/snippets/numeric/time.rb
773
774
  - spec/snippets/object
774
775
  - spec/snippets/object/__dir__.rb
775
- - spec/snippets/object/acquire.rb
776
776
  - spec/snippets/ordered_set.rb
777
777
  - spec/snippets/ramaze
778
+ - spec/snippets/ramaze/acquire.rb
778
779
  - spec/snippets/ramaze/caller_info.rb
779
780
  - spec/snippets/ramaze/caller_lines.rb
780
781
  - spec/snippets/string
@@ -787,13 +788,15 @@ files:
787
788
  has_rdoc: true
788
789
  homepage: http://ramaze.rubyforge.org
789
790
  post_install_message: |-
791
+
790
792
  ============================================================
791
793
 
792
794
  Thank you for installing Ramaze!
793
- You can now do following:
795
+ The main website is http://ramaze.net .
794
796
 
795
- * Create a new project using the `ramaze' command:
796
- ramaze --create yourproject
797
+ Feel free to ask questions in our IRC channel:
798
+ irc.freenode.net #ramaze
799
+ http://mibbit.com/?server=irc.freenode.net&channel=%23ramaze
797
800
 
798
801
  ============================================================
799
802
  rdoc_options: []
@@ -814,7 +817,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
814
817
  version:
815
818
  requirements: []
816
819
 
817
- rubyforge_project:
820
+ rubyforge_project: ramaze
818
821
  rubygems_version: 1.2.0
819
822
  signing_key:
820
823
  specification_version: 2
@@ -1,58 +0,0 @@
1
- # from merb/core_ext/get_args.rb
2
- begin
3
- require 'parse_tree'
4
- require 'ruby2ruby'
5
-
6
- class ParseTreeArray < Array
7
- def self.translate(*args)
8
- self.new(ParseTree.translate(*args))
9
- end
10
-
11
- def deep_array_node(type = nil)
12
- each do |node|
13
- return ParseTreeArray.new(node) if node.is_a?(Array) && (!type || node[0] == type)
14
- next unless node.is_a?(Array)
15
- return ParseTreeArray.new(node).deep_array_node(type)
16
- end
17
- nil
18
- end
19
-
20
- def arg_nodes
21
- self[1..-1].inject([]) do |sum,item|
22
- sum << [item] unless item.is_a?(Array)
23
- sum
24
- end
25
- end
26
-
27
- def get_args
28
- arg_node = deep_array_node(:args)
29
- return nil unless arg_node
30
- args = arg_node.arg_nodes
31
- default_node = arg_node.deep_array_node(:block)
32
- return args unless default_node
33
- lasgns = default_node[1..-1]
34
- lasgns.each do |asgn|
35
- args.assoc(asgn[1]) << eval(RubyToRuby.new.process(asgn[2]))
36
- end
37
- args
38
- end
39
-
40
- end
41
-
42
- module GetArgs
43
- def get_args
44
- klass, meth = self.to_s.split(/ /).to_a[1][0..-2].split("#")
45
- klass = $` if klass =~ /\(/
46
- ParseTreeArray.translate(Object.const_get(klass), meth).get_args
47
- end
48
- end
49
-
50
- class UnboundMethod
51
- include GetArgs
52
- end
53
-
54
- class Method
55
- include GetArgs
56
- end
57
- rescue LoadError
58
- end
@@ -1,135 +0,0 @@
1
- # auto_params.rb
2
- #
3
- # AutoParams implements action parameterization ala merb 0.4 and Nitro
4
- # using ruby2ruby and ParseTree
5
- #
6
- # Usage:
7
- #
8
- # Ramaze.contrib :auto_params
9
- #
10
- # Then, for example,
11
- #
12
- # def search(query) end
13
- #
14
- # can be accessed via
15
- #
16
- # - /search?query=findthis, which calls search('findthis')
17
- # - /search/findthis search('findthis')
18
- # - /search/findthis?query=andthis search(['findthis', 'andthis'])
19
- #
20
- # For more examples, take a look at spec/contrib/auto_params.rb
21
- #
22
- # Note: A simpler alternative for similar functionality would be:
23
- #
24
- # def search(query = request['query']) end
25
- #
26
-
27
- require __DIR__/:auto_params/:get_args
28
-
29
- module Ramaze
30
-
31
- module Contrib
32
- class AutoParams
33
- def self.startup
34
- Ramaze::Cache.add :args
35
- end
36
- end
37
- end
38
-
39
- class Action
40
-
41
- # with parameterization, params may include
42
- # arrays: /num?n=1&n=2 becomes [['1','2']] for def num(n) end
43
- # nil: /calc?w=10&d=2 becomes ['10', nil, '2'] for def calc(w, h, d) end
44
-
45
- def params=(*par)
46
- par = *par
47
- self[:params] = par.map{ |pa|
48
- case pa
49
- when Array
50
- pa.map{|p| Rack::Utils.unescape(p)}
51
- when nil
52
- nil
53
- else
54
- Rack::Utils.unescape(pa)
55
- end
56
- } unless par.nil?
57
- self[:params] ||= []
58
- end
59
-
60
- end
61
-
62
- class Controller
63
-
64
- # ignore cache when request.params is interesting
65
-
66
- def self.cached(path)
67
- if found = Cache.resolved[path]
68
- if found.respond_to?(:relaxed_hash)
69
-
70
- # don't use cache if we need to add request.params entries to the Action
71
- if args = Cache.args[found.method]
72
- param_keys = request.params.keys
73
- return nil if args.find{|k,v| param_keys.include?(k.to_s) }
74
- end
75
-
76
- return found.dup
77
- else
78
- Log.warn("Found faulty `#{path}' in Cache.resolved, deleting it for sanity.")
79
- Cache.resolved.delete path
80
- end
81
- end
82
-
83
- nil
84
- end
85
-
86
- # use Method#get_args to insert values from request.params into Action#params
87
-
88
- def self.resolve_method(name, *params)
89
- if method = [ name, name.gsub('__','/') ].find{|n|
90
- cached_action_methods.include?(n) }
91
- meth = instance_method(method)
92
- arity = meth.arity
93
-
94
- if meth.respond_to? :get_args
95
- unless args = Cache.args[name]
96
- if args = meth.get_args
97
- args = args.select{|e| e.to_s !~ /^\*/}
98
- else
99
- args = []
100
- end
101
- Cache.args[name] = args
102
- end
103
-
104
- param_keys = request.params.keys
105
-
106
- # if there are missing args, or keys in request.params that match expected args
107
- if args.size > params.size or args.find{|k,v| param_keys.include?(k.to_s) }
108
- args.each_with_index do |(name, val), i|
109
- r_params = request.params[name.to_s]
110
- if params[i] and r_params and r_params.size > 0
111
- params[i] = [params[i], r_params].flatten
112
- else
113
- params[i] ||= r_params
114
- end
115
- end
116
-
117
- # strip trailing nils so default argument values are used
118
- params.reverse.each{|e| if e.nil? then params.pop else break end }
119
- end
120
-
121
- argity = args.select{|e| e.size==1}.size..args.size
122
- else
123
- argity = arity..arity
124
- end
125
-
126
- if arity < 0 or argity.include? params.size
127
- return method, params
128
- end
129
- end
130
- return nil, []
131
- end
132
-
133
- end
134
-
135
- end