utopia 1.9.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +3 -2
  3. data/.gitignore +4 -1
  4. data/.rspec +1 -0
  5. data/.travis.yml +4 -0
  6. data/.yardopts +2 -0
  7. data/Gemfile +8 -1
  8. data/README.md +2 -2
  9. data/Rakefile +10 -10
  10. data/benchmarks/call_vs_check.rb +36 -0
  11. data/benchmarks/const_vs_hash.rb +33 -0
  12. data/documentation/Gemfile +5 -0
  13. data/documentation/Guardfile +20 -0
  14. data/documentation/config.ru +6 -13
  15. data/documentation/config/puma.rb +20 -0
  16. data/documentation/pages/_editor.xnode +64 -0
  17. data/documentation/pages/_heading.xnode +2 -2
  18. data/documentation/pages/_page.xnode +1 -2
  19. data/documentation/pages/errors/exception.xnode +3 -3
  20. data/documentation/pages/errors/file-not-found.xnode +3 -3
  21. data/documentation/pages/wiki/bower-integration/content.md +1 -1
  22. data/documentation/pages/wiki/content.md +6 -8
  23. data/documentation/pages/wiki/controller.rb +3 -3
  24. data/documentation/pages/wiki/edit.xnode +7 -19
  25. data/documentation/pages/wiki/middleware/content/content.md +4 -10
  26. data/documentation/pages/wiki/{controller → middleware/controller}/actions/content.md +0 -0
  27. data/documentation/pages/wiki/{controller → middleware/controller}/links.yaml +0 -0
  28. data/documentation/pages/wiki/{controller → middleware/controller}/rewrite/content.md +3 -3
  29. data/documentation/pages/wiki/show.xnode +4 -6
  30. data/documentation/pages/wiki/updating-utopia/content.md +55 -0
  31. data/documentation/pages/wiki/your-first-page/content.md +5 -3
  32. data/documentation/public/materials +1 -0
  33. data/lib/utopia.rb +3 -4
  34. data/lib/utopia/command.rb +4 -284
  35. data/lib/utopia/command/server.rb +115 -0
  36. data/lib/utopia/command/setup.rb +78 -0
  37. data/lib/utopia/command/site.rb +183 -0
  38. data/lib/utopia/content.rb +83 -59
  39. data/lib/utopia/content/{transaction.rb → document.rb} +116 -110
  40. data/lib/utopia/content/link.rb +7 -2
  41. data/lib/utopia/content/links.rb +2 -1
  42. data/lib/utopia/content/markup.rb +7 -2
  43. data/lib/utopia/{tags/deferred.rb → content/namespace.rb} +25 -6
  44. data/lib/utopia/content/node.rb +74 -76
  45. data/lib/utopia/content/response.rb +22 -3
  46. data/lib/utopia/content/tags.rb +66 -0
  47. data/lib/utopia/controller.rb +10 -18
  48. data/lib/utopia/controller/actions.rb +10 -0
  49. data/lib/utopia/controller/base.rb +2 -1
  50. data/lib/utopia/controller/respond.rb +1 -1
  51. data/lib/utopia/controller/rewrite.rb +8 -4
  52. data/lib/utopia/exceptions.rb +1 -0
  53. data/lib/utopia/exceptions/handler.rb +7 -2
  54. data/lib/utopia/exceptions/mailer.rb +33 -12
  55. data/lib/utopia/{tags/node.rb → extensions/array_split.rb} +11 -9
  56. data/lib/utopia/{tags/environment.rb → extensions/date_comparisons.rb} +24 -14
  57. data/lib/utopia/http.rb +2 -0
  58. data/lib/utopia/locale.rb +1 -0
  59. data/lib/utopia/localization.rb +37 -28
  60. data/lib/utopia/logger.rb +1 -0
  61. data/lib/utopia/logger/compact_formatter.rb +1 -0
  62. data/lib/utopia/middleware.rb +11 -1
  63. data/lib/utopia/path.rb +1 -0
  64. data/lib/utopia/path/matcher.rb +14 -2
  65. data/lib/utopia/redirection.rb +13 -16
  66. data/lib/utopia/session.rb +14 -6
  67. data/lib/utopia/setup.rb +3 -1
  68. data/lib/utopia/static.rb +11 -12
  69. data/lib/utopia/version.rb +1 -1
  70. data/setup/server/git/hooks/post-receive +0 -4
  71. data/setup/site/.gitignore +9 -0
  72. data/setup/site/.rspec +1 -0
  73. data/setup/site/Gemfile +4 -0
  74. data/setup/site/Guardfile +17 -0
  75. data/setup/site/Rakefile +2 -2
  76. data/setup/site/config.ru +5 -12
  77. data/setup/site/pages/_heading.xnode +2 -2
  78. data/setup/site/pages/_page.xnode +1 -1
  79. data/setup/site/pages/errors/exception.xnode +3 -3
  80. data/setup/site/pages/errors/file-not-found.xnode +3 -3
  81. data/setup/site/pages/welcome/index.xnode +3 -3
  82. data/setup/site/public/_static/site.css +4 -0
  83. data/setup/site/spec/spec_helper.rb +29 -0
  84. data/setup/site/tasks/deploy.rake +13 -0
  85. data/setup/site/tasks/development.rake +34 -0
  86. data/setup/site/tasks/environment.rake +17 -0
  87. data/spec/mock_node.rb +15 -0
  88. data/spec/spec_helper.rb +29 -0
  89. data/{lib/utopia/extensions/date.rb → spec/utopia/content/document_spec.rb} +31 -21
  90. data/spec/utopia/content/markup_spec.rb +2 -2
  91. data/spec/utopia/content/{tag_spec.rb → namespace_spec.rb} +17 -10
  92. data/spec/utopia/content/tags_spec.rb +80 -0
  93. data/spec/utopia/content_spec.rb +1 -1
  94. data/spec/utopia/content_spec.ru +1 -6
  95. data/spec/utopia/content_spec/_heading.xnode +1 -1
  96. data/spec/utopia/content_spec/content/test-partial.xnode +1 -1
  97. data/spec/utopia/content_spec/index.xnode +1 -1
  98. data/spec/utopia/controller/middleware_spec.ru +1 -3
  99. data/spec/utopia/controller/respond_spec.rb +2 -22
  100. data/spec/utopia/controller/respond_spec.ru +1 -5
  101. data/spec/utopia/controller/respond_spec/errors/file-not-found.xnode +7 -6
  102. data/spec/utopia/exceptions/handler_spec.ru +1 -2
  103. data/spec/utopia/exceptions/mailer_spec.ru +1 -2
  104. data/spec/utopia/extensions_spec.rb +2 -2
  105. data/spec/utopia/localization_spec.ru +1 -2
  106. data/spec/utopia/performance_spec.rb +2 -6
  107. data/spec/utopia/performance_spec/config.ru +5 -12
  108. data/spec/utopia/performance_spec/pages/_heading.xnode +2 -2
  109. data/spec/utopia/performance_spec/pages/_page.xnode +1 -1
  110. data/spec/utopia/performance_spec/pages/errors/exception.xnode +3 -3
  111. data/spec/utopia/performance_spec/pages/errors/file-not-found.xnode +3 -3
  112. data/spec/utopia/performance_spec/pages/welcome/index.xnode +3 -3
  113. data/spec/utopia/setup_spec.rb +79 -15
  114. data/utopia.gemspec +3 -3
  115. metadata +41 -27
  116. data/.simplecov +0 -9
  117. data/documentation/pages/welcome/index.xnode +0 -41
  118. data/lib/utopia/content/tag.rb +0 -90
  119. data/lib/utopia/extensions/array.rb +0 -29
  120. data/lib/utopia/tags/override.rb +0 -33
  121. data/setup/site/.simplecov +0 -9
  122. data/setup/site/tasks/test.rake +0 -10
  123. data/setup/site/tasks/utopia.rake +0 -41
  124. data/spec/utopia/controller/respond_spec/rewrite/controller.rb +0 -12
