utopia 2.14.0 → 2.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bake/utopia/{yarn.rb → node.rb} +11 -5
- data/lib/utopia/command.rb +2 -2
- data/lib/utopia/command/site.rb +1 -1
- data/lib/utopia/content.rb +7 -5
- data/lib/utopia/content/markup.rb +1 -1
- data/lib/utopia/content/node.rb +2 -2
- data/lib/utopia/content/response.rb +3 -3
- data/lib/utopia/controller.rb +0 -17
- data/lib/utopia/controller/base.rb +27 -3
- data/lib/utopia/controller/respond.rb +50 -107
- data/lib/utopia/extensions/array_split.rb +2 -2
- data/lib/utopia/http.rb +3 -3
- data/lib/utopia/middleware.rb +2 -2
- data/lib/utopia/path.rb +13 -5
- data/lib/utopia/redirection.rb +0 -2
- data/lib/utopia/responder.rb +76 -0
- data/lib/utopia/version.rb +1 -1
- data/setup/site/.gitignore +8 -7
- metadata +71 -396
- data/.codeclimate.yml +0 -5
- data/.github/workflows/development.yml +0 -62
- data/.gitignore +0 -8
- data/.rspec +0 -4
- data/.yardopts +0 -2
- data/Gemfile +0 -28
- data/README.md +0 -90
- data/benchmark/call_vs_check.rb +0 -38
- data/benchmark/const_vs_hash.rb +0 -35
- data/benchmark/hash_vs_openstruct.rb +0 -54
- data/benchmark/string_vs_symbol.rb +0 -14
- data/benchmark/struct_vs_class.rb +0 -91
- data/docs/.nojekyll +0 -0
- data/docs/_components/jquery-litebox/jquery.litebox.css +0 -23
- data/docs/_components/jquery-litebox/jquery.litebox.gallery.css +0 -48
- data/docs/_components/jquery-litebox/jquery.litebox.js +0 -30
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +0 -12
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +0 -5
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +0 -8
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +0 -6
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +0 -4
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +0 -6
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.css.css +0 -14
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +0 -16
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.html.css +0 -5
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +0 -3
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +0 -2
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.python.css +0 -6
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +0 -2
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +0 -18
- data/docs/_components/jquery-syntax/base/jquery.syntax.core.css +0 -58
- data/docs/_components/jquery-syntax/base/jquery.syntax.editor.css +0 -6
- data/docs/_components/jquery-syntax/base/theme.js +0 -1
- data/docs/_components/jquery-syntax/bright/jquery.syntax.core.css +0 -27
- data/docs/_components/jquery-syntax/bright/theme.js +0 -1
- data/docs/_components/jquery-syntax/jquery.syntax.brush.apache.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.applescript.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.assembly.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.bash.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.basic.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.clang.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.csharp.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.css.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.diff.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.go.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.haskell.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.html.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.io.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.java.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.javascript.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.kai.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.lisp.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.lua.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.nginx.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ooc.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.pascal.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.perl5.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.php-script.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.php.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.plain.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.python.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ruby.js +0 -5
- data/docs/_components/jquery-syntax/jquery.syntax.brush.scala.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.sql.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.swift.js +0 -3
- data/docs/_components/jquery-syntax/jquery.syntax.brush.trenni.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.brush.xml.js +0 -4
- data/docs/_components/jquery-syntax/jquery.syntax.brush.yaml.js +0 -2
- data/docs/_components/jquery-syntax/jquery.syntax.cache.js +0 -7
- data/docs/_components/jquery-syntax/jquery.syntax.core.js +0 -34
- data/docs/_components/jquery-syntax/jquery.syntax.editor.js +0 -11
- data/docs/_components/jquery-syntax/jquery.syntax.js +0 -8
- data/docs/_components/jquery-syntax/jquery.syntax.min.js +0 -13
- data/docs/_components/jquery-syntax/paper/jquery.syntax.core.css +0 -31
- data/docs/_components/jquery-syntax/paper/theme.js +0 -1
- data/docs/_components/jquery/jquery.js +0 -10872
- data/docs/_components/jquery/jquery.min.js +0 -2
- data/docs/_components/jquery/jquery.min.map +0 -1
- data/docs/_components/jquery/jquery.slim.js +0 -8777
- data/docs/_components/jquery/jquery.slim.min.js +0 -2
- data/docs/_components/jquery/jquery.slim.min.map +0 -1
- data/docs/_static/icon.png +0 -0
- data/docs/_static/site.css +0 -191
- data/docs/development-environment-setup/index.html +0 -54
- data/docs/faq/what-is-xnode/index.html +0 -73
- data/docs/index.html +0 -86
- data/docs/javascript/index.html +0 -108
- data/docs/middleware/content/index.html +0 -58
- data/docs/middleware/controller/actions/index.html +0 -111
- data/docs/middleware/controller/index.html +0 -98
- data/docs/middleware/controller/rewrite/index.html +0 -105
- data/docs/middleware/localization/index.html +0 -53
- data/docs/middleware/redirection/index.html +0 -55
- data/docs/middleware/session/index.html +0 -65
- data/docs/middleware/static/index.html +0 -51
- data/docs/server-setup/index.html +0 -87
- data/docs/testing/index.html +0 -53
- data/docs/updating-utopia/index.html +0 -102
- data/docs/your-first-page/index.html +0 -74
- data/materials/utopia.png +0 -0
- data/materials/utopia.svg +0 -1
- data/setup/site/.yarnrc +0 -1
- data/spec/mock_node.rb +0 -16
- data/spec/spec_helper.rb +0 -13
- data/spec/utopia/command_spec.rb +0 -164
- data/spec/utopia/content/document_spec.rb +0 -60
- data/spec/utopia/content/links/bar/index.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/child/index.en.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/child/index.ja.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/links.yaml +0 -2
- data/spec/utopia/content/links/foo/index.xnode +0 -0
- data/spec/utopia/content/links/foo/links.yaml +0 -2
- data/spec/utopia/content/links/foo/test.de.xnode +0 -0
- data/spec/utopia/content/links/foo/test.en.xnode +0 -0
- data/spec/utopia/content/links/index.xnode +0 -0
- data/spec/utopia/content/links/links.yaml +0 -18
- data/spec/utopia/content/links/redirect/links.yaml +0 -2
- data/spec/utopia/content/links/welcome.xnode +0 -0
- data/spec/utopia/content/links_spec.rb +0 -218
- data/spec/utopia/content/localized/five/index.en.xnode +0 -0
- data/spec/utopia/content/localized/four/index.en.xnode +0 -0
- data/spec/utopia/content/localized/four/index.zh.xnode +0 -0
- data/spec/utopia/content/localized/four/links.yaml +0 -4
- data/spec/utopia/content/localized/links.yaml +0 -13
- data/spec/utopia/content/localized/one.xnode +0 -0
- data/spec/utopia/content/localized/three/index.xnode +0 -0
- data/spec/utopia/content/localized/two.en.xnode +0 -0
- data/spec/utopia/content/localized/two.zh.xnode +0 -0
- data/spec/utopia/content/markup_spec.rb +0 -96
- data/spec/utopia/content/namespace_spec.rb +0 -45
- data/spec/utopia/content/node/lookup/content.xnode +0 -1
- data/spec/utopia/content/node/lookup/index.xnode +0 -1
- data/spec/utopia/content/node/ordered/first.xnode +0 -0
- data/spec/utopia/content/node/ordered/index.xnode +0 -0
- data/spec/utopia/content/node/ordered/links.yaml +0 -4
- data/spec/utopia/content/node/ordered/second.xnode +0 -0
- data/spec/utopia/content/node/related/foo.en.xnode +0 -0
- data/spec/utopia/content/node/related/foo.ja.xnode +0 -0
- data/spec/utopia/content/node/related/links.yaml +0 -4
- data/spec/utopia/content/node_spec.rb +0 -97
- data/spec/utopia/content/response_spec.rb +0 -54
- data/spec/utopia/content/tags_spec.rb +0 -82
- data/spec/utopia/content_spec.rb +0 -100
- data/spec/utopia/content_spec.ru +0 -6
- data/spec/utopia/content_spec/_heading.xnode +0 -1
- data/spec/utopia/content_spec/content/_show-value.xnode +0 -1
- data/spec/utopia/content_spec/content/links.yaml +0 -2
- data/spec/utopia/content_spec/content/test-partial.xnode +0 -1
- data/spec/utopia/content_spec/index.xnode +0 -1
- data/spec/utopia/content_spec/node/index.xnode +0 -1
- data/spec/utopia/content_spec/test.xnode +0 -10
- data/spec/utopia/controller/actions_spec.rb +0 -62
- data/spec/utopia/controller/middleware_spec.rb +0 -88
- data/spec/utopia/controller/middleware_spec.ru +0 -6
- data/spec/utopia/controller/middleware_spec/controller/controller.rb +0 -27
- data/spec/utopia/controller/middleware_spec/controller/index.xnode +0 -1
- data/spec/utopia/controller/middleware_spec/controller/nested/controller.rb +0 -7
- data/spec/utopia/controller/middleware_spec/empty/controller.rb +0 -0
- data/spec/utopia/controller/middleware_spec/redirect/controller.rb +0 -12
- data/spec/utopia/controller/middleware_spec/redirect/test/controller.rb +0 -9
- data/spec/utopia/controller/respond_spec.rb +0 -174
- data/spec/utopia/controller/respond_spec.ru +0 -12
- data/spec/utopia/controller/respond_spec/api/controller.rb +0 -28
- data/spec/utopia/controller/respond_spec/errors/controller.rb +0 -14
- data/spec/utopia/controller/respond_spec/errors/file-not-found.xnode +0 -8
- data/spec/utopia/controller/respond_spec/html/controller.rb +0 -11
- data/spec/utopia/controller/respond_spec/rewrite/controller.rb +0 -13
- data/spec/utopia/controller/rewrite_spec.rb +0 -80
- data/spec/utopia/controller/sequence_spec.rb +0 -135
- data/spec/utopia/controller/variables_spec.rb +0 -59
- data/spec/utopia/controller/websocket_spec.rb +0 -68
- data/spec/utopia/controller/websocket_spec.ru +0 -5
- data/spec/utopia/controller/websocket_spec/server/controller.rb +0 -11
- data/spec/utopia/exceptions/handler_spec.rb +0 -47
- data/spec/utopia/exceptions/handler_spec.ru +0 -8
- data/spec/utopia/exceptions/handler_spec/controller.rb +0 -19
- data/spec/utopia/exceptions/mailer_spec.rb +0 -43
- data/spec/utopia/exceptions/mailer_spec.ru +0 -10
- data/spec/utopia/extensions_spec.rb +0 -73
- data/spec/utopia/http/status_spec.rb +0 -44
- data/spec/utopia/locale_spec.rb +0 -58
- data/spec/utopia/localization_spec.rb +0 -92
- data/spec/utopia/localization_spec.ru +0 -15
- data/spec/utopia/localization_spec/controller.rb +0 -21
- data/spec/utopia/localization_spec/localized.de.txt +0 -1
- data/spec/utopia/localization_spec/localized.en.txt +0 -1
- data/spec/utopia/localization_spec/localized.ja.txt +0 -1
- data/spec/utopia/localization_spec/test.txt +0 -1
- data/spec/utopia/middleware_spec.rb +0 -31
- data/spec/utopia/path/matcher_spec.rb +0 -66
- data/spec/utopia/path_spec.rb +0 -207
- data/spec/utopia/performance_spec.rb +0 -92
- data/spec/utopia/performance_spec/cache/head/readme.txt +0 -1
- data/spec/utopia/performance_spec/cache/meta/readme.txt +0 -1
- data/spec/utopia/performance_spec/config.ru +0 -35
- data/spec/utopia/performance_spec/lib/readme.txt +0 -1
- data/spec/utopia/performance_spec/pages/_heading.xnode +0 -2
- data/spec/utopia/performance_spec/pages/_page.xnode +0 -26
- data/spec/utopia/performance_spec/pages/api/controller.rb +0 -8
- data/spec/utopia/performance_spec/pages/errors/exception.xnode +0 -5
- data/spec/utopia/performance_spec/pages/errors/file-not-found.xnode +0 -5
- data/spec/utopia/performance_spec/pages/links.yaml +0 -2
- data/spec/utopia/performance_spec/pages/welcome/index.xnode +0 -17
- data/spec/utopia/rack_helper.rb +0 -32
- data/spec/utopia/redirection_spec.rb +0 -77
- data/spec/utopia/redirection_spec.ru +0 -27
- data/spec/utopia/session_spec.rb +0 -189
- data/spec/utopia/session_spec.ru +0 -24
- data/spec/utopia/setup_spec.rb +0 -56
- data/spec/utopia/static_spec.rb +0 -49
- data/spec/utopia/static_spec.ru +0 -5
- data/spec/utopia/static_spec/test.txt +0 -1
- data/utopia.gemspec +0 -52
- data/wiki/Gemfile +0 -9
- data/wiki/config.ru +0 -7
- data/wiki/pages/development-environment-setup/index.md +0 -16
- data/wiki/pages/faq/links.yaml +0 -2
- data/wiki/pages/faq/what-is-xnode/index.md +0 -37
- data/wiki/pages/faq/what-is-xnode/links.yaml +0 -2
- data/wiki/pages/index.md +0 -35
- data/wiki/pages/javascript/index.md +0 -77
- data/wiki/pages/javascript/links.yaml +0 -2
- data/wiki/pages/links.yaml +0 -2
- data/wiki/pages/middleware/content/index.md +0 -21
- data/wiki/pages/middleware/controller/actions/index.md +0 -76
- data/wiki/pages/middleware/controller/index.md +0 -62
- data/wiki/pages/middleware/controller/links.yaml +0 -4
- data/wiki/pages/middleware/controller/rewrite/index.md +0 -69
- data/wiki/pages/middleware/localization/index.md +0 -16
- data/wiki/pages/middleware/redirection/index.md +0 -17
- data/wiki/pages/middleware/session/index.md +0 -29
- data/wiki/pages/middleware/static/index.md +0 -13
- data/wiki/pages/server-setup/index.md +0 -52
- data/wiki/pages/testing/index.md +0 -15
- data/wiki/pages/updating-utopia/index.md +0 -63
- data/wiki/pages/your-first-page/index.md +0 -38
data/.codeclimate.yml
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
name: Development
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
runs-on: ${{matrix.os}}-latest
|
8
|
-
continue-on-error: ${{matrix.experimental}}
|
9
|
-
|
10
|
-
strategy:
|
11
|
-
matrix:
|
12
|
-
os:
|
13
|
-
- ubuntu
|
14
|
-
- macos
|
15
|
-
|
16
|
-
ruby:
|
17
|
-
- 2.5
|
18
|
-
- 2.6
|
19
|
-
- 2.7
|
20
|
-
|
21
|
-
experimental: [false]
|
22
|
-
env: [""]
|
23
|
-
|
24
|
-
include:
|
25
|
-
- os: ubuntu
|
26
|
-
ruby: truffleruby
|
27
|
-
experimental: true
|
28
|
-
env: JRUBY_OPTS="--debug -X+O"
|
29
|
-
- os: ubuntu
|
30
|
-
ruby: jruby
|
31
|
-
experimental: true
|
32
|
-
- os: ubuntu
|
33
|
-
ruby: head
|
34
|
-
experimental: true
|
35
|
-
- os: ubuntu
|
36
|
-
ruby: 2.6
|
37
|
-
experimental: false
|
38
|
-
env: COVERAGE=PartialSummary,Coveralls
|
39
|
-
|
40
|
-
steps:
|
41
|
-
- uses: actions/checkout@v1
|
42
|
-
- uses: ruby/setup-ruby@v1
|
43
|
-
with:
|
44
|
-
ruby-version: ${{matrix.ruby}}
|
45
|
-
|
46
|
-
- name: Install dependencies
|
47
|
-
run: ${{matrix.env}} bundle install
|
48
|
-
|
49
|
-
- name: Installing packages (ubuntu)
|
50
|
-
if: matrix.os == 'ubuntu'
|
51
|
-
run: sudo apt-get install wget
|
52
|
-
|
53
|
-
- name: Installing packages (macos)
|
54
|
-
if: matrix.os == 'macos'
|
55
|
-
run: brew install wget
|
56
|
-
|
57
|
-
- name: Run tests
|
58
|
-
timeout-minutes: 5
|
59
|
-
run: |
|
60
|
-
git config --global user.email "samuel@oriontransfer.net"
|
61
|
-
git config --global user.name "Samuel Williams"
|
62
|
-
${{matrix.env}} bundle exec rspec
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.yardopts
DELETED
data/Gemfile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in utopia.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
group :development do
|
9
|
-
gem 'yard'
|
10
|
-
|
11
|
-
gem 'kramdown'
|
12
|
-
gem 'kramdown-parser-gfm'
|
13
|
-
|
14
|
-
gem 'json'
|
15
|
-
|
16
|
-
gem 'rackula'
|
17
|
-
end
|
18
|
-
|
19
|
-
group :test do
|
20
|
-
gem 'benchmark-ips'
|
21
|
-
gem 'ruby-prof', platforms: :mri
|
22
|
-
|
23
|
-
gem 'guard-falcon'
|
24
|
-
|
25
|
-
gem 'rack-test'
|
26
|
-
end
|
27
|
-
|
28
|
-
gem "thread-local", "~> 1.0"
|
data/README.md
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# ![Utopia Logo](materials/utopia.svg)
|
2
|
-
|
3
|
-
Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.
|
4
|
-
|
5
|
-
[![Actions Status](https://github.com/socketry/utopia/workflows/Development/badge.svg)](https://github.com/socketry/async/actions?workflow=Development)
|
6
|
-
|
7
|
-
## Motivation
|
8
|
-
|
9
|
-
The [original Utopia project](https://github.com/ioquatix/utopia-php) was written in PHP in the early 2000s. It consisted of an XML parser, a database layer and some code to assist with business logic. It was initially designed to reduce the amount of HTML required to build both content-centric websites and business apps. At the time, CSS was very poorly supported and thus a lot of the time, you'd be using quite complex `<table>`s with embedded `<img>`s to generate simple things like boxes with drop shadows, etc. Utopia provided a core concept - a node - which was essentially a small snippet of HTML, which could be composed into other nodes simply by using a named tag (similar to ColdFusion). Attributes and content were passed in, and thus you could easily build complex pages with simple semantic markup.
|
10
|
-
|
11
|
-
At the time, the available frameworks were pretty basic. Utopia was a working, albeit poor, implementation of MVC and supported several commercial websites I developed at the time. I made it, partly just because I could, but also because it served a commercial purpose.
|
12
|
-
|
13
|
-
Eventually one day I started using Ruby on Rails. There are aspects of the Rails framework which I like. However, at the time I was using it (starting with version 0.8), I found that it's flat organisation of controllers and views very limiting. Nested controllers and views make it easier to manage complexity in a web application. Utopia embraces this principle, and applies it to both the controller and view layers. I also developed a [model layer with similar principles](https://github.com/ioquatix/relaxo-model).
|
14
|
-
|
15
|
-
So, Utopia exists because it suits my way of thinking about web applications, and it's conceptual core has been refined for over a decade. It provides a considered amount of both flexibility, and opinionated behavior.
|
16
|
-
|
17
|
-
### Is it production ready?
|
18
|
-
|
19
|
-
Yes. We've used Utopia since about 2010 in production.
|
20
|
-
|
21
|
-
### Is it fast?
|
22
|
-
|
23
|
-
Yes. [Trenni](https://github.com/ioquatix/trenni) includes native [Ragel](http://www.colm.net/open-source/ragel/) parsers, and Utopia uses [Concurrent::Map](https://github.com/ruby-concurrency/concurrent-ruby) for multi-thread safe caches. On my laptop, Utopia can process 3000 requests/s rendering content on a single thread.
|
24
|
-
|
25
|
-
## Installation
|
26
|
-
|
27
|
-
Make sure you have git, ruby, and bundler installed and set up correctly.
|
28
|
-
|
29
|
-
Install utopia:
|
30
|
-
|
31
|
-
$ gem install utopia
|
32
|
-
|
33
|
-
Create a new site:
|
34
|
-
|
35
|
-
$ mkdir www.example.com
|
36
|
-
$ cd www.example.com
|
37
|
-
$ utopia site create
|
38
|
-
$ rake
|
39
|
-
|
40
|
-
## Usage
|
41
|
-
|
42
|
-
There is an excellent [documentation wiki](https://socketry.github.io/utopia/) included with the source code. Simply clone this repository and `rake documentation:server`. This documentation wiki is editable, so feel free to submit a PR with improvements.
|
43
|
-
|
44
|
-
## Contributing
|
45
|
-
|
46
|
-
1. Fork it
|
47
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
-
5. Create new Pull Request
|
51
|
-
|
52
|
-
## See Also
|
53
|
-
|
54
|
-
- [Trenni](https://github.com/ioquatix/trenni) — Template and markup parsers, markup generation.
|
55
|
-
- [Trenni::Formatters](https://github.com/ioquatix/trenni-formatters) — Helpers for HTML generation including views and forms.
|
56
|
-
- [Utopia::Gallery](https://github.com/ioquatix/utopia-gallery) — A fast photo gallery based on [libvips](https://github.com/jcupitt/libvips).
|
57
|
-
- [Utopia::Analytics](https://github.com/ioquatix/utopia-analytics) — Simple integration with Google Analytics.
|
58
|
-
- [HTTP::Accept](https://github.com/ioquatix/http-accept) — RFC compliant header parser.
|
59
|
-
- [Samovar](https://github.com/ioquatix/samovar) — Command line parser used by Utopia.
|
60
|
-
- [Mapping](https://github.com/ioquatix/mapping) — Provide structured conversions for web interfaces.
|
61
|
-
- [Rack::Test::Body](https://github.com/ioquatix/rack-test-body) — Provide convenient helpers for testing web interfaces.
|
62
|
-
|
63
|
-
### Applications
|
64
|
-
|
65
|
-
- [Financier](https://github.com/ioquatix/financier) — A small business management platform.
|
66
|
-
- [mail.oriontransfer.net](https://github.com/oriontransfer/mail.oriontransfer.net) - Mail server account management.
|
67
|
-
|
68
|
-
## License
|
69
|
-
|
70
|
-
Released under the MIT license.
|
71
|
-
|
72
|
-
Copyright, 2009-2020, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
73
|
-
|
74
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
75
|
-
of this software and associated documentation files (the "Software"), to deal
|
76
|
-
in the Software without restriction, including without limitation the rights
|
77
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
78
|
-
copies of the Software, and to permit persons to whom the Software is
|
79
|
-
furnished to do so, subject to the following conditions:
|
80
|
-
|
81
|
-
The above copyright notice and this permission notice shall be included in
|
82
|
-
all copies or substantial portions of the Software.
|
83
|
-
|
84
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
85
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
86
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
87
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
88
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
89
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
90
|
-
THE SOFTWARE.
|
data/benchmark/call_vs_check.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
class A
|
6
|
-
end
|
7
|
-
|
8
|
-
class B
|
9
|
-
def self.do
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class C
|
14
|
-
def self.do
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Benchmark.ips do |x|
|
19
|
-
x.report("responds_to? (nothing)") do |times|
|
20
|
-
while (times -= 1) >= 0
|
21
|
-
A.do if A.respond_to?(:do)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
x.report("B (empty method)") do |times|
|
26
|
-
while (times -= 1) >= 0
|
27
|
-
B.do
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
x.report("responds_to? (empty method)") do |times|
|
32
|
-
while (times -= 1) >= 0
|
33
|
-
C.do if C.respond_to?(:do)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
x.compare!
|
38
|
-
end
|
data/benchmark/const_vs_hash.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
module Foo
|
6
|
-
class Bar
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
THINGS = {
|
12
|
-
'Bar' => Foo::Bar
|
13
|
-
}
|
14
|
-
|
15
|
-
Benchmark.ips do |x|
|
16
|
-
x.report("const_get('Bar')") do |i|
|
17
|
-
while (i -= 1) > 0
|
18
|
-
Foo.const_get('Bar')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
x.report("const_get(:Bar)") do |i|
|
23
|
-
while (i -= 1) > 0
|
24
|
-
Foo.const_get(:Bar)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
x.report("Hash\#[]") do |i|
|
29
|
-
while (i -= 1) > 0
|
30
|
-
THINGS['Bar']
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
x.compare!
|
35
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'benchmark/ips'
|
4
|
-
require 'ostruct'
|
5
|
-
|
6
|
-
# This benchmark compares accessing an instance variable vs accessing a struct member (via a function). The actual method dispatch is about 25% slower.
|
7
|
-
|
8
|
-
puts "Ruby #{RUBY_VERSION} at #{Time.now}"
|
9
|
-
|
10
|
-
NAME = "Test Name"
|
11
|
-
EMAIL = "test@example.org"
|
12
|
-
|
13
|
-
test = nil
|
14
|
-
|
15
|
-
class ObjectHash
|
16
|
-
def []= key, value
|
17
|
-
instance_variable_set(key, value)
|
18
|
-
end
|
19
|
-
|
20
|
-
def [] key
|
21
|
-
instance_variable_get(key)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# There IS a measuarble difference:
|
26
|
-
Benchmark.ips do |x|
|
27
|
-
x.report("Hash") do |i|
|
28
|
-
i.times do
|
29
|
-
p = {name: NAME, email: EMAIL}
|
30
|
-
|
31
|
-
test = p[:name] + p[:email]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
x.report("OpenStruct") do |i|
|
36
|
-
i.times do
|
37
|
-
p = OpenStruct.new(name: NAME, email: EMAIL)
|
38
|
-
|
39
|
-
test = p.name + p.email
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
x.report("ObjectHash") do |i|
|
44
|
-
i.times do
|
45
|
-
o = ObjectHash.new
|
46
|
-
o[:@name] = NAME
|
47
|
-
o[:@email] = EMAIL
|
48
|
-
|
49
|
-
test = o[:@name] + o[:@email]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
x.compare!
|
54
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
STRING_HASH = { "foo" => "bar" }
|
6
|
-
SYMBOL_HASH = { :foo => "bar" }
|
7
|
-
|
8
|
-
Benchmark.ips do |x|
|
9
|
-
x.report("string") { STRING_HASH["foo"] }
|
10
|
-
x.report("symbol") { SYMBOL_HASH[:foo] }
|
11
|
-
x.report("symbol-from-string") { SYMBOL_HASH["foo".to_sym] }
|
12
|
-
|
13
|
-
x.compare!
|
14
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
# This benchmark compares accessing an instance variable vs accessing a struct member (via a function). The actual method dispatch is about 25% slower.
|
6
|
-
|
7
|
-
puts "Ruby #{RUBY_VERSION} at #{Time.now}"
|
8
|
-
|
9
|
-
ItemsStruct = Struct.new(:items) do
|
10
|
-
def initialize
|
11
|
-
super []
|
12
|
-
end
|
13
|
-
|
14
|
-
def push_me_pull_you(value = :x)
|
15
|
-
items = self.items
|
16
|
-
|
17
|
-
items << value
|
18
|
-
items.pop
|
19
|
-
end
|
20
|
-
|
21
|
-
def empty?
|
22
|
-
self.items.empty?
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class ItemsClass
|
27
|
-
def initialize
|
28
|
-
@items = []
|
29
|
-
end
|
30
|
-
|
31
|
-
def push_me_pull_you(value = :x)
|
32
|
-
items = @items
|
33
|
-
|
34
|
-
items << value
|
35
|
-
items.pop
|
36
|
-
end
|
37
|
-
|
38
|
-
def empty?
|
39
|
-
@items.empty?
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# There IS a measuarble difference:
|
44
|
-
Benchmark.ips do |x|
|
45
|
-
x.report("Struct#empty?") do |times|
|
46
|
-
i = 0
|
47
|
-
instance = ItemsStruct.new
|
48
|
-
|
49
|
-
while i < times
|
50
|
-
break unless instance.empty?
|
51
|
-
i += 1
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
x.report("Class#empty?") do |times|
|
56
|
-
i = 0
|
57
|
-
instance = ItemsClass.new
|
58
|
-
|
59
|
-
while i < times
|
60
|
-
break unless instance.empty?
|
61
|
-
i += 1
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
x.compare!
|
66
|
-
end
|
67
|
-
|
68
|
-
# This shows that in the presence of additional work, the difference is neglegible.
|
69
|
-
Benchmark.ips do |x|
|
70
|
-
x.report("Struct#push_me_pull_you") do |times|
|
71
|
-
i = 0
|
72
|
-
a = A.new
|
73
|
-
|
74
|
-
while i < times
|
75
|
-
a.push_me_pull_you(i)
|
76
|
-
i += 1
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
x.report("Class#push_me_pull_you") do |times|
|
81
|
-
i = 0
|
82
|
-
b = B.new
|
83
|
-
|
84
|
-
while i < times
|
85
|
-
b.push_me_pull_you(i)
|
86
|
-
i += 1
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
x.compare!
|
91
|
-
end
|