utopia 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +17 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +8 -0
  4. data/README.md +72 -0
  5. data/Rakefile +9 -0
  6. data/bin/utopia +42 -13
  7. data/lib/utopia/extensions/array.rb +19 -3
  8. data/lib/utopia/extensions/date.rb +19 -3
  9. data/lib/utopia/extensions/hash.rb +19 -3
  10. data/lib/utopia/extensions/maybe.rb +19 -0
  11. data/lib/utopia/extensions/rack.rb +21 -3
  12. data/lib/utopia/extensions/regexp.rb +19 -3
  13. data/lib/utopia/extensions/string.rb +19 -3
  14. data/lib/utopia/http.rb +56 -0
  15. data/lib/utopia/link.rb +19 -3
  16. data/lib/utopia/middleware/all.rb +19 -3
  17. data/lib/utopia/middleware/content/node.rb +21 -5
  18. data/lib/utopia/middleware/content/processor.rb +118 -0
  19. data/lib/utopia/middleware/content.rb +22 -7
  20. data/lib/utopia/middleware/controller.rb +19 -7
  21. data/lib/utopia/middleware/directory_index.rb +19 -3
  22. data/lib/utopia/middleware/localization/name.rb +19 -3
  23. data/lib/utopia/middleware/localization.rb +19 -3
  24. data/lib/utopia/middleware/logger.rb +19 -3
  25. data/lib/utopia/middleware/redirector.rb +19 -5
  26. data/lib/utopia/middleware/requester.rb +19 -3
  27. data/lib/utopia/middleware/static.rb +20 -6
  28. data/lib/utopia/middleware.rb +22 -5
  29. data/lib/utopia/path.rb +26 -6
  30. data/lib/utopia/session/encrypted_cookie.rb +19 -3
  31. data/lib/utopia/setup/Gemfile +8 -0
  32. data/lib/utopia/setup/config.ru +4 -13
  33. data/lib/utopia/setup.rb +25 -4
  34. data/lib/utopia/tag.rb +45 -24
  35. data/lib/utopia/tags/all.rb +19 -3
  36. data/lib/utopia/tags/deferred.rb +19 -3
  37. data/lib/utopia/tags/environment.rb +29 -0
  38. data/lib/utopia/tags/node.rb +19 -3
  39. data/lib/utopia/tags/override.rb +19 -3
  40. data/lib/utopia/tags.rb +19 -3
  41. data/lib/utopia/time_store.rb +19 -3
  42. data/lib/utopia/version.rb +20 -10
  43. data/lib/utopia.rb +20 -17
  44. data/test/content_root/_heading.xnode +1 -0
  45. data/test/content_root/index.xnode +1 -0
  46. data/test/test_content_middleware.rb +86 -0
  47. data/test/test_path.rb +32 -0
  48. data/utopia.gemspec +31 -0
  49. metadata +56 -42
  50. data/ext/utopia/xnode/fast_scanner/extconf.rb +0 -6
  51. data/ext/utopia/xnode/fast_scanner/parser.c +0 -289
  52. data/lib/utopia/http_status_codes.rb +0 -39
  53. data/lib/utopia/middleware/benchmark.rb +0 -29
  54. data/lib/utopia/middleware/filter.rb +0 -35
  55. data/lib/utopia/tags/env.rb +0 -13
  56. data/lib/utopia/tags/fortune.rb +0 -9
  57. data/lib/utopia/tags/gallery.rb +0 -275
  58. data/lib/utopia/tags/google_analytics.rb +0 -21
  59. data/lib/utopia/trenni.rb +0 -149
  60. data/lib/utopia/xnode/processor.rb +0 -86
  61. data/lib/utopia/xnode/scanner.rb +0 -159
  62. data/lib/utopia/xnode.rb +0 -6
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  require 'pathname'
6
22
 
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  require 'utopia/tags'
6
22
 
