repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/static.rb
test/utopia/static.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. require "rack" require "rack/test" require "utopia/static" describe Utopia::Static do include Rack::Test::Methods let(:app) {Rack::Builder.parse_file(File.expand_path("static.ru", __dir__))} it "should g...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/localization.rb
test/utopia/localization.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. require "rack" require "rack/test" require "utopia/static" require "utopia/content" require "utopia/controller" require "utopia/localization" describe Utopia::Localization do include Rack::Test::Methods l...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/redirection.rb
test/utopia/redirection.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "utopia/redirection" require "a_rack_application" describe Utopia::Redirection do include_context ARackApplication, File.join(__dir__, "redirection_spec.ru") it "should redirect directory to index"...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/import_map.rb
test/utopia/import_map.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "utopia/import_map" describe Utopia::ImportMap do with ".build" do it "creates an import map with a block yielding map" do import_map = subject.build do |map| map.import("react", "https://esm.sh/r...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/actions.rb
test/utopia/controller/actions.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "utopia/controller" describe Utopia::Controller::Actions::Action do let(:action) {subject.new} it "can be a hash key" do expect(action).to be == action expect(action.hash).to be == action.hash ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/middleware.rb
test/utopia/controller/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2013-2025, by Samuel Williams. require "rack/mock" require "rack/test" require "utopia/controller" describe Utopia::Controller do include Rack::Test::Methods let(:app) {Rack::Builder.parse_file(File.expand_path("middleware.ru", __dir__)...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/rewrite.rb
test/utopia/controller/rewrite.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "rack/mock" require "utopia/controller" describe Utopia::Controller do class TestController < Utopia::Controller::Base prepend Utopia::Controller::Rewrite, Utopia::Controller::Actions on "edit"...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/variables.rb
test/utopia/controller/variables.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "utopia/controller/variables" require "rack/request" class TestController attr_accessor :x, :y, :z def copy_instance_variables(from) from.instance_variables.each do |name| self.instance_variab...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/sequence.rb
test/utopia/controller/sequence.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "rack/mock" require "rack/test" require "utopia/controller" class TestController < Utopia::Controller::Base prepend Utopia::Controller::Actions on "success" do succeed! end on :failure do f...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/respond.rb
test/utopia/controller/respond.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "rack/test" require "rack/mock" require "json" require "utopia/content" require "utopia/controller" require "utopia/redirection" describe Utopia::Controller do class TestController < Utopia::Controll...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/websocket.rb
test/utopia/controller/websocket.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2019-2025, by Samuel Williams. require "rack/test" require "utopia/controller" require "async/websocket/client" require "async/websocket/adapters/rack" require "sus/fixtures/async/http/server_context" require "async/http/client" require "...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.websocket/server/controller.rb
test/utopia/controller/.websocket/server/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2019-2023, by Samuel Williams. prepend Actions on 'events' do |request| upgrade = Async::WebSocket::Adapters::Rack.open(request.env) do |connection| connection.write({type: "test", data: "Hello World"}.to_json) end respond?(upgrade) ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.middleware/controller/controller.rb
test/utopia/controller/.middleware/controller/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions on 'flat' do succeed! content: "flat" end on '**/hello-world' do succeed! content: @hello_world end on '**' do @hello_world = "Hello World" end on 'ignore' do ignore! end on 'redirect' ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.middleware/controller/nested/controller.rb
test/utopia/controller/.middleware/controller/nested/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions on 'foobar' do succeed! content: "Foobar" end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.middleware/empty/controller.rb
test/utopia/controller/.middleware/empty/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams.
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.middleware/redirect/controller.rb
test/utopia/controller/.middleware/redirect/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions on '**' do |request, path| # puts "**: #{URI_PATH.inspect}" if path.include? 'foo' # This should ALWAYS give /redirect succeed! content: URI_PATH.to_s end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.middleware/redirect/test/controller.rb
test/utopia/controller/.middleware/redirect/test/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions on 'bar' do |request, path| # puts "bar: #{URI_PATH.inspect}" succeed! end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.respond/html/controller.rb
test/utopia/controller/.respond/html/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2023, by Samuel Williams. prepend Respond, Actions # Respond with json: respond.with_json # This method should return HTML, even thought this controller responds with JSON. on 'hello-world' do succeed! content: "<p>Hello World</p>", ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.respond/api/controller.rb
test/utopia/controller/.respond/api/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2023, by Samuel Williams. prepend Respond, Actions respond.with_json class VersionedResponse def to_json(options = {}) JSON.dump(self.as_json(options)) end # Modelled after http://api.rubyonrails.org/classes/ActiveModel/Serializ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/controller/.respond/rewrite/controller.rb
test/utopia/controller/.respond/rewrite/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2023, by Samuel Williams. prepend Respond, Rewrite, Actions respond.with_json rewrite.extract_prefix id: Integer do |request| fail! :not_found, message: "Could not find record" if @id == 1 end on 'show' do succeed! content: {id: @i...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/namespace.rb
test/utopia/content/namespace.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "utopia/content/namespace" describe Utopia::Content::Namespace do let(:tags) do Module.new.tap do |mod| mod.extend(Utopia::Content::Namespace) mod.tag("foo") do |document, state| end ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/node.rb
test/utopia/content/node.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "utopia/content" describe Utopia::Content::Node do let(:root) {File.expand_path("node", __dir__)} let(:content) {Utopia::Content.new(lambda{}, root: root)} it "should list siblings in correct orde...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/response.rb
test/utopia/content/response.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2012-2025, by Samuel Williams. require "utopia/content/response" describe Utopia::Content::Response do let(:response) {subject.new} it "should specify not to cache content" do response.cache!(1000) response.do_not_cache! expect...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/markup.rb
test/utopia/content/markup.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "utopia/content/markup" class TestDelegate def initialize @events = [] end attr :events def method_missing(*arguments) @events << arguments end end describe Utopia::Content::MarkupParser ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/document.rb
test/utopia/content/document.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "utopia/content/document" require "rack/request" describe Utopia::Content::Document do let(:env) {Hash["REQUEST_PATH" => "/index"]} let(:request) {Rack::Request.new(env)} let(:document) {subject.new...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/tags.rb
test/utopia/content/tags.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "utopia/content/tags" require "utopia/content/document" class MockNode def initialize(namespaces = {}, &block) @namespaces = namespaces define_singleton_method(:call, block) end def lookup_tag...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/content/links.rb
test/utopia/content/links.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "utopia/content/links" describe Utopia::Content::Links do let(:root) {File.expand_path("links", __dir__)} let(:links) {subject.new(root)} with "#index_filter" do it "should match index" do ex...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/exceptions/mailer.rb
test/utopia/exceptions/mailer.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "a_rack_application" require "utopia/exceptions" require "utopia/controller" describe Utopia::Exceptions::Mailer do include_context ARackApplication, File.expand_path("mailer.ru", __dir__) def bef...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/exceptions/handler.rb
test/utopia/exceptions/handler.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "a_rack_application" require "utopia/exceptions" require "utopia/controller" describe Utopia::Exceptions::Handler do include_context ARackApplication, File.expand_path("handler.ru", __dir__) it "s...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/exceptions/.handler/controller.rb
test/utopia/exceptions/.handler/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions class TharSheBlows < StandardError end on 'blow' do raise TharSheBlows.new("Arrrh!") end # The ExceptionHandler middleware will redirect here when an exception occurs. If this also fails, th...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/.localization/controller.rb
test/utopia/.localization/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2023, by Samuel Williams. prepend Actions on 'all_locales' do |request, path| wrapper = Utopia::Localization[request] succeed! content: wrapper.all_locales.join(',') end on 'default_locale' do |request, path| wrapper = Utopia::Lo...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/.performance/pages/api/controller.rb
test/utopia/.performance/pages/api/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2023, by Samuel Williams. prepend Respond, Actions respond.with_json on 'fetch' do succeed! content: [1, 2, 3] end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/document/builder.rb
test/utopia/document/builder.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require 'utopia/content/builder' require 'utopia/content/tags' require 'xrb/builder' describe Utopia::Content::Builder do it "should inherit from XRB::Builder" do expect(Utopia::Content::Builder.superclass).to b...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/path/matcher.rb
test/utopia/path/matcher.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require "utopia/path/matcher" describe Utopia::Path::Matcher do it "should match strings" do path = Utopia::Path["users/20/edit"] matcher = Utopia::Path::Matcher[users: "users"] match_data = matcher....
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/test/utopia/http/status.rb
test/utopia/http/status.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "utopia/http" describe Utopia::HTTP::Status.new(:found) do it "should load symbolic status" do expect(subject.to_i).to be == 302 end it "gives a status string" do expect(subject.to_s).to be ==...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia.rb
bake/utopia.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. def environment(name: nil) if name ENV["UTOPIA_ENV"] = name end require File.expand_path("config/environment", context.root) end # Start the development server. def development self.environment exec...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/environment.rb
bake/utopia/environment.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2025, by Samuel Williams. # Update environment variables in config/environment.yaml def initialize(...) super require "securerandom" require "yaml/store" require "console" end # Setup default environemnts "testing" and "developme...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/node.rb
bake/utopia/node.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. NPM = ENV["NPM"] || "npm" def update require "fileutils" require "utopia/path" root = Pathname.new(context.root) package_root = root + "node_modules" # This is a legacy path: unless package_root.dire...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/static.rb
bake/utopia/static.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. def generate(output_path: "static") require "falcon/server" require "async/io" require "async/http/endpoint" require "async/container" config_path = File.join(Dir.pwd, "config.ru") container_class = Asy...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/shell.rb
bake/utopia/shell.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2025, by Samuel Williams. def shell call "utopia:environment" require "utopia/shell" binding = Utopia::Shell.new(self.context).binding IRB.setup(binding.source_location[0], argv: []) workspace = IRB::WorkSpace.new(binding) ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/server.rb
bake/utopia/server.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. def initialize(...) super require "fileutils" require "socket" end # Create a remote Utopia website suitable for deployment using git. def create(root: context.root) FileUtils.mkdir_p File.join(root, "pu...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/bake/utopia/site.rb
bake/utopia/site.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. # Copyright, 2020, by Michael Adams. def initialize(...) super require "fileutils" require "find" require "console" require_relative "../../lib/utopia/version" end # The path to the setup directory in...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/gems.rb
setup/site/gems.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2012-2025, by Samuel Williams. source "https://rubygems.org" group :preload do gem "utopia", "~> $UTOPIA_VERSION" # gem 'utopia-gallery' # gem 'utopia-analytics' gem "variant" end gem "net-smtp" group :development do gem "bake-test...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/falcon.rb
setup/site/falcon.rb
#!/usr/bin/env -S falcon host # frozen_string_literal: true # Released under the MIT License. # Copyright, 2019-2022, by Samuel Williams. load :rack, :lets_encrypt_tls, :supervisor hostname = File.basename(__dir__) rack hostname, :lets_encrypt_tls supervisor
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/bake.rb
setup/site/bake.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2025, by Samuel Williams. def deploy # This task is typiclly run after the site is updated but before the server is restarted. end # Restart the application server. def restart call "falcon:supervisor:restart" end # Start the develo...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/fixtures/website.rb
setup/site/fixtures/website.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "rack/test" require "sus/fixtures/async/http" require "protocol/rack" AWebsite = Sus::Shared("a website") do include Rack::Test::Methods let(:rackup_path) {File.expand_path("../config.ru", __dir__)...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/test/website.rb
setup/site/test/website.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "website" require "benchmark/http" describe "website" do include_context AServer let(:timeout) {10} let(:spider) {Benchmark::HTTP::Spider.new(depth: 128)} let(:statistics) {Benchmark::HTTP::Stati...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/config/environment.rb
setup/site/config/environment.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "bundler/setup" Bundler.setup require "utopia/setup" UTOPIA ||= Utopia.setup
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/setup/site/config/sus.rb
setup/site/config/sus.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "variant" Variant.force!(:testing) require "covered/sus" include Covered::Sus
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia.rb
lib/utopia.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "utopia/version" require_relative "utopia/import_map" require_relative "utopia/content" require_relative "utopia/controller" require_relative "utopia/exceptions" require_relative "utopia/redir...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/path.rb
lib/utopia/path.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. module Utopia # Represents a path as an array of path components. Useful for efficient URL manipulation. class Path include Comparable SEPARATOR = "/" def initialize(components = []) @component...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content.rb
lib/utopia/content.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "content/middleware" module Utopia module Content def self.new(...) Middleware.new(...) end end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/session.rb
lib/utopia/session.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. # Copyright, 2019, by Huba Nagy. require_relative "session/middleware" module Utopia module Session def self.new(...) Middleware.new(...) end end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/version.rb
lib/utopia/version.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. module Utopia VERSION = "2.32.0" end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/exceptions.rb
lib/utopia/exceptions.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require_relative "exceptions/handler" require_relative "exceptions/mailer" module Utopia # Middleware for handling exceptional situations. module Exceptions end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/setup.rb
lib/utopia/setup.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2010-2025, by Samuel Williams. require "yaml" require "securerandom" require "variant" require "console" module Utopia # Used for setting up a Utopia web application, typically via `config/environment.rb` class Setup def initialize(ro...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/middleware.rb
lib/utopia/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "http" require_relative "path" module Utopia # The default pages path for {Utopia::Content} middleware. PAGES_PATH = "pages".freeze # This is used for shared controller variables which ge...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/static.rb
lib/utopia/static.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "static/middleware" module Utopia module Static def self.new(...) Middleware.new(...) end end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/localization.rb
lib/utopia/localization.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "localization/middleware" module Utopia module Localization def self.new(...) Middleware.new(...) end end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/http.rb
lib/utopia/http.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2010-2025, by Samuel Williams. require "rack" require "http/accept" module Utopia # HTTP protocol implementation. module HTTP # Pull in {::HTTP::Accept} for parsing. Accept = ::HTTP::Accept # A list of commonly used HTTP status ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller.rb
lib/utopia/controller.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "controller/middleware" module Utopia module Controller def self.new(...) Middleware.new(...) end end end
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/shell.rb
lib/utopia/shell.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2025, by Samuel Williams. require "rack/builder" require "rack/test" require "irb" module Utopia # This is designed to be used with the corresponding bake task. class Shell include Rack::Test::Methods def initialize(context) ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/redirection.rb
lib/utopia/redirection.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "middleware" module Utopia # A middleware which assists with redirecting from one path to another. module Redirection # An error handler fails to redirect to a valid page. class RequestF...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/import_map.rb
lib/utopia/import_map.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "json" require "xrb" require "protocol/url" module Utopia # Represents an import map for JavaScript modules with support for URI and relative path resolution. # Import maps allow you to control how JavaSc...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/actions.rb
lib/utopia/controller/actions.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. require_relative "../http" module Utopia module Controller # A controller layer which invokes functinality based on the request path. # @example # on '*' do |request, path| # succeed! content: 'Hel...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/middleware.rb
lib/utopia/controller/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "../path" require_relative "../middleware" require_relative "variables" require_relative "base" require_relative "rewrite" require_relative "respond" require_relative "actions" require "concu...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/responder.rb
lib/utopia/controller/responder.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2025, by Samuel Williams. require_relative "middleware" module Utopia module Controller module Handlers module JSON APPLICATION_JSON = HTTP::Accept::ContentType.new("application", "json").freeze def self.split(*argum...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/rewrite.rb
lib/utopia/controller/rewrite.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require_relative "../http" require_relative "../path/matcher" module Utopia module Controller # This controller layer rewrites the path before executing controller actions. When the rule matches, the suppli...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/variables.rb
lib/utopia/controller/variables.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. require_relative "../middleware" module Utopia module Controller # Provides a stack-based instance variable lookup mechanism. It can flatten a stack of controllers into a single hash. class Variables d...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/base.rb
lib/utopia/controller/base.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. require_relative "../http" module Utopia module Controller CONTENT_TYPE = HTTP::CONTENT_TYPE # The base implementation of a controller class. class Base URI_PATH = nil BASE_PATH = nil CONTRO...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/controller/respond.rb
lib/utopia/controller/respond.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require_relative "../http" require_relative "responder" module Utopia module Controller # A controller layer which provides a convenient way to respond to different requested content types. The order in whi...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/middleware.rb
lib/utopia/content/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "../middleware" require_relative "../localization" require_relative "links" require_relative "node" require_relative "markup" require_relative "tags" require "xrb/template" require "concurren...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/namespace.rb
lib/utopia/content/namespace.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2022, by Samuel Williams. module Utopia module Content # A namespace which contains tags which can be rendered within a {Document}. module Namespace def self.extended(other) other.class_exec do @named = {} end en...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/node.rb
lib/utopia/content/node.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. # Copyright, 2015, by Huba Nagy. require_relative "markup" require_relative "links" require_relative "document" require "pathname" module Utopia module Content # Represents an immutable node within the co...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/response.rb
lib/utopia/content/response.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2010-2025, by Samuel Williams. module Utopia module Content # Compatibility with older versions of rack: EXPIRES = "expires".freeze CACHE_CONTROL = "cache-control".freeze CONTENT_TYPE = "content-type".freeze NO_CACHE = "no-cache"....
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/link.rb
lib/utopia/content/link.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. # Copyright, 2017, by Huba Nagy. # Copyright, 2020, by Michael Adams. require "yaml" require "xrb/builder" require "xrb/strings" require_relative "../path" module Utopia module Content # Represents a link...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/markup.rb
lib/utopia/content/markup.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require "xrb/parsers" require "xrb/entities" require "xrb/strings" require "xrb/tag" module Utopia module Content Tag = XRB::Tag # A hash which forces all keys to be symbols and fails with KeyError whe...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/builder.rb
lib/utopia/content/builder.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "xrb/builder" module Utopia module Content DEFERRED_TAG_NAME = "utopia:deferred".freeze # A builder for rendering Utopia content that extends XRB::Builder with Utopia-specific functionality. class...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/document.rb
lib/utopia/content/document.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require_relative "links" require_relative "response" require_relative "markup" require_relative "builder" module Utopia module Content # This error is raised if a tag doesn't match up when parsing. class ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/tags.rb
lib/utopia/content/tags.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2012-2025, by Samuel Williams. require_relative "namespace" require "variant" module Utopia module Content # Tags which provide intrinsic behaviour within the content middleware. module Tags extend Namespace # Invokes a node...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/content/links.rb
lib/utopia/content/links.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require_relative "link" require "concurrent/map" module Utopia module Content # The file extension for markup nodes on disk. XNODE_EXTENSION = ".xnode" INDEX = "index" class Links def self.for(...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/static/middleware.rb
lib/utopia/static/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "../middleware" require_relative "../localization" require_relative "local_file" require_relative "mime_types" require "traces/provider" module Utopia module Static DEFAULT_CACHE_CONTROL ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/static/local_file.rb
lib/utopia/static/local_file.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "time" require "digest/sha1" module Utopia # A middleware which serves static files from the specified root directory. module Static # Represents a local file on disk which can be served directly, ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/static/mime_types.rb
lib/utopia/static/mime_types.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2017-2025, by Samuel Williams. require "mime/types" module Utopia # A middleware which serves static files from the specified root directory. module Static # Default mime-types which are common for files served over HTTP: MIME_TYPES =...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/exceptions/mailer.rb
lib/utopia/exceptions/mailer.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2016-2025, by Samuel Williams. require "net/smtp" require "mail" module Utopia module Exceptions # A middleware which catches all exceptions raised from the app it wraps and sends a useful email with the exception, stacktrace, and conten...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/exceptions/handler.rb
lib/utopia/exceptions/handler.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. # Copyright, 2025, by Olle Jonsson. require "console" module Utopia module Exceptions # A middleware which catches exceptions and performs an internal redirect. class Handler # @param location [String]...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/extensions/array_split.rb
lib/utopia/extensions/array_split.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. module Utopia module Extensions module ArraySplit def split_at(*arguments, &block) if middle = index(*arguments, &block) [self[0...middle], self[middle], self[middle+1..-1]] else [[], ni...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/extensions/date_comparisons.rb
lib/utopia/extensions/date_comparisons.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2010-2025, by Samuel Williams. require "date" module Utopia module Extensions # Provides comparison operator extensions. module TimeDateComparison def <=>(other) if Date === other or DateTime === other self.to_datetime <=> ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/localization/middleware.rb
lib/utopia/localization/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "wrapper" module Utopia module Localization class Middleware RESOURCE_NOT_FOUND = [400, {}, []].freeze HTTP_ACCEPT_LANGUAGE = "HTTP_ACCEPT_LANGUAGE".freeze # @param locales...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/localization/wrapper.rb
lib/utopia/localization/wrapper.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2009-2025, by Samuel Williams. require_relative "middleware" module Utopia # A middleware which attempts to find localized content. module Localization LOCALIZATION_KEY = "utopia.localization".freeze CURRENT_LOCALE_KEY = "utopia.local...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/session/serialization.rb
lib/utopia/session/serialization.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2019-2025, by Samuel Williams. require "msgpack" require "time" require "date" module Utopia module Session class Serialization def initialize @factory = MessagePack::Factory.new @factory.register_type(0x00, Symbol, pack...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/session/middleware.rb
lib/utopia/session/middleware.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2025, by Samuel Williams. # Copyright, 2019, by Huba Nagy. require "openssl" require "digest/sha2" require "console" require "json" require_relative "lazy_hash" require_relative "serialization" module Utopia module Session # A midd...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/session/lazy_hash.rb
lib/utopia/session/lazy_hash.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2014-2022, by Samuel Williams. module Utopia module Session # A simple hash table which fetches it's values only when required. class LazyHash def initialize(&block) @changed = false @values = nil @loader = block ...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/lib/utopia/path/matcher.rb
lib/utopia/path/matcher.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2015-2025, by Samuel Williams. require_relative "../path" module Utopia class Path # Performs structured, efficient, matches against {Path} instances. Supports regular expressions, type-casts and constants. # @example # path = Utopi...
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
socketry/utopia
https://github.com/socketry/utopia/blob/e8c13eb0a2333604ac73a86e6eae5811188b391d/config/sus.rb
config/sus.rb
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023-2025, by Samuel Williams. require "covered/sus" include Covered::Sus
ruby
MIT
e8c13eb0a2333604ac73a86e6eae5811188b391d
2026-01-04T17:41:40.378363Z
false
maccman/catapult
https://github.com/maccman/catapult/blob/911266797a94ee79cb72548bb92efb53ce9c5955/lib/catapult.rb
lib/catapult.rb
require 'pathname' require 'sprockets' require 'sprockets/commonjs' require 'stylus/sprockets' require 'coffee_script' module Catapult autoload :CLI, 'catapult/cli' autoload :Compressor, 'catapult/compressor' autoload :TryStatic, 'catapult/try_static' def self.root @root ||= Pathname('.').expand_path en...
ruby
MIT
911266797a94ee79cb72548bb92efb53ce9c5955
2026-01-04T17:41:53.346716Z
false
maccman/catapult
https://github.com/maccman/catapult/blob/911266797a94ee79cb72548bb92efb53ce9c5955/lib/catapult/try_static.rb
lib/catapult/try_static.rb
module Catapult # The Rack::TryStatic middleware delegates requests to Rack::Static middleware # trying to match a static file # # Examples # # use Rack::TryStatic, # :root => "public", # static files root dir # :urls => %w[/], # match all requests # :try => ['.html', 'index.html', '/index....
ruby
MIT
911266797a94ee79cb72548bb92efb53ce9c5955
2026-01-04T17:41:53.346716Z
false
maccman/catapult
https://github.com/maccman/catapult/blob/911266797a94ee79cb72548bb92efb53ce9c5955/lib/catapult/version.rb
lib/catapult/version.rb
module Catapult VERSION = '0.0.4' end
ruby
MIT
911266797a94ee79cb72548bb92efb53ce9c5955
2026-01-04T17:41:53.346716Z
false
maccman/catapult
https://github.com/maccman/catapult/blob/911266797a94ee79cb72548bb92efb53ce9c5955/lib/catapult/cli.rb
lib/catapult/cli.rb
require 'pathname' require 'fileutils' require 'listen' require 'rack' require 'thor' module Catapult class CLI < Thor include Thor::Actions def self.source_root File.expand_path('../../..', __FILE__) end desc 'build [asset1 asset2..]', 'Build project' method_option :target, :aliases => ...
ruby
MIT
911266797a94ee79cb72548bb92efb53ce9c5955
2026-01-04T17:41:53.346716Z
false
maccman/catapult
https://github.com/maccman/catapult/blob/911266797a94ee79cb72548bb92efb53ce9c5955/lib/catapult/compressor.rb
lib/catapult/compressor.rb
module Catapult module Compressor class JS def compress(source, options = {}) require 'uglifier' Uglifier.compile(source, options) end end class CSS def compress(source, options = {}) require 'yui/compressor' compressor = YUI::CssCompressor.new(options) ...
ruby
MIT
911266797a94ee79cb72548bb92efb53ce9c5955
2026-01-04T17:41:53.346716Z
false