utopia 2.21.0 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/utopia/environment.rb +90 -0
- data/bake/utopia/server.rb +61 -0
- data/bake/utopia/site.rb +188 -0
- data/lib/utopia/version.rb +1 -1
- data/license.md +2 -2
- data/readme.md +1 -1
- data/setup/site/.gitignore +0 -1
- data/setup/site/Guardfile +13 -13
- data/setup/site/config/{README.md → readme.md} +0 -0
- data/setup/site/config/sus.rb +10 -0
- data/setup/site/fixtures/website.rb +39 -0
- data/setup/site/gems.rb +6 -8
- data/setup/site/{README.md → readme.md} +0 -0
- data/setup/site/test/website.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +27 -32
- metadata.gz.sig +0 -0
- data/bake/utopia/test.rb +0 -12
- data/bin/utopia +0 -25
- data/lib/utopia/command/environment.rb +0 -76
- data/lib/utopia/command/server.rb +0 -100
- data/lib/utopia/command/site.rb +0 -217
- data/lib/utopia/command.rb +0 -51
- data/setup/site/.rspec +0 -4
- data/setup/site/spec/spec_helper.rb +0 -19
- data/setup/site/spec/website_context.rb +0 -57
- data/setup/site/spec/website_spec.rb +0 -28
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2017-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require 'bundler/setup'
|
7
|
-
require 'covered/rspec'
|
8
|
-
require 'variant'
|
9
|
-
|
10
|
-
Variant.force!(:testing)
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
# Enable flags like --only-failures and --next-failure
|
14
|
-
config.example_status_persistence_file_path = '.rspec_status'
|
15
|
-
|
16
|
-
config.expect_with :rspec do |c|
|
17
|
-
c.syntax = :expect
|
18
|
-
end
|
19
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require 'rack/test'
|
7
|
-
require 'async/rspec/reactor'
|
8
|
-
|
9
|
-
RSpec.shared_context "website" do
|
10
|
-
include Rack::Test::Methods
|
11
|
-
|
12
|
-
let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
|
13
|
-
let(:rackup_directory) {File.dirname(rackup_path)}
|
14
|
-
|
15
|
-
let(:app) {Rack::Builder.parse_file(rackup_path)}
|
16
|
-
end
|
17
|
-
|
18
|
-
RSpec.shared_examples_for "valid page" do |path|
|
19
|
-
it "can access #{path}" do
|
20
|
-
get path
|
21
|
-
|
22
|
-
while last_response.redirect?
|
23
|
-
follow_redirect!
|
24
|
-
end
|
25
|
-
|
26
|
-
expect(last_response.status).to be == 200
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
RSpec.shared_context "server" do
|
31
|
-
include_context "website"
|
32
|
-
include_context Async::RSpec::Reactor
|
33
|
-
|
34
|
-
before(:all) do
|
35
|
-
require 'falcon/server'
|
36
|
-
require 'async/io/unix_endpoint'
|
37
|
-
require 'benchmark/http/spider'
|
38
|
-
end
|
39
|
-
|
40
|
-
before do
|
41
|
-
@endpoint = Async::HTTP::Endpoint.parse("http://localhost", Async::IO::Endpoint.unix("server.ipc"))
|
42
|
-
|
43
|
-
@server_task = reactor.async do
|
44
|
-
middleware = Falcon::Server.middleware(app)
|
45
|
-
|
46
|
-
server = Falcon::Server.new(middleware, endpoint)
|
47
|
-
|
48
|
-
server.run
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
after do
|
53
|
-
@server_task.stop
|
54
|
-
end
|
55
|
-
|
56
|
-
let(:endpoint) {@endpoint}
|
57
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2016-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative 'website_context'
|
7
|
-
|
8
|
-
RSpec.describe "website", timeout: 120 do
|
9
|
-
include_context "server"
|
10
|
-
|
11
|
-
let(:spider) {Benchmark::HTTP::Spider.new(depth: 128)}
|
12
|
-
let(:statistics) {Benchmark::HTTP::Statistics.new}
|
13
|
-
|
14
|
-
it "should be responsive" do
|
15
|
-
Async::HTTP::Client.open(endpoint, connection_limit: 8) do |client|
|
16
|
-
spider.fetch(statistics, client, endpoint.url) do |method, uri, response|
|
17
|
-
if response.failure?
|
18
|
-
Console.logger.error(endpoint) {"#{method} #{uri} -> #{response.status}"}
|
19
|
-
end
|
20
|
-
end.wait
|
21
|
-
end
|
22
|
-
|
23
|
-
statistics.print
|
24
|
-
|
25
|
-
expect(statistics.samples).to be_any
|
26
|
-
expect(statistics.failed).to be_zero
|
27
|
-
end
|
28
|
-
end
|