utopia 2.20.1 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/bake/utopia/environment.rb +90 -0
  4. data/bake/utopia/node.rb +3 -1
  5. data/bake/utopia/server.rb +61 -0
  6. data/bake/utopia/shell.rb +3 -1
  7. data/bake/utopia/site.rb +188 -0
  8. data/bake/utopia/static.rb +3 -2
  9. data/bake/utopia.rb +3 -1
  10. data/lib/utopia/content/document.rb +2 -19
  11. data/lib/utopia/content/link.rb +4 -19
  12. data/lib/utopia/content/links.rb +2 -19
  13. data/lib/utopia/content/markup.rb +2 -19
  14. data/lib/utopia/content/namespace.rb +2 -19
  15. data/lib/utopia/content/node.rb +4 -20
  16. data/lib/utopia/content/response.rb +2 -19
  17. data/lib/utopia/content/tags.rb +2 -19
  18. data/lib/utopia/content.rb +2 -19
  19. data/lib/utopia/content_length.rb +2 -19
  20. data/lib/utopia/controller/actions.rb +2 -19
  21. data/lib/utopia/controller/base.rb +2 -19
  22. data/lib/utopia/controller/respond.rb +2 -19
  23. data/lib/utopia/controller/rewrite.rb +2 -19
  24. data/lib/utopia/controller/variables.rb +2 -19
  25. data/lib/utopia/controller.rb +2 -19
  26. data/lib/utopia/exceptions/handler.rb +2 -19
  27. data/lib/utopia/exceptions/mailer.rb +2 -19
  28. data/lib/utopia/exceptions.rb +2 -19
  29. data/lib/utopia/extensions/array_split.rb +3 -20
  30. data/lib/utopia/extensions/date_comparisons.rb +3 -20
  31. data/lib/utopia/http.rb +2 -19
  32. data/lib/utopia/locale.rb +2 -19
  33. data/lib/utopia/localization.rb +2 -19
  34. data/lib/utopia/logger.rb +2 -19
  35. data/lib/utopia/middleware.rb +2 -19
  36. data/lib/utopia/path/matcher.rb +2 -19
  37. data/lib/utopia/path.rb +2 -19
  38. data/lib/utopia/redirection.rb +2 -19
  39. data/lib/utopia/responder.rb +2 -19
  40. data/lib/utopia/session/lazy_hash.rb +2 -19
  41. data/lib/utopia/session/serialization.rb +2 -19
  42. data/lib/utopia/session.rb +3 -19
  43. data/lib/utopia/setup.rb +2 -19
  44. data/lib/utopia/shell.rb +2 -19
  45. data/lib/utopia/static/local_file.rb +2 -19
  46. data/lib/utopia/static/mime_types.rb +2 -19
  47. data/lib/utopia/static.rb +2 -19
  48. data/lib/utopia/version.rb +3 -20
  49. data/lib/utopia.rb +3 -20
  50. data/license.md +25 -0
  51. data/readme.md +44 -0
  52. data/setup/site/.gitignore +0 -1
  53. data/setup/site/Guardfile +13 -13
  54. data/setup/site/bake.rb +3 -1
  55. data/setup/site/config/environment.rb +3 -0
  56. data/setup/site/config/{README.md → readme.md} +0 -0
  57. data/setup/site/config/sus.rb +10 -0
  58. data/setup/site/falcon.rb +3 -0
  59. data/setup/site/fixtures/website.rb +39 -0
  60. data/setup/site/gems.rb +8 -7
  61. data/setup/site/{README.md → readme.md} +0 -0
  62. data/setup/site/test/website.rb +28 -0
  63. data.tar.gz.sig +0 -0
  64. metadata +59 -62
  65. metadata.gz.sig +0 -0
  66. data/bake/utopia/test.rb +0 -10
  67. data/bin/utopia +0 -25
  68. data/lib/utopia/command/environment.rb +0 -93
  69. data/lib/utopia/command/server.rb +0 -113
  70. data/lib/utopia/command/site.rb +0 -233
  71. data/lib/utopia/command.rb +0 -67
  72. data/setup/site/.rspec +0 -4
  73. data/setup/site/spec/spec_helper.rb +0 -16
  74. data/setup/site/spec/website_context.rb +0 -54
  75. data/setup/site/spec/website_spec.rb +0 -25
@@ -1,24 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2014-2022, by Samuel Williams.
5
+ # Copyright, 2019, by Huba Nagy.
22
6
 
23
7
  require 'openssl'
24
8
  require 'digest/sha2'
data/lib/utopia/setup.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2010-2022, by Samuel Williams.
22
5
 
23
6
  require 'yaml'
24
7
  require 'securerandom'
data/lib/utopia/shell.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
22
5
 
23
6
  require 'rack/builder'
24
7
  require 'rack/test'
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2022, by Samuel Williams.
22
5
 
23
6
  require 'time'
24
7
  require 'digest/sha1'
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2022, by Samuel Williams.
22
5
 
23
6
  require 'mime/types'