@@ -0,0 +1,17 @@
1
+
2
+ desc 'Set up the environment for running your web application'
3
+ task :environment do
4
+ require_relative '../config/environment'
5
+
6
+ # We ensure this is part of the shell environment so if other commands are invoked they will work correctly.
7
+ ENV['RACK_ENV'] = RACK_ENV.to_s if defined?(RACK_ENV)
8
+ ENV['DATABASE_ENV'] = DATABASE_ENV.to_s if defined?(DATABASE_ENV)
9
+
10
+ # This generates a consistent session secret if one was not already provided:
11
+ if ENV['UTOPIA_SESSION_SECRET'].nil?
12
+ require 'securerandom'
13
+
14
+ warn 'Generating transient session key for development...'
15
+ ENV['UTOPIA_SESSION_SECRET'] = SecureRandom.hex(32)
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+
2
+ class MockNode
3
+ def initialize(namespaces = {}, &block)
4
+ @namespaces = namespaces
5
+ define_singleton_method(:call, block)
6
+ end
7
+
8
+ def lookup_tag(tag)
9
+ namespace, name = Trenni::Tag.split(tag.name)
10
+
11
+ if library = @namespaces[namespace]
12
+ library.call(name, self)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,29 @@
1
+
2
+ if ENV['COVERAGE']
3
+ begin
4
+ require 'simplecov'
5
+
6
+ SimpleCov.start do
7
+ add_filter "/spec/"
8
+ end
9
+
10
+ if ENV['TRAVIS']
11
+ require 'coveralls'
12
+ Coveralls.wear!
13
+ end
14
+ rescue LoadError
15
+ warn "Could not load simplecov: #{$!}"
16
+ end
17
+ end
18
+
19
+ require "bundler/setup"
20
+ require "utopia"
21
+
22
+ RSpec.configure do |config|
23
+ # Enable flags like --only-failures and --next-failure
24
+ config.example_status_persistence_file_path = ".rspec_status"
25
+
26
+ config.expect_with :rspec do |c|
27
+ c.syntax = :expect
28
+ end
29
+ end
@@ -1,4 +1,4 @@
1
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
1
+ # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -18,31 +18,41 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- # These amendments allow for Date <=> DateTime <=> Time, and so on.
22
- # Use only if required. This implementation works for Ruby 1.9.2.
21
+ require 'utopia/content/document'
23
22
 