@@ -0,0 +1,29 @@
1
+ # Copyright, 2012, 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/tags'
22
+
23
+ Utopia::Tags.create("env") do |transaction, state|
24
+ only = state[:only].split(",").collect(&:to_sym) rescue []
25
+
26
+ if defined?(UTOPIA_ENV) && only.include?(UTOPIA_ENV)
27
+ transaction.parse_xml(state.content)
28
+ end
29
+ end
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  require 'utopia/tags'
6
22
 
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  require 'utopia/tags'
6
22
 
data/lib/utopia/tags.rb CHANGED
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  module Utopia
6
22
  module Tags
@@ -1,6 +1,22 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  require 'set'
6
22
  require 'csv'
@@ -1,13 +1,23 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- # Copyright 2010 Samuel Williams. All rights reserved.
3
- # See <utopia.rb> for licensing details.
1
+ # Copyright, 2012, 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.
4
20
 
5
21
  module Utopia
6
- module VERSION
7
- MAJOR = 0
8
- MINOR = 10
9
- TINY = 0
10
-
11
- STRING = [MAJOR, MINOR, TINY].join('.')
12
- end
22
+ VERSION = "0.11.0"
13
23
  end
data/lib/utopia.rb CHANGED
@@ -1,21 +1,24 @@
1
- # This file is part of the "Utopia Framework" project, and is released under the MIT license.
2
- #
3
- # Copyright 2010 Samuel Williams. All rights reserved.
4
- #
5
- # For more information, please see http://www.oriontransfer.co.nz/software/utopia
6
- #
7
- # This program is free software: you can redistribute it and/or modify it under the terms
8
- # of the GNU Affero General Public License as published by the Free Software Foundation,
9
- # either version 3 of the License, or (at your option) any later version.
10
- #
11
- # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12
- # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- # See the GNU General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License along with this
16
- # program. If not, see <http://www.gnu.org/licenses/>.
1
+ # Copyright, 2012, 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.
17
20
 
18
21
  require 'utopia/version'
19
22
 
20
23
  module Utopia
21
- end
24
+ end
@@ -0,0 +1 @@
1
+ <h1><content /></h1>
@@ -0,0 +1 @@
1
+ <heading>Hello World</heading>
@@ -0,0 +1,86 @@
1
+ # Copyright, 2012, 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 'test/unit'
22
+ require 'rack/mock'
23
+ require 'utopia/middleware/content'
24
+
25
+ class TestContentMiddleware < Test::Unit::TestCase
26
+ APP = lambda {|env| [404, [], []]}
27
+
28
+ class TestDelegate
29
+ def initialize
30
+ @events = []
31
+ end
32
+
33
+ attr :events
34
+
35
+ def method_missing(*args)
36
+ @events << args
37
+ end
38
+ end
39
+
40
+ def test_processor_events_single_tag
41
+ delegate = TestDelegate.new
42
+ processor = Utopia::Middleware::Content::Processor.new(delegate)
43
+
44
+ processor.parse %Q{<foo></foo>}
45
+
46
+ foo_tag = Utopia::Tag.new("foo")
47
+ expected_events = [
48
+ [:tag_begin, foo_tag],
49
+ [:tag_end, foo_tag],
50
+ ]
51
+
52
+ assert_equal expected_events, delegate.events
53
+ end
54
+
55
+ def test_processor_events_text
56
+ delegate = TestDelegate.new
57
+ processor = Utopia::Middleware::Content::Processor.new(delegate)
58
+
59
+ processor.parse %Q{<foo>Bob &amp; Barley<!-- Comment --><![CDATA[Hello & World]]></foo>}
60
+
61
+ foo_tag = Utopia::Tag.new("foo")
62
+ expected_events = [
63
+ [:tag_begin, foo_tag],
64
+ [:cdata, "Bob &amp; Barley"],
65
+ [:cdata, "<!-- Comment -->"],
66
+ [:cdata, "Hello &amp; World"],
67
+ [:tag_end, foo_tag],
68
+ ]
69
+
70
+ assert_equal expected_events, delegate.events
71
+ end
72
+
73
+ def test_content_xnode
74
+ root = File.expand_path("../content_root", __FILE__)
75
+ content = Utopia::Middleware::Content.new(APP, :root => root)
76
+
77
+ path = Utopia::Path.create('/index')
78
+ node = content.lookup_node(path)
79
+ assert_equal Utopia::Middleware::Content::Node, node.class
80
+
81
+ output = StringIO.new
82
+ node.process!({}, output, {})
83
+ assert_equal %Q{<h1>Hello World</h1>}, output.string
84
+ end
85
+ end
86
+
data/test/test_path.rb ADDED
@@ -0,0 +1,32 @@
1
+ # Copyright, 2012, 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 'test/unit'
22
+ require 'utopia/path'
23
+
24
+ class TestPath < Test::Unit::TestCase
25
+ def test_absolute_path_concatenation
26
+ root = Utopia::Path["/"]
27
+
28
+ assert root.absolute?
29
+ assert_equal Utopia::Path["/foo/bar"], (root + Utopia::Path["foo/bar"])
30
+ end
31
+ end
32
+
data/utopia.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'utopia/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "utopia"
8
+ gem.version = Utopia::VERSION
9
+ gem.authors = ["Samuel Williams"]
10
+ gem.email = ["samuel.williams@oriontransfer.co.nz"]
11
+ gem.description = <<-EOF
12
+ Utopia is a website generation framework which provides a robust set of tools
13
+ to build highly complex dynamic websites. It uses the filesystem heavily for
14
+ content and provides frameworks for interacting with files and directories as
15
+ structure representing the website.
16
+ EOF
17
+ gem.summary = %q{Utopia is a framework for building dynamic content-driven websites.}
18
+ gem.homepage = ""
19
+
20
+ gem.files = `git ls-files`.split($/)
21
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
22
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
+ gem.require_paths = ["lib"]
24
+
25
+ gem.add_dependency "trenni", "~> 1.2.0"
26
+ gem.add_dependency "mime-types"
27
+ gem.add_dependency "rack", "~> 1.4.1"
28
+
29
+ gem.add_dependency "rack-cache"
30
+ gem.add_dependency "rack-contrib"
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,26 +9,26 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-31 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: mime-types
15
+ name: trenni
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.2.0
30
30
  - !ruby/object:Gem::Dependency