24
7
 
data/lib/utopia/static.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2009-2022, by Samuel Williams.
22
5
 
23
6
  require_relative 'middleware'
24
7
  require_relative 'localization'
@@ -1,25 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2009-2022, by Samuel Williams.
22
5
 
23
6
  module Utopia
24
- VERSION = "2.20.1"
7
+ VERSION = "2.22.0"
25
8
  end
data/lib/utopia.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2009-2022, by Samuel Williams.
22
5
 
23
6
  require_relative 'utopia/version'
24
7
 
@@ -31,4 +14,4 @@ require_relative 'utopia/content_length'
31
14
 
32
15
  # Utopia is a web application framework built on top of Rack.
33
16
  module Utopia
34
- end
17
+ end
data/license.md ADDED
@@ -0,0 +1,25 @@
1
+ # MIT License
2
+
3
+ Copyright, 2009-2023, by Samuel Williams.
4
+ Copyright, 2015-2019, by Huba Nagy.
5
+ Copyright, 2020, by Olle Jonsson.
6
+ Copyright, 2020, by Pierre Montelle.
7
+ Copyright, 2020, by Michael Adams.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,44 @@
1
+ # ![Utopia](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
+ [![Development Status](https://github.com/ioquatix/utopia/workflows/Test/badge.svg)](https://github.com/ioquatix/utopia/actions?workflow=Test)
6
+
7
+ ## Features
8
+
9
+ - Designed for both content-based websites and applications. Does not depend on a database.
10
+ - Supports flexible content localization based on industry recommendations.
11
+ - Rack middleware compatible with all major Ruby application servers. Small memory footprint by default.
12
+ - Low latency and high throughput. Capable of 10,000+ requests/second out of the box.
13
+
14
+ ## Usage
15
+
16
+ Please see the [project documentation](https://socketry.github.io/utopia).
17
+
18
+ ## Contributing
19
+
20
+ We welcome contributions to this project.
21
+
22
+ 1. Fork it.
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
25
+ 4. Push to the branch (`git push origin my-new-feature`).
26
+ 5. Create new Pull Request.
27
+
28
+ ## See Also
29
+
30
+ - [Trenni](https://github.com/ioquatix/trenni) — Template and markup parsers, markup generation.
31
+ - [Trenni::Formatters](https://github.com/ioquatix/trenni-formatters) — Helpers for HTML generation including views and forms.
32
+ - [Utopia::Gallery](https://github.com/ioquatix/utopia-gallery) — A fast photo gallery based on [libvips](https://github.com/jcupitt/libvips).
33
+ - [Utopia::Project](https://github.com/socketry/utopia-project) — A Ruby project documentation tool.
34
+ - [Utopia::Analytics](https://github.com/ioquatix/utopia-analytics) — Simple integration with Google Analytics.
35
+ - [HTTP::Accept](https://github.com/ioquatix/http-accept) — RFC compliant header parser.
36
+ - [Samovar](https://github.com/ioquatix/samovar) — Command line parser used by Utopia.
37
+ - [Mapping](https://github.com/ioquatix/mapping) — Provide structured conversions for web interfaces.
38
+ - [Rack::Test::Body](https://github.com/ioquatix/rack-test-body) — Provide convenient helpers for testing web interfaces.
39
+
40
+ ### Examples
41
+
42
+ - [Financier](https://github.com/ioquatix/financier) — A small business management platform.
43
+ - [mail.oriontransfer.net](https://github.com/oriontransfer/mail.oriontransfer.net) - Mail server account management.
44
+ - [www.codeotaku.com](http://www.codeotaku.com) ([source](https://github.com/ioquatix/www.codeotaku.com)) — Personal website, blog.
@@ -1,5 +1,4 @@
1
1
  # Development specific:
2
- /.rspec_status
3
2
  /.bundle
4
3
 
5
4
  # Temporary data should not be added to the repository:
data/setup/site/Guardfile CHANGED
@@ -10,20 +10,20 @@ group :development do
10
10
  end
11
11
 
12
12
  group :test do
13
- guard :rspec, cmd: 'rspec' do
14
- # Notifications can get a bit tedious:
15
- # notification :off
13
+ # guard :rspec, cmd: 'rspec' do
14
+ # # Notifications can get a bit tedious:
15
+ # # notification :off
16
16
 
17
- # Re-run specs if they are changed:
18
- watch(%r{^spec/.+_spec\.rb$})
19
- watch('spec/spec_helper.rb') {'spec'}
17
+ # # Re-run specs if they are changed:
18
+ # watch(%r{^spec/.+_spec\.rb$})
19
+ # watch('spec/spec_helper.rb') {'spec'}
20
20
 
21
- # Run relevent specs if files in `lib/` or `pages/` are changed:
22
- watch(%r{^lib/(.+)\.rb$}) {|match| "spec/lib/#{match[1]}_spec.rb" }
23
- watch(%r{^pages/(.+)\.(rb|xnode)$}) {|match| "spec/pages/#{match[1]}_spec.rb"}
24
- watch(%r{^pages/(.+)controller\.rb$}) {|match| Dir.glob("spec/pages/#{match[1]}*_spec.rb")}
21
+ # # Run relevent specs if files in `lib/` or `pages/` are changed:
22
+ # watch(%r{^lib/(.+)\.rb$}) {|match| "spec/lib/#{match[1]}_spec.rb" }
23
+ # watch(%r{^pages/(.+)\.(rb|xnode)$}) {|match| "spec/pages/#{match[1]}_spec.rb"}
24
+ # watch(%r{^pages/(.+)controller\.rb$}) {|match| Dir.glob("spec/pages/#{match[1]}*_spec.rb")}
25
25
 
26
- # If any files in pages changes, ensure the website still works:
27
- watch(%r{^pages/.*}) {'spec/website_spec.rb'}
28
- end
26
+ # # If any files in pages changes, ensure the website still works:
27
+ # watch(%r{^pages/.*}) {'spec/website_spec.rb'}
28
+ # end
29
29
  end
data/setup/site/bake.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Prepare the application for start/restart.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
5
+
4
6
  def deploy
5
7
  # This task is typiclly run after the site is updated but before the server is restarted.
6
8
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2022, by Samuel Williams.
5
+
3
6
  require 'bundler/setup'
4
7
  Bundler.setup
5
8
 
File without changes
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023, by Samuel Williams.
5
+
6
+ require 'variant'
7
+ Variant.force!(:testing)
8
+
9
+ require 'covered/sus'
10
+ include Covered::Sus
data/setup/site/falcon.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env -S falcon host
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Released under the MIT License.
5
+ # Copyright, 2019-2022, by Samuel Williams.
6
+
4
7
  load :rack, :lets_encrypt_tls, :supervisor
5
8
 
6
9
  hostname = File.basename(__dir__)
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2023, by Samuel Williams.
5
+
6
+ require 'rack/test'
7
+ require 'sus/fixtures/async/http'
8
+ require 'protocol/rack'
9
+
10
+ AWebsite = Sus::Shared("a website") do
11
+ include Rack::Test::Methods
12
+
13
+ let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
14
+ let(:rackup_directory) {File.dirname(rackup_path)}
15
+
16
+ let(:app) {Rack::Builder.parse_file(rackup_path)}
17
+ end
18
+
19
+ AValidPage = Sus::Shared("a valid page") do |path|
20
+ it "can access #{path}" do
21
+ get path
22
+
23
+ while last_response.redirect?
24
+ follow_redirect!
25
+ end
26
+
27
+ expect(last_response.status).to be == 200
28
+ end
29
+ end
30
+
31
+ AServer = Sus::Shared("a server") do
32
+ include Sus::Fixtures::Async::HTTP::ServerContext
33
+
34
+ let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
35
+ let(:rackup_directory) {File.dirname(rackup_path)}
36
+
37
+ let(:rack_app) {Rack::Builder.parse_file(rackup_path)}
38
+ let(:app) {Protocol::Rack::Adapter.new(rack_app)}
39
+ end
data/setup/site/gems.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Released under the MIT License.
4
+ # Copyright, 2012-2023, by Samuel Williams.
5
+
3
6
  source 'https://rubygems.org'
4
7
 
5
8
  group :preload do
@@ -10,20 +13,18 @@ group :preload do
10
13
  gem 'variant'
11
14
  end
12
15
 
13
- gem 'rake'
14
- gem 'bake'
15
- gem 'bundler'
16
- gem 'rack-test'
17
16
  gem 'net-smtp'
18
17
 
19
18
  group :development do
19
+ gem 'bake-test'
20
+ gem 'rack-test'
20
21
  gem 'guard-falcon', require: false
21
- gem 'guard-rspec', require: false
22
22
 
23
- gem 'rspec'
23
+ gem 'sus'
24
+ gem 'sus-fixtures-async-http'
25
+
24
26
  gem 'covered'
25
27
 
26
- gem 'async-rspec'
27
28
  gem 'benchmark-http'
28
29
  end
29
30
 
File without changes
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2023, by Samuel Williams.
5
+
6
+ require 'website'
7
+ require 'benchmark/http'
8
+
9
+ describe "website" do
10
+ include_context AServer
11
+
12
+ let(:timeout) {10}
13
+ let(:spider) {Benchmark::HTTP::Spider.new(depth: 128)}
14
+ let(:statistics) {Benchmark::HTTP::Statistics.new}
15
+
16
+ it "should be responsive" do
17
+ spider.fetch(statistics, client, endpoint.url) do |method, uri, response|
18
+ if response.failure?
19
+ Console.logger.error(endpoint) {"#{method} #{uri} -> #{response.status}"}
20
+ end
21
+ end.wait
22
+
23
+ statistics.print
24
+
25
+ expect(statistics.samples).to be(:any?)
26
+ expect(statistics.failed).to be(:zero?)
27
+ end
28
+ end
data.tar.gz.sig CHANGED
Binary file