24
- require 'date'
25
-
26
- class Time
27
- alias_method :old_compare, :<=>
23
+ RSpec.describe Utopia::Content::Document do
24
+ subject{described_class.new(nil, {})}
28
25
 
29
- def <=>(other)
30
- if Date === other or DateTime === other
31
- self.to_datetime <=> other
32
- else
33
- old_compare(other)
26
+ it "should generate valid self-closing markup" do
27
+ node = proc do |document, state|
28
+ subject.tag("img", src: "cats.jpg")
34
29
  end
30
+
31
+ result = subject.render_node(node)
32
+
33
+ expect(result).to be == '<img src="cats.jpg"/>'
34
+ end
35
+
36
+ it "should generate valid nested markup" do
37
+ node = proc do |document, state|
38
+ subject.tag("div") do
39
+ subject.tag("img", src: "cats.jpg")
40
+ end
41
+ end
42
+
43
+ result = subject.render_node(node)
44
+
45
+ expect(result).to be == '<div><img src="cats.jpg"/></div>'
35
46
  end
36
- end
37
-
38
- class Date
39
- alias_method :old_compare, :<=>
40
47
 
41
- def <=>(other)
42
- if Time === other
43
- self.to_datetime <=> other.to_datetime
44
- else
45
- old_compare(other)
48
+ it "should fail if tags are unbalanced" do
49
+ node = proc do |document, state|
50
+ div = Utopia::Content::Tag.opened('div')
51
+ span = Utopia::Content::Tag.opened('span')
52
+ subject.tag_begin(div)
53
+ subject.tag_end(span)
46
54
  end
55
+
56
+ expect{subject.render_node(node)}.to raise_error Utopia::Content::UnbalancedTagError, /tag span/
47
57
  end
48
58
  end
@@ -37,9 +37,9 @@ module Utopia::Content::MarkupSpec
37
37
 
38
38
  describe Utopia::Content::MarkupParser do
39
39
  it "should format open tags correctly" do
40
- foo_tag = Utopia::Content::Tag.opened("foo", bar: nil, baz: 'bob')
40
+ foo_tag = Utopia::Content::Tag.opened("foo", bar: true, baz: 'bob')
41
41
 
42
- expect(foo_tag[:bar]).to be nil
42
+ expect(foo_tag[:bar]).to be == true
43
43
  expect(foo_tag[:baz]).to be == 'bob'
44
44
 
45
45
  expect(foo_tag.to_s('content')).to be == '<foo bar baz="bob">content</foo>'
@@ -1,4 +1,4 @@
1
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
1
+ # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -18,19 +18,26 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require 'utopia/content/tag'
21
+ require 'utopia/content/namespace'
22
22
 
23
- RSpec.describe Utopia::Content::Tag.new("body", false, 'class' => 'main') do
24
- it "should have name" do
25
- expect(subject.name).to be == "body"
23
+ RSpec.describe Utopia::Content::Namespace do
24
+ let(:tags) do
25
+ Module.new.tap do |mod|
26
+ mod.extend(Utopia::Content::Namespace)
27
+
28
+ mod.tag('foo') do |document, state|
29
+ end
30
+ end
26
31
  end
27
32
 
28
- it "should be open by default" do
29
- expect(subject).to_not be_self_closed
33
+ it "should freeze tags" do
34
+ tags.freeze
35
+
36
+ expect(tags).to be_frozen
37
+ expect(tags.named).to be_frozen
30
38
  end
31
39
 
32
- it "should have a attribute" do
33
- expect(subject.attributes).to include('class')
34
- expect(subject['class']).to be == 'main'
40
+ it "should have named tag" do
41
+ expect(tags.call('foo', nil)).to_not be_nil
35
42
  end
36
43
  end
@@ -0,0 +1,80 @@
1
+ # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'utopia/content/tags'
22
+ require 'utopia/content/document'
23
+
24
+ require 'mock_node'
25
+
26
+ RSpec.describe Utopia::Content::Tags do
27
+ let(:document) {Utopia::Content::Document.new(nil, {})}
28
+
29
+ describe '<utopia:environment>' do
30
+ let(:node) do
31
+ MockNode.new('utopia' => subject) do |document, state|
32
+ document.tag("utopia:environment", only: 'test') do
33
+ document.text("Hello World")
34
+ end
35
+
36
+ document.tag("utopia:environment", only: 'production') do
37
+ document.text("Goodbye World")
38
+ end
39
+ end
40
+ end
41
+
42
+ it "it should render correct content for test" do
43
+ document[:environment] = "test"
44
+
45
+ result = document.render_node(node)
46
+
47
+ expect(result).to be == 'Hello World'
48
+ end
49
+
50
+ it "it should render correct content for production" do
51
+ document[:environment] = "production"
52
+
53
+ result = document.render_node(node)
54
+
55
+ expect(result).to be == 'Goodbye World'
56
+ end
57
+ end
58
+
59
+ describe '<utopia:node>' do
60
+ let(:node) do
61
+ MockNode.new('utopia' => subject) do |document, state|
62
+ document.tag("utopia:node", path: 'test')
63
+ end
64
+ end
65
+
66
+ let(:test_node) do
67
+ MockNode.new do |document, state|
68
+ document.text("Test Node")
69
+ end
70
+ end
71
+
72
+ it "it should render correct content for test" do
73
+ expect(document).to receive(:lookup_node).with('test').and_return(test_node)
74
+
75
+ result = document.render_node(node)
76
+
77
+ expect(result).to be == 'Test Node'
78
+ end
79
+ end
80
+ end
@@ -73,7 +73,7 @@ module Utopia::ContentSpec
73
73
 
74
74
  describe Utopia::Content do
75
75
  let(:root) {File.expand_path('content_spec', __dir__)}
76
- let(:content) {Utopia::Content.new(lambda{}, root: root, cache_templates: true)}
76
+ let(:content) {Utopia::Content.new(lambda{}, root: root)}
77
77
 
78
78
  it "should parse file and expand variables" do
79
79
  path = Utopia::Path.create('/index')
@@ -1,10 +1,5 @@
1
1
 
2
- require 'utopia/tags/deferred'
3
-
4
2
  use Utopia::Content,
5
- root: File.expand_path('content_spec', __dir__),
6
- tags: {
7
- 'deferred' => Utopia::Tags::Deferred
8
- }
3
+ root: File.expand_path('content_spec', __dir__)
9
4
 
10
5
  run lambda {|env| [404, {}, []]}
@@ -1 +1 @@
1
- <h1><content /></h1>
1
+ <h1><utopia:content/></h1>
@@ -1 +1 @@
1
- #{partial 'show-value', value: 10}
1
+ #{partial 'content:show-value', value: 10}
@@ -1 +1 @@
1
- <heading>Hello World</heading>
1
+ <content:heading>Hello World</content:heading>
@@ -1,7 +1,5 @@
1
1
 
2
2
  use Utopia::Controller,
3
- root: File.expand_path('middleware_spec', __dir__),
4
- base: Utopia::Controller::Base,
5
- cache_controllers: true
3
+ root: File.expand_path('middleware_spec', __dir__)
6
4
 
7
5
  run lambda {|env| [404, {}, []]}
@@ -96,8 +96,8 @@ module Utopia::Controller::RespondSpec
96
96
  get '/errors/file-not-found'
97
97
 
98
98
  expect(last_response.status).to be == 200
99
- expect(last_response.headers['Content-Type']).to be == 'text/html'
100
- expect(last_response.body).to be_include "<heading>File Not Found</heading>"
99
+ expect(last_response.headers['Content-Type']).to include('text/html')
100
+ expect(last_response.body).to be_include "<h1>File Not Found</h1>"
101
101
  end
102
102
 
103
103
  it "should get json error response" do
@@ -138,25 +138,5 @@ module Utopia::Controller::RespondSpec
138
138
  expect(last_response.headers['Content-Type']).to be == 'application/json; charset=utf-8'
139
139
  expect(last_response.body).to be == '{}'
140
140
  end
141
-
142
- it "should give record as JSON" do
143
- header 'Accept', 'application/json'
144
-
145
- get '/rewrite/2/show'
146
-
147
- expect(last_response.status).to be == 200
148
- expect(last_response.headers['Content-Type']).to be == 'application/json; charset=utf-8'
149
- expect(last_response.body).to be == '{"id":2,"foo":"bar"}'
150
- end
151
-
152
- it "should give error as JSON" do
153
- header 'Accept', 'application/json'
154
-
155
- get '/rewrite/1/show'
156
-
157
- expect(last_response.status).to be == 404
158
- expect(last_response.headers['Content-Type']).to be == 'application/json; charset=utf-8'
159
- expect(last_response.body).to be == '{"message":"Could not find record"}'
160
- end
161
141
  end
162
142
  end
@@ -1,10 +1,6 @@
1
1
 
2
- use Utopia::Redirection::Errors,
3
- 404 => '/fail'
4
-
5
2
  use Utopia::Controller,
6
- root: File.expand_path('respond_spec', __dir__),
7
- base: Utopia::Controller::Base
3
+ root: File.expand_path('respond_spec', __dir__)
8
4
 
9
5
  use Utopia::Content,
10
6
  root: File.expand_path('respond_spec', __dir__)
@@ -1,7 +1,8 @@
1
- <page>
2
- <?r response.content_type = 'text/html' ?>
1
+ <html>
2
+ <head><title>Error</title></head>
3
+ <body>
4
+ <h1>File Not Found</h1>
3
5
 
4
- <heading>File Not Found</heading>
5
-
6
- <p>The file you requested is unfortunately not available at this time!</p>
7
- </page>
6
+ <p>The file you requested is unfortunately not available at this time!</p>
7
+ </body>
8
+ </html>
@@ -2,7 +2,6 @@
2
2
  use Utopia::Exceptions::Handler, '/exception'
3
3
 
4
4
  use Utopia::Controller,
5
- root: File.expand_path('handler_spec', __dir__),
6
- base: Utopia::Controller::Base
5
+ root: File.expand_path('handler_spec', __dir__)
7
6
 
8
7
  run lambda {|env| [404, {}, []]}
@@ -4,7 +4,6 @@ use Utopia::Exceptions::Mailer,
4
4
  from: 'test@localhost'
5
5
 
6
6
  use Utopia::Controller,
7
- root: File.expand_path('handler_spec', __dir__),
8
- base: Utopia::Controller::Base
7
+ root: File.expand_path('handler_spec', __dir__)
9
8
 
10
9
  run lambda {|env| [404, {}, []]}
@@ -18,8 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require 'utopia/extensions/array'
22
- require 'utopia/extensions/date'
21
+ require 'utopia/extensions/array_split'
22
+ require 'utopia/extensions/date_comparisons'
23
23
 
24
24
  module Utopia::ExtensionsSpec
25
25
  describe Array do
@@ -6,8 +6,7 @@ use Utopia::Localization,
6
6
  hosts: {/foobar\.com$/ => 'en', /foobar\.co\.jp$/ => 'ja', /foobar\.de$/ => 'de'}
7
7
 
8
8
  use Utopia::Controller,
9
- root: localization_spec_root,
10
- base: Utopia::Controller::Base
9
+ root: localization_spec_root
11
10
 
12
11
  use Utopia::Static,
13
12
  root: localization_spec_root
@@ -30,10 +30,6 @@ RSpec.describe "Utopia Performance" do
30
30
  if defined? Benchmark
31
31
  def benchmark(name = nil)
32
32
  Benchmark.ips do |benchmark|
33
- # Collect more data for benchmark:
34
- benchmark.time = 20
35
- benchmark.warmup = 10
36
-
37
33
  benchmark.report(name) do |i|
38
34
  yield i
39
35
  end
@@ -44,10 +40,10 @@ RSpec.describe "Utopia Performance" do
44
40
  elsif defined? RubyProf
45
41
  def benchmark(name)
46
42
  result = RubyProf.profile do
47
- yield 1000
43
+ yield 2000
48
44
  end
49
45
 
50
- result.eliminate_methods!([/^((?!Utopia).)*$/])
46
+ #result.eliminate_methods!([/^((?!Utopia|Trenni).)*$/])
51
47
  printer = RubyProf::FlatPrinter.new(result)
52
48
  printer.print($stderr, min_percent: 1.0)
53
49
 
@@ -3,7 +3,8 @@
3
3
  require 'utopia'
4
4
  require 'json'
5
5
 
6
- # use Rack::ContentLength
6
+ require 'rack/freeze'
7
+
7
8
  use Utopia::ContentLength
8
9
 
9
10
  use Utopia::Redirection::Rewrite,
@@ -17,24 +18,16 @@ use Utopia::Redirection::Errors,
17
18
  # use Utopia::Localization,
18
19
  # :default_locale => 'en',
19
20
  # :locales => ['en', 'de', 'ja', 'zh'],
20
- # :nonlocalized => ['/_static/', '/_cache/']
21
+ # :ignore => ['/_static/', '/_cache/']
21
22
 
22
23
  use Utopia::Controller,
23
- root: File.expand_path('pages', __dir__),
24
- base: Utopia::Controller::Base,
25
- cache_controllers: true
24
+ root: File.expand_path('pages', __dir__)
26
25
 
27
26
  use Utopia::Static,
28
27
  root: File.expand_path('pages', __dir__)
29
28
 
30
29
  # Serve dynamic content
31
30
  use Utopia::Content,
32
- root: File.expand_path('pages', __dir__),
33
- cache_templates: true,
34
- tags: {
35
- 'deferred' => Utopia::Tags::Deferred,
36
- 'override' => Utopia::Tags::Override,
37
- 'node' => Utopia::Tags::Node,
38
- }
31
+ root: File.expand_path('pages', __dir__)
39
32
 
40
33
  run lambda { |env| [404, {}, []] }