31
- name: rack
31
+ name: mime-types
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
@@ -44,23 +44,23 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: rack-cache
47
+ name: rack
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 1.4.1
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 1.4.1
62
62
  - !ruby/object:Gem::Dependency
63
- name: rack-contrib
63
+ name: rack-cache
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -76,7 +76,7 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: rmagick
79
+ name: rack-contrib
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -91,15 +91,24 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
- description:
95
- email: samuel.williams@oriontransfer.co.nz
94
+ description: ! " Utopia is a website generation framework which provides a robust
95
+ set of tools\n to build highly complex dynamic websites. It uses the filesystem
96
+ heavily for\n content and provides frameworks for interacting with files and directories
97
+ as\n structure representing the website.\n"
98
+ email:
99
+ - samuel.williams@oriontransfer.co.nz
96
100
  executables:
97
101
  - utopia
98
102
  extensions: []
99
103
  extra_rdoc_files: []
100
104
  files:
101
- - ext/utopia/xnode/fast_scanner/extconf.rb
102
- - ext/utopia/xnode/fast_scanner/parser.c
105
+ - .gitignore
106
+ - .travis.yml
107
+ - Gemfile
108
+ - README.md
109
+ - Rakefile
110
+ - bin/utopia
111
+ - lib/utopia.rb
103
112
  - lib/utopia/extensions/array.rb
104
113
  - lib/utopia/extensions/date.rb
105
114
  - lib/utopia/extensions/hash.rb
@@ -107,24 +116,25 @@ files:
107
116
  - lib/utopia/extensions/rack.rb
108
117
  - lib/utopia/extensions/regexp.rb
109
118
  - lib/utopia/extensions/string.rb
110
- - lib/utopia/http_status_codes.rb
119
+ - lib/utopia/http.rb
111
120
  - lib/utopia/link.rb
121
+ - lib/utopia/middleware.rb
112
122
  - lib/utopia/middleware/all.rb
113
- - lib/utopia/middleware/benchmark.rb
114
- - lib/utopia/middleware/content/node.rb
115
123
  - lib/utopia/middleware/content.rb
124
+ - lib/utopia/middleware/content/node.rb
125
+ - lib/utopia/middleware/content/processor.rb
116
126
  - lib/utopia/middleware/controller.rb
117
127
  - lib/utopia/middleware/directory_index.rb
118
- - lib/utopia/middleware/filter.rb
119
- - lib/utopia/middleware/localization/name.rb
120
128
  - lib/utopia/middleware/localization.rb
129
+ - lib/utopia/middleware/localization/name.rb
121
130
  - lib/utopia/middleware/logger.rb
122
131
  - lib/utopia/middleware/redirector.rb
123
132
  - lib/utopia/middleware/requester.rb
124
133
  - lib/utopia/middleware/static.rb
125
- - lib/utopia/middleware.rb
126
134
  - lib/utopia/path.rb
127
135
  - lib/utopia/session/encrypted_cookie.rb
136
+ - lib/utopia/setup.rb
137
+ - lib/utopia/setup/Gemfile
128
138
  - lib/utopia/setup/access_log/readme.txt
129
139
  - lib/utopia/setup/cache/head/readme.txt
130
140
  - lib/utopia/setup/cache/meta/readme.txt
@@ -140,26 +150,21 @@ files:
140
150
  - lib/utopia/setup/pages/links.yaml
141
151
  - lib/utopia/setup/pages/welcome/index.xnode
142
152
  - lib/utopia/setup/public/readme.txt
143
- - lib/utopia/setup.rb
144
153
  - lib/utopia/tag.rb
154
+ - lib/utopia/tags.rb
145
155
  - lib/utopia/tags/all.rb
146
156
  - lib/utopia/tags/deferred.rb
147
- - lib/utopia/tags/env.rb
148
- - lib/utopia/tags/fortune.rb
149
- - lib/utopia/tags/gallery.rb
150
- - lib/utopia/tags/google_analytics.rb
157
+ - lib/utopia/tags/environment.rb
151
158
  - lib/utopia/tags/node.rb
152
159
  - lib/utopia/tags/override.rb
153
- - lib/utopia/tags.rb
154
160
  - lib/utopia/time_store.rb
155
- - lib/utopia/trenni.rb
156
161
  - lib/utopia/version.rb
157
- - lib/utopia/xnode/processor.rb
158
- - lib/utopia/xnode/scanner.rb
159
- - lib/utopia/xnode.rb
160
- - lib/utopia.rb
161
- - bin/utopia
162
- homepage: http://www.oriontransfer.co.nz/software/utopia
162
+ - test/content_root/_heading.xnode
163
+ - test/content_root/index.xnode
164
+ - test/test_content_middleware.rb
165
+ - test/test_path.rb
166
+ - utopia.gemspec
167
+ homepage: ''
163
168
  licenses: []
164
169
  post_install_message:
165
170
  rdoc_options: []
@@ -171,17 +176,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
176
  - - ! '>='
172
177
  - !ruby/object:Gem::Version
173
178
  version: '0'
179
+ segments:
180
+ - 0
181
+ hash: -589344342576482024
174
182
  required_rubygems_version: !ruby/object:Gem::Requirement
175
183
  none: false
176
184
  requirements:
177
185
  - - ! '>='
178
186
  - !ruby/object:Gem::Version
179
187
  version: '0'
188
+ segments:
189
+ - 0
190
+ hash: -589344342576482024
180
191
  requirements: []
181
192
  rubyforge_project:
182
- rubygems_version: 1.8.23
193
+ rubygems_version: 1.8.24
183
194
  signing_key:
184
195
  specification_version: 3
185
- summary: Utopia is a framework for building websites.
186
- test_files: []
187
- has_rdoc:
196
+ summary: Utopia is a framework for building dynamic content-driven websites.
197
+ test_files:
198
+ - test/content_root/_heading.xnode
199
+ - test/content_root/index.xnode
200
+ - test/test_content_middleware.rb
201
+ - test/test_path.rb
@@ -1,6 +0,0 @@
1
-
2
- require 'mkmf'
3
-
4
- dir_config('fast_scanner')
5
-
6
- create_makefile("fast_scanner")