utopia 2.11.1 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/benchmarks/call_vs_check.rb +2 -0
- data/benchmarks/const_vs_hash.rb +2 -0
- data/benchmarks/hash_vs_openstruct.rb +2 -0
- data/benchmarks/string_vs_symbol.rb +2 -0
- data/benchmarks/struct_vs_class.rb +2 -0
- data/documentation/Gemfile +1 -0
- data/documentation/Rakefile +1 -0
- data/documentation/config.ru +1 -0
- data/documentation/config/environment.rb +1 -0
- data/documentation/pages/wiki/controller.rb +1 -0
- data/documentation/spec/website_context.rb +1 -0
- data/documentation/spec/website_spec.rb +1 -0
- data/lib/utopia.rb +2 -0
- data/lib/utopia/command.rb +2 -0
- data/lib/utopia/command/environment.rb +2 -0
- data/lib/utopia/command/server.rb +2 -0
- data/lib/utopia/command/site.rb +2 -0
- data/lib/utopia/content.rb +10 -1
- data/lib/utopia/content/document.rb +2 -0
- data/lib/utopia/content/link.rb +2 -0
- data/lib/utopia/content/links.rb +160 -124
- data/lib/utopia/content/markup.rb +2 -0
- data/lib/utopia/content/namespace.rb +2 -0
- data/lib/utopia/content/node.rb +6 -3
- data/lib/utopia/content/response.rb +2 -0
- data/lib/utopia/content/tags.rb +2 -0
- data/lib/utopia/content_length.rb +2 -0
- data/lib/utopia/controller.rb +2 -0
- data/lib/utopia/controller/actions.rb +2 -0
- data/lib/utopia/controller/base.rb +2 -0
- data/lib/utopia/controller/respond.rb +2 -0
- data/lib/utopia/controller/rewrite.rb +2 -0
- data/lib/utopia/controller/variables.rb +2 -0
- data/lib/utopia/exceptions.rb +2 -0
- data/lib/utopia/exceptions/handler.rb +2 -0
- data/lib/utopia/exceptions/mailer.rb +2 -0
- data/lib/utopia/extensions/array_split.rb +2 -0
- data/lib/utopia/extensions/date_comparisons.rb +2 -0
- data/lib/utopia/http.rb +2 -0
- data/lib/utopia/locale.rb +2 -0
- data/lib/utopia/localization.rb +2 -0
- data/lib/utopia/logger.rb +2 -0
- data/lib/utopia/middleware.rb +2 -0
- data/lib/utopia/path.rb +2 -0
- data/lib/utopia/path/matcher.rb +2 -0
- data/lib/utopia/redirection.rb +2 -0
- data/lib/utopia/session.rb +2 -0
- data/lib/utopia/session/lazy_hash.rb +2 -0
- data/lib/utopia/session/serialization.rb +2 -0
- data/lib/utopia/setup.rb +2 -0
- data/lib/utopia/static.rb +2 -0
- data/lib/utopia/static/local_file.rb +2 -0
- data/lib/utopia/static/mime_types.rb +2 -0
- data/lib/utopia/version.rb +3 -1
- data/setup/site/Gemfile +1 -0
- data/setup/site/Rakefile +1 -0
- data/setup/site/config.ru +1 -0
- data/setup/site/config/environment.rb +1 -0
- data/setup/site/falcon.rb +1 -0
- data/setup/site/spec/spec_helper.rb +1 -0
- data/setup/site/spec/website_context.rb +1 -0
- data/setup/site/spec/website_spec.rb +1 -0
- data/setup/site/tasks/deploy.rake +1 -0
- data/setup/site/tasks/development.rake +1 -0
- data/setup/site/tasks/environment.rake +1 -0
- data/setup/site/tasks/log.rake +1 -0
- data/setup/site/tasks/static.rake +1 -0
- data/setup/site/tasks/yarn.rake +1 -0
- data/spec/mock_node.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/utopia/command_spec.rb +2 -0
- data/spec/utopia/content/document_spec.rb +2 -0
- data/spec/utopia/content/link_spec.rb +1 -0
- data/spec/utopia/content/links_spec.rb +21 -21
- data/spec/utopia/content/markup_spec.rb +1 -0
- data/spec/utopia/content/namespace_spec.rb +2 -0
- data/spec/utopia/content/node_spec.rb +2 -0
- data/spec/utopia/content/response_spec.rb +2 -0
- data/spec/utopia/content/tags_spec.rb +2 -0
- data/spec/utopia/content_spec.rb +2 -0
- data/spec/utopia/content_spec.ru +1 -0
- data/spec/utopia/controller/actions_spec.rb +1 -0
- data/spec/utopia/controller/middleware_spec.rb +1 -0
- data/spec/utopia/controller/middleware_spec.ru +1 -0
- data/spec/utopia/controller/middleware_spec/controller/controller.rb +1 -0
- data/spec/utopia/controller/middleware_spec/controller/nested/controller.rb +1 -0
- data/spec/utopia/controller/middleware_spec/redirect/controller.rb +1 -0
- data/spec/utopia/controller/middleware_spec/redirect/test/controller.rb +1 -0
- data/spec/utopia/controller/respond_spec.rb +1 -0
- data/spec/utopia/controller/respond_spec.ru +1 -0
- data/spec/utopia/controller/respond_spec/api/controller.rb +1 -0
- data/spec/utopia/controller/respond_spec/errors/controller.rb +1 -0
- data/spec/utopia/controller/respond_spec/html/controller.rb +1 -0
- data/spec/utopia/controller/respond_spec/rewrite/controller.rb +1 -0
- data/spec/utopia/controller/rewrite_spec.rb +1 -0
- data/spec/utopia/controller/sequence_spec.rb +2 -1
- data/spec/utopia/controller/variables_spec.rb +1 -0
- data/spec/utopia/controller/websocket_spec.rb +1 -0
- data/spec/utopia/controller/websocket_spec.ru +1 -0
- data/spec/utopia/controller/websocket_spec/server/controller.rb +1 -0
- data/spec/utopia/exceptions/handler_spec.rb +1 -0
- data/spec/utopia/exceptions/handler_spec.ru +1 -0
- data/spec/utopia/exceptions/handler_spec/controller.rb +1 -0
- data/spec/utopia/exceptions/mailer_spec.rb +1 -0
- data/spec/utopia/exceptions/mailer_spec.ru +1 -0
- data/spec/utopia/extensions_spec.rb +2 -0
- data/spec/utopia/http/status_spec.rb +2 -0
- data/spec/utopia/locale_spec.rb +2 -0
- data/spec/utopia/localization_spec.rb +2 -0
- data/spec/utopia/localization_spec.ru +1 -0
- data/spec/utopia/localization_spec/controller.rb +1 -0
- data/spec/utopia/middleware_spec.rb +2 -0
- data/spec/utopia/path/matcher_spec.rb +1 -0
- data/spec/utopia/path_spec.rb +1 -0
- data/spec/utopia/performance_spec.rb +2 -0
- data/spec/utopia/performance_spec/config.ru +1 -0
- data/spec/utopia/performance_spec/pages/api/controller.rb +1 -0
- data/spec/utopia/rack_helper.rb +2 -0
- data/spec/utopia/redirection_spec.rb +2 -0
- data/spec/utopia/redirection_spec.ru +1 -0
- data/spec/utopia/session_spec.rb +2 -0
- data/spec/utopia/session_spec.ru +1 -0
- data/spec/utopia/setup_spec.rb +2 -0
- data/spec/utopia/static_spec.rb +2 -0
- data/spec/utopia/static_spec.ru +1 -0
- metadata +2 -2
data/lib/utopia/content/node.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -79,7 +81,8 @@ module Utopia
|
|
79
81
|
|
80
82
|
def links(path = '.', **options, &block)
|
81
83
|
path = uri_path.dirname + Path[path]
|
82
|
-
|
84
|
+
|
85
|
+
links = @controller.links(path, **options)
|
83
86
|
|
84
87
|
if block_given?
|
85
88
|
links.each(&block)
|
@@ -91,7 +94,7 @@ module Utopia
|
|
91
94
|
def related_links
|
92
95
|
name = @uri_path.basename
|
93
96
|
|
94
|
-
return
|
97
|
+
return @controller.links(@uri_path.dirname, :name => @uri_path.basename, :indices => true)
|
95
98
|
end
|
96
99
|
|
97
100
|
def siblings_path
|
@@ -103,7 +106,7 @@ module Utopia
|
|
103
106
|
end
|
104
107
|
|
105
108
|
def sibling_links(**options)
|
106
|
-
return
|
109
|
+
return @controller.links(siblings_path, **options)
|
107
110
|
end
|
108
111
|
|
109
112
|
# Lookup the given tag which is being rendered within the given node. Invoked by {Document}.
|
data/lib/utopia/content/tags.rb
CHANGED
data/lib/utopia/controller.rb
CHANGED
data/lib/utopia/exceptions.rb
CHANGED
data/lib/utopia/http.rb
CHANGED
data/lib/utopia/locale.rb
CHANGED
data/lib/utopia/localization.rb
CHANGED
data/lib/utopia/logger.rb
CHANGED
data/lib/utopia/middleware.rb
CHANGED
data/lib/utopia/path.rb
CHANGED
data/lib/utopia/path/matcher.rb
CHANGED
data/lib/utopia/redirection.rb
CHANGED
data/lib/utopia/session.rb
CHANGED
data/lib/utopia/setup.rb
CHANGED
data/lib/utopia/static.rb
CHANGED
data/lib/utopia/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -19,5 +21,5 @@
|
|
19
21
|
# THE SOFTWARE.
|
20
22
|
|
21
23
|
module Utopia
|
22
|
-
VERSION = "2.
|
24
|
+
VERSION = "2.12.0"
|
23
25
|
end
|
data/setup/site/Gemfile
CHANGED
data/setup/site/Rakefile
CHANGED
data/setup/site/config.ru
CHANGED
data/setup/site/falcon.rb
CHANGED
data/setup/site/tasks/log.rake
CHANGED
data/setup/site/tasks/yarn.rake
CHANGED
data/spec/mock_node.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/utopia/command_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
5
|
#
|
@@ -23,6 +24,9 @@
|
|
23
24
|
require 'utopia/content/links'
|
24
25
|
|
25
26
|
RSpec.describe Utopia::Content::Links do
|
27
|
+
let(:root) {File.expand_path("links", __dir__)}
|
28
|
+
subject {described_class.new(root)}
|
29
|
+
|
26
30
|
describe 'INDEX_XNODE_FILTER' do
|
27
31
|
subject{Utopia::Content::Links::INDEX_XNODE_FILTER}
|
28
32
|
|
@@ -36,13 +40,13 @@ RSpec.describe Utopia::Content::Links do
|
|
36
40
|
end
|
37
41
|
|
38
42
|
it "should not match partial strings" do
|
39
|
-
links =
|
43
|
+
links = subject.index(Utopia::Path.create("/"), name: "come")
|
40
44
|
|
41
45
|
expect(links).to be_empty
|
42
46
|
end
|
43
47
|
|
44
48
|
it "should give a list of links" do
|
45
|
-
links =
|
49
|
+
links = subject.index(Utopia::Path.create("/"))
|
46
50
|
|
47
51
|
expect(links.size).to be == 3
|
48
52
|
|
@@ -65,37 +69,33 @@ RSpec.describe Utopia::Content::Links do
|
|
65
69
|
end
|
66
70
|
|
67
71
|
it "should filter links by name" do
|
68
|
-
links =
|
72
|
+
links = subject.index(Utopia::Path.create("/"), name: /foo/)
|
69
73
|
|
70
74
|
expect(links.size).to be == 1
|
71
75
|
end
|
72
76
|
|
73
77
|
it "should select localized links" do
|
74
|
-
root = File.expand_path("links", __dir__)
|
75
|
-
|
76
78
|
# Select both test links
|
77
|
-
links =
|
79
|
+
links = subject.index(Utopia::Path.create("/foo"))
|
78
80
|
expect(links.size).to be == 2
|
79
81
|
|
80
|
-
links =
|
82
|
+
links = subject.index(Utopia::Path.create("/foo"), locale: 'en')
|
81
83
|
expect(links.size).to be == 1
|
82
84
|
end
|
83
85
|
|
84
|
-
|
85
|
-
root
|
86
|
-
|
87
|
-
# Select both test links
|
88
|
-
links = Utopia::Content::Links.index(root, Utopia::Path.create("/"), locale: 'en')
|
89
|
-
|
90
|
-
expect(links.collect(&:title)).to be == ['One', 'Two', 'Three', 'Four', 'Five']
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should read correct link order for zh" do
|
94
|
-
root = File.expand_path("localized", __dir__)
|
86
|
+
context 'localized links' do
|
87
|
+
let(:root) {File.expand_path("localized", __dir__)}
|
95
88
|
|
96
|
-
|
97
|
-
|
89
|
+
it "should read correct link order for en" do
|
90
|
+
links = subject.index(Utopia::Path.create("/"), locale: 'en')
|
91
|
+
|
92
|
+
expect(links.collect(&:title)).to be == ['One', 'Two', 'Three', 'Four', 'Five']
|
93
|
+
end
|
98
94
|
|
99
|
-
|
95
|
+
it "should read correct link order for zh" do
|
96
|
+
links = subject.index(Utopia::Path.create("/"), locale: 'zh')
|
97
|
+
|
98
|
+
expect(links.collect(&:title)).to be == ['One', 'Two', 'Three', '四']
|
99
|
+
end
|
100
100
|
end
|
101
101
|
end
|