hamster-web 0.1.0.pre.2 → 0.1.0.pre.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +576 -5
- data/lib/hamster/agent_guidance.rb +56 -0
- data/lib/hamster/application_graph.rb +336 -0
- data/lib/hamster/build/assets.rb +72 -0
- data/lib/hamster/build/callbacks.rb +124 -0
- data/lib/hamster/build/jobs.rb +78 -0
- data/lib/hamster/build/manifest.rb +31 -9
- data/lib/hamster/build/query_accessors.rb +18 -0
- data/lib/hamster/check.rb +122 -0
- data/lib/hamster/cli.rb +105 -12
- data/lib/hamster/data/persistence.rb +11 -6
- data/lib/hamster/data/read/nodes.rb +2 -0
- data/lib/hamster/data/read/schema.rb +28 -16
- data/lib/hamster/data/read/validator.rb +3 -0
- data/lib/hamster/data/record.rb +15 -1
- data/lib/hamster/data/table.rb +22 -3
- data/lib/hamster/database/database.rb +2 -25
- data/lib/hamster/database/migrator.rb +151 -0
- data/lib/hamster/database/pool.rb +7 -3
- data/lib/hamster/database/result.rb +3 -3
- data/lib/hamster/dev.rb +116 -0
- data/lib/hamster/endpoint_generator.rb +7 -0
- data/lib/hamster/form.rb +110 -0
- data/lib/hamster/generators/plan.rb +96 -0
- data/lib/hamster/generators/runner.rb +168 -0
- data/lib/hamster/jobs/adapters.rb +106 -0
- data/lib/hamster/jobs/postgres_queue.rb +146 -0
- data/lib/hamster/jobs/worker.rb +103 -0
- data/lib/hamster/jobs.rb +116 -0
- data/lib/hamster/migration.rb +36 -0
- data/lib/hamster/native_smoke.rb +53 -0
- data/lib/hamster/schema_validation.rb +4 -2
- data/lib/hamster/storage/disk.rb +89 -0
- data/lib/hamster/storage.rb +152 -0
- data/lib/hamster/test_database.rb +63 -0
- data/lib/hamster/test_runner.rb +29 -0
- data/lib/hamster/testing.rb +110 -0
- data/lib/hamster/web/action/base.rb +49 -4
- data/lib/hamster/web/application.rb +9 -0
- data/lib/hamster/web/assets.rb +28 -0
- data/lib/hamster/web/context.rb +122 -1
- data/lib/hamster/web/files.rb +118 -0
- data/lib/hamster/web/http.rb +4 -2
- data/lib/hamster/web/json.rb +39 -0
- data/lib/hamster/web/multipart.rb +138 -0
- data/lib/hamster/web/router.rb +13 -2
- data/lib/hamster/web/routing/base.rb +4 -2
- data/lib/hamster/web/turbo.rb +24 -0
- data/lib/hamster/web/version.rb +1 -1
- data/lib/hamster/web/view/form.rb +18 -1
- data/lib/hamster/web.rb +9 -0
- data/templates/app/.agents/skills/hamster-database/SKILL.md +29 -0
- data/templates/app/.agents/skills/hamster-endpoint/SKILL.md +27 -0
- data/templates/app/.dockerignore +19 -0
- data/templates/app/AGENTS.md +20 -7
- data/templates/app/Dockerfile +77 -0
- data/templates/app/Gemfile +5 -1
- data/templates/app/README.md +365 -2
- data/templates/app/app/application.rb +15 -0
- data/templates/app/app/assets/application.css +2 -0
- data/templates/app/app/assets/application.js +2 -0
- data/templates/app/app/assets/controllers/hello_controller.js +5 -0
- data/templates/app/app/assets/vendor/VERSIONS.md +12 -0
- data/templates/app/app/assets/vendor/stimulus.LICENSE.txt +9 -0
- data/templates/app/app/assets/vendor/stimulus.js +2563 -0
- data/templates/app/app/assets/vendor/turbo.LICENSE.txt +20 -0
- data/templates/app/app/assets/vendor/turbo.js +7178 -0
- data/templates/app/app/routes/mappings.rb +1 -0
- data/templates/app/app/routes/up/index/action.rb +14 -0
- data/templates/app/app/views/layouts/application.html.erb +2 -1
- data/templates/app/bin/hamster +8 -0
- data/templates/app/bin/server +13 -1
- data/templates/app/bin/worker +24 -0
- data/templates/app/config/application.rb +1 -1
- data/templates/app/config/deploy.worker.yml.example +32 -0
- data/templates/app/public/.keep +0 -0
- data/templates/app/test/home_test.rb +8 -0
- data/templates/app/test/native_http.rb +11 -0
- data/templates/app/test/native_server.rb +10 -0
- data/templates/app/test/test_helper.rb +8 -0
- metadata +58 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hamster-endpoint
|
|
3
|
+
description: Generate or modify endpoints, views, routes, and callback concerns in this Hamster application. Use for Hamster HTTP behavior, not database schema changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read the project AGENTS.md. Inspect nearby actions, routes, concerns, and the
|
|
7
|
+
project's test instructions before editing.
|
|
8
|
+
|
|
9
|
+
1. Consult `bin/hamster generate --help` and `bin/hamster generate --schema` for
|
|
10
|
+
the installed framework's supported options. Prefer `generate endpoint` for
|
|
11
|
+
scaffolding; do not recreate the generator in scripts or assume other
|
|
12
|
+
generator types exist.
|
|
13
|
+
2. Implement the endpoint's `call`. Use `respond`, `redirect_to`, `send_file`, or
|
|
14
|
+
`send_data` as appropriate. Keep authentication and authorization explicit.
|
|
15
|
+
3. Reuse concerns under `app/concerns/`; modules that register hooks extend
|
|
16
|
+
`Hamster::Action::Callbacks`. Callback names must be literal symbols and
|
|
17
|
+
resolve to existing methods. Before hooks return nil or a response; after
|
|
18
|
+
hooks receive the response and run only after a successful action.
|
|
19
|
+
4. Run `bin/hamster manifest`, `bin/hamster manifest:check`, and
|
|
20
|
+
`bin/hamster build`. Run documented project tests and exercise changed HTTP
|
|
21
|
+
behavior against the compiled server, including authorization failures.
|
|
22
|
+
|
|
23
|
+
Generation safely rejects customized route layouts it cannot update. Inspect
|
|
24
|
+
that diagnostic and make a focused manual edit when necessary. Do not add
|
|
25
|
+
runtime eval, reflective callback dispatch, local application requires, or
|
|
26
|
+
unsupported CLI commands. Run `bin/hamster check --quick` and `check --full` for the shared validation harness. Keep compiler/build tooling outside the
|
|
27
|
+
runtime require chain.
|
data/templates/app/AGENTS.md
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hamster application conventions
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
3
|
+
Guidance version: __HAMSTER_VERSION__. Project-local skills live in
|
|
4
|
+
`.agents/skills/hamster-endpoint/SKILL.md` and
|
|
5
|
+
`.agents/skills/hamster-database/SKILL.md`. Read the relevant skill explicitly if
|
|
6
|
+
your agent does not discover it automatically.
|
|
7
|
+
|
|
8
|
+
- Start endpoint work with `bin/hamster generate --help` and `bin/hamster generate --schema`; prefer the supported generator to handwritten scaffolding.
|
|
9
|
+
- Keep one action per endpoint directory, routes in `app/routes/mappings.rb`, and shared callback modules in `app/concerns/`.
|
|
10
|
+
- App Ruby files load through `config/manifest.rb`; do not add local requires or runtime eval. Migration Ruby belongs exclusively in CRuby tooling.
|
|
11
|
+
- Run `bin/hamster manifest` after changing Ruby, views, or callback declarations; run `bin/hamster manifest:check` and `bin/hamster build` to verify native compatibility.
|
|
12
|
+
- Run `bin/hamster check --quick` during edits and `bin/hamster check --full` before completion. Use `--json` for stable diagnostics. Use `bin/hamster test [test/path] [--json]` for request tests. Full checks include project tests and native HTTP smoke checks.
|
|
13
|
+
- Use explicit migration `up`/`down`; inspect `db:migrate:status` and `db:migrate:history --json` before changing the database. Never edit applied migrations to change a schema.
|
|
14
|
+
- Obtain explicit authorization for production database mutations. Do not assume local environment variables identify a disposable database.
|
|
15
|
+
- Keep authentication and authorization explicit. Before hooks halt only with an HTTP response; after hooks are not unconditional cleanup hooks.
|
|
16
|
+
- Uploaded files are request-owned; use `copy_to` for durable storage. File downloads require an authorized action and explicit trusted root.
|
|
17
|
+
- Update guidance with `bin/hamster agents:install --dry-run` first. Customized guidance must be merged manually; it is never silently overwritten.
|
|
18
|
+
|
|
19
|
+
- Inspect static dependencies with `bin/hamster inspect action resource/action --json` and use `inspect --check` for declaration diagnostics.
|
|
20
|
+
- Use explicit JSON fields, form declarations and authorization callbacks for private attachments. Storage keys and job payloads must not contain request-owned IO or connection objects.
|
|
21
|
+
- Jobs declare a literal name/version and compile through the generated registry. Use `build:worker`/`jobs:work` for durable workers; apply queue migrations explicitly and keep jobs idempotent.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Build with Docker only; Spinel and Ruby are installed inside the builder.
|
|
2
|
+
ARG RUBY_IMAGE=ruby:3.3.6-bookworm@sha256:347edd0c70ee08d87de9f01b99de2f14a64cedb5d1bfb38457dfe8cd0bf113c5
|
|
3
|
+
ARG RUNTIME_IMAGE=debian:bookworm-slim@sha256:99c0b25c46d0214d5a2091092e7908907dcaecd6a962cde0ac700acee222b6f3
|
|
4
|
+
FROM ${RUBY_IMAGE} AS toolchain
|
|
5
|
+
ARG SPINEL_REVISION=10f112c51666e7ffd308e0ab90a69c2184870c06
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
7
|
+
build-essential ca-certificates curl git libffi-dev libssl-dev pkg-config \
|
|
8
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
9
|
+
RUN mkdir /src && cd /src && git init \
|
|
10
|
+
&& git remote add origin https://github.com/matz/spinel.git \
|
|
11
|
+
&& git fetch --depth 1 origin "$SPINEL_REVISION" && git checkout --detach FETCH_HEAD \
|
|
12
|
+
&& test "$(git rev-parse HEAD)" = "$SPINEL_REVISION" \
|
|
13
|
+
&& make deps && make -j2 && make install PREFIX=/opt/spinel \
|
|
14
|
+
&& rm -rf /src
|
|
15
|
+
ENV PATH="/opt/spinel/bin:${PATH}"
|
|
16
|
+
RUN gem install bundler --version 2.5.23 --no-document \
|
|
17
|
+
&& gem install hamster-web --version __HAMSTER_VERSION__ --no-document
|
|
18
|
+
|
|
19
|
+
FROM toolchain AS builder
|
|
20
|
+
WORKDIR /app
|
|
21
|
+
COPY . .
|
|
22
|
+
# Setup and compilation require no database connection or credentials.
|
|
23
|
+
RUN bin/hamster setup && bin/hamster manifest && bin/hamster manifest:check && bin/hamster build
|
|
24
|
+
RUN mkdir -p /runtime/app/bin /runtime/app/db/migrations /runtime/app/public \
|
|
25
|
+
&& cp bin/__APP_NAME__-server /runtime/app/bin/ \
|
|
26
|
+
&& cp -a db/migrations/. /runtime/app/db/migrations/ \
|
|
27
|
+
&& cp -a public/. /runtime/app/public/ \
|
|
28
|
+
&& ldd bin/__APP_NAME__-server > /runtime/ldd.txt \
|
|
29
|
+
&& cat /runtime/ldd.txt && ! grep -F 'not found' /runtime/ldd.txt
|
|
30
|
+
|
|
31
|
+
# Optional operational image. Migrations run explicitly, never during build/boot.
|
|
32
|
+
FROM builder AS migrations
|
|
33
|
+
ENV HAMSTER_APP_ROOT=/app HAMSTER_ENV=production
|
|
34
|
+
ENTRYPOINT ["bin/hamster"]
|
|
35
|
+
CMD ["db:migrate"]
|
|
36
|
+
|
|
37
|
+
# Optional separately deployed native worker image; no HTTP listener or probe.
|
|
38
|
+
FROM builder AS worker-builder
|
|
39
|
+
RUN bin/hamster build:worker \
|
|
40
|
+
&& mkdir -p /runtime-worker/app/bin /runtime-worker/app/db/migrations \
|
|
41
|
+
&& cp bin/__APP_NAME__-worker /runtime-worker/app/bin/ \
|
|
42
|
+
&& cp -a db/migrations/. /runtime-worker/app/db/migrations/ \
|
|
43
|
+
&& ldd bin/__APP_NAME__-worker > /runtime-worker/ldd.txt \
|
|
44
|
+
&& cat /runtime-worker/ldd.txt && ! grep -F 'not found' /runtime-worker/ldd.txt
|
|
45
|
+
|
|
46
|
+
FROM ${RUNTIME_IMAGE} AS worker
|
|
47
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
48
|
+
ca-certificates libcrypt1 libffi8 libssl3 \
|
|
49
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
50
|
+
WORKDIR /app
|
|
51
|
+
COPY --from=worker-builder /runtime-worker/app/ /app/
|
|
52
|
+
RUN ldd /app/bin/__APP_NAME__-worker > /tmp/ldd.txt \
|
|
53
|
+
&& cat /tmp/ldd.txt && ! grep -F 'not found' /tmp/ldd.txt && rm /tmp/ldd.txt
|
|
54
|
+
ENV HAMSTER_APP_ROOT=/app HAMSTER_ENV=production
|
|
55
|
+
USER 10001:10001
|
|
56
|
+
STOPSIGNAL SIGTERM
|
|
57
|
+
HEALTHCHECK NONE
|
|
58
|
+
ENTRYPOINT ["/app/bin/__APP_NAME__-worker"]
|
|
59
|
+
CMD []
|
|
60
|
+
|
|
61
|
+
FROM ${RUNTIME_IMAGE} AS runtime
|
|
62
|
+
# Runtime libraries and a small HTTP health probe; no Ruby, gems or compiler.
|
|
63
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
64
|
+
ca-certificates curl libcrypt1 libffi8 libssl3 \
|
|
65
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
66
|
+
WORKDIR /app
|
|
67
|
+
COPY --from=builder /runtime/app/ /app/
|
|
68
|
+
# Check linkage in the actual runtime image as well as in the builder.
|
|
69
|
+
RUN ldd /app/bin/__APP_NAME__-server > /tmp/ldd.txt \
|
|
70
|
+
&& cat /tmp/ldd.txt && ! grep -F 'not found' /tmp/ldd.txt && rm /tmp/ldd.txt
|
|
71
|
+
ENV HAMSTER_APP_ROOT=/app HAMSTER_ENV=production HOST=0.0.0.0 PORT=4000
|
|
72
|
+
USER 10001:10001
|
|
73
|
+
EXPOSE 4000
|
|
74
|
+
STOPSIGNAL SIGTERM
|
|
75
|
+
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
|
|
76
|
+
CMD curl --fail --silent --show-error --max-time 2 "http://127.0.0.1:${PORT}/up" > /dev/null || exit 1
|
|
77
|
+
ENTRYPOINT ["/app/bin/__APP_NAME__-server"]
|
data/templates/app/Gemfile
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
gem "hamster-web", "= __HAMSTER_VERSION__", require: "hamster/web"
|
|
3
|
-
gem "spinel-spinner", "= 0.1.0.pre.
|
|
3
|
+
gem "spinel-spinner", "= 0.1.0.pre.4", require: "spinner"
|
|
4
|
+
|
|
5
|
+
group :test do
|
|
6
|
+
gem "minitest", "~> 5.25"
|
|
7
|
+
end
|
data/templates/app/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# __APP_NAME__
|
|
2
2
|
|
|
3
3
|
Run `bin/hamster setup` to install gems and vendor the locked Spin PostgreSQL driver.
|
|
4
|
-
Spin and Spinel must already be installed.
|
|
4
|
+
Spin and Spinel must already be installed. The preview installation contract is
|
|
5
|
+
Ruby 3.3.6, Bundler 2.5.23, Hamster __HAMSTER_VERSION__, spinel-spinner
|
|
6
|
+
0.1.0.pre.4, and Spinel/Spin revision
|
|
7
|
+
`10f112c51666e7ffd308e0ab90a69c2184870c06`. See the framework README at
|
|
8
|
+
https://github.com/dostaglou/hamster-web for compiler installation prerequisites.
|
|
9
|
+
Spinner's gem name is `spinel-spinner`; application code uses `require "spinner"`.
|
|
10
|
+
Both gems are available from https://rubygems.org. Configure DATABASE_USERNAME,
|
|
5
11
|
DATABASE_PASSWORD, and optionally DATABASE_HOST and DATABASE_PORT for your local
|
|
6
12
|
PostgreSQL server. DATABASE_NAME defaults to __APP_NAME___development.
|
|
7
13
|
|
|
@@ -14,7 +20,7 @@ then `bin/hamster serve`. Build does not require a database connection.
|
|
|
14
20
|
An empty migration directory is valid; db:migrate initializes migration tracking.
|
|
15
21
|
The server listens on http://127.0.0.1:4000 by default; configure HOST and PORT
|
|
16
22
|
to override it. During framework development, install the local hamster-web
|
|
17
|
-
gem before running setup.
|
|
23
|
+
gem before running setup. Otherwise the pinned framework is installed from RubyGems.
|
|
18
24
|
|
|
19
25
|
Run a deployed binary from the application root or set HAMSTER_APP_ROOT.
|
|
20
26
|
Include db/migrations alongside the binary. PostgreSQL TLS is not supported
|
|
@@ -30,3 +36,360 @@ Each endpoint has an action.rb and optional view.html.erb in app/routes/.
|
|
|
30
36
|
Declare endpoints centrally in app/routes/mappings.rb. Run
|
|
31
37
|
`bin/hamster manifest` after changing Ruby sources or templates and commit
|
|
32
38
|
the generated manifest and view registry with your source changes.
|
|
39
|
+
|
|
40
|
+
## Docker deployment
|
|
41
|
+
|
|
42
|
+
The generated Dockerfile builds the Spinel compiler and `spin` at the pinned
|
|
43
|
+
revision, installs the framework from RubyGems, runs setup and manifest checks,
|
|
44
|
+
and compiles your application. Docker is the only build prerequisite on the
|
|
45
|
+
host. Commit `Gemfile.lock` and `spin.lock` to keep dependency resolution stable.
|
|
46
|
+
No database or database credentials are needed to build either target.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
docker build -t __APP_NAME__:latest .
|
|
50
|
+
docker build --target migrations -t __APP_NAME__:migrations .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The default image uses Debian Bookworm slim and UID/GID 10001. It contains the
|
|
54
|
+
native executable, shared runtime libraries, SQL migrations and `public/`;
|
|
55
|
+
Ruby, gems, Spinel, application source and build tools stay in the builder.
|
|
56
|
+
Both builder and runtime verify the executable's shared library linkage with
|
|
57
|
+
`ldd`. Public files include fingerprinted assets served through Hamster's whitelist.
|
|
58
|
+
|
|
59
|
+
Provide database settings at container runtime, for example in an uncommitted
|
|
60
|
+
`.env.production` file. Set `DATABASE_HOST`, `DATABASE_PORT`, `DATABASE_NAME`,
|
|
61
|
+
`DATABASE_USERNAME`, and `DATABASE_PASSWORD`. The production database name
|
|
62
|
+
defaults to `__APP_NAME___production`. The database must already exist; use
|
|
63
|
+
`db:create` with separate administrative credentials only when provisioning it.
|
|
64
|
+
The Docker context excludes `.env` files, private keys, local gems, compiled
|
|
65
|
+
host binaries, and local Bundler settings. Keep credentials out of Ruby source
|
|
66
|
+
and Docker build arguments as well.
|
|
67
|
+
|
|
68
|
+
Apply migrations explicitly as a deployment step, then start the native image:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
docker run --rm --env-file .env.production __APP_NAME__:migrations
|
|
72
|
+
docker run -d --name __APP_NAME__ --env-file .env.production -p 4000:4000 __APP_NAME__:latest
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `migrations` target includes Ruby and build dependencies for the existing
|
|
76
|
+
Hamster CLI; it is a separate operational image. Its default command is
|
|
77
|
+
`db:migrate`, and an explicit argument can select another command. Neither
|
|
78
|
+
image build nor native server startup applies migrations. Startup verifies the
|
|
79
|
+
configured database and rejects missing migration tracking or pending migrations.
|
|
80
|
+
|
|
81
|
+
The runtime sets `HAMSTER_APP_ROOT=/app`, `HAMSTER_ENV=production`,
|
|
82
|
+
`HOST=0.0.0.0` and `PORT=4000`. Override `PORT` and the port mapping together if
|
|
83
|
+
needed. The executable runs directly as PID 1 and receives SIGTERM. Allow its
|
|
84
|
+
graceful shutdown time when stopping it, for example `docker stop -t 20 __APP_NAME__`.
|
|
85
|
+
Only temporary storage needs to be writable; the CI smoke test runs with a
|
|
86
|
+
read-only root filesystem and a writable `/tmp`.
|
|
87
|
+
|
|
88
|
+
`GET /up` returns HTTP 200 with `OK` after successful startup. This is liveness:
|
|
89
|
+
it checks HTTP dispatch without checking out a database connection. A later
|
|
90
|
+
database outage does not make `/up` fail. It is not a readiness check or a
|
|
91
|
+
promise that application requests can reach PostgreSQL. The route is declared
|
|
92
|
+
in `app/routes/mappings.rb`, and `app/application.rb` bypasses the normal
|
|
93
|
+
database checkout for that path. The Docker health check calls `/up` using the
|
|
94
|
+
configured `PORT`.
|
|
95
|
+
|
|
96
|
+
### Composable generators
|
|
97
|
+
|
|
98
|
+
Use `bin/hamster generate --schema` for the installed contract. Standalone
|
|
99
|
+
`action posts/show`, `view posts/show`, and `route posts/show --path /posts/:id`
|
|
100
|
+
compose the same files as `endpoint posts/show --view`. Use `--no-view` for a
|
|
101
|
+
body-only action. `route --to App::Routes::Posts::Show::Action` targets an existing
|
|
102
|
+
statically declared action. Automatic route edits require conventional literal
|
|
103
|
+
Mappings declarations; customized routing receives a diagnostic.
|
|
104
|
+
|
|
105
|
+
`generate table posts title:text` creates an explicit `Posts` declaration for
|
|
106
|
+
physical table `posts`; it never creates or migrates the database. `generate
|
|
107
|
+
migration create_posts` creates an intentionally unimplemented reversible Ruby
|
|
108
|
+
migration; fill in both methods before running it. `--timestamp YYYYMMDDhhmmss`
|
|
109
|
+
selects an explicit unique version.
|
|
110
|
+
|
|
111
|
+
All generators accept `--dry-run` and `--json`. JSON lists the exact changed
|
|
112
|
+
relative files, including refreshed manifests. Proposals are parsed and checked
|
|
113
|
+
in staging before writes; collisions, symlinks, and unresolved callbacks fail
|
|
114
|
+
without changing the app. Dry runs leave the app untouched.
|
|
115
|
+
|
|
116
|
+
### Shared checks and optional hooks
|
|
117
|
+
|
|
118
|
+
`bin/hamster check --quick` checks Ruby syntax, manifest freshness, literal route
|
|
119
|
+
references/conflicts and action view references without rewriting files or
|
|
120
|
+
connecting to a database. `--json` returns versioned diagnostic codes, relative
|
|
121
|
+
paths and line numbers. `check --full` adds project `test/**/*_test.rb` tests and
|
|
122
|
+
compiles `test/native_server.rb`, starts it on a private ephemeral loopback port,
|
|
123
|
+
and checks `/up`. It also runs `test/native_http.rb` when present. The default
|
|
124
|
+
native test entrypoint uses no database; database tests must explicitly select
|
|
125
|
+
an isolated disposable test database. CI runs full checks in the native consumer.
|
|
126
|
+
|
|
127
|
+
Run `bin/hamster hooks:install` explicitly from an app Git root to configure
|
|
128
|
+
`.githooks/pre-commit`; add `--pre-push` for full checks before pushing. Customized
|
|
129
|
+
hooks are preserved. Cloning or generating an app never changes Git config.
|
|
130
|
+
Hooks can be bypassed with Git's normal `--no-verify` option; CI is authoritative.
|
|
131
|
+
|
|
132
|
+
### JSON actions and explicit negotiation
|
|
133
|
+
|
|
134
|
+
Use `respond(json: {id: 1}, status: :created)` for UTF-8 JSON; `json: nil`
|
|
135
|
+
produces `null`. Supply exactly one of `view:`, `body:`, or `json:`. Only JSON
|
|
136
|
+
scalars, arrays, and hashes with string/symbol keys are supported. Select record
|
|
137
|
+
fields explicitly; arbitrary objects, duplicate normalized keys, cycles, invalid
|
|
138
|
+
UTF-8 and nonfinite numbers are rejected.
|
|
139
|
+
|
|
140
|
+
`context.json` lazily parses and caches `application/json` or `application/*+json`
|
|
141
|
+
bodies with a default 1 MiB limit (server-owned env key `hamster.json_max_bytes`
|
|
142
|
+
can lower it). Invalid bodies return 400, wrong media types 415, and oversized
|
|
143
|
+
bodies 413. JSON and form parsing are mutually exclusive per request. Spinner's
|
|
144
|
+
transport limit still applies independently.
|
|
145
|
+
|
|
146
|
+
Branch on `context.wants_json?` or `context.format` (`:html`, `:json`,
|
|
147
|
+
`:turbo_stream`, `:none`) when an endpoint offers variants. Negotiation honors
|
|
148
|
+
Accept quality/specificity and defaults to HTML for absent Accept or ties;
|
|
149
|
+
respond with 406 explicitly for `:none`. Negotiated responses include `Vary:
|
|
150
|
+
Accept, Turbo-Frame`, including the HTML branch. Existing HTML/Turbo rendering
|
|
151
|
+
continues through `respond(view: ...)` and `type: :turbo_stream`.
|
|
152
|
+
|
|
153
|
+
### Request tests and disposable databases
|
|
154
|
+
|
|
155
|
+
`bin/hamster test [test/path] [--json]` runs CRuby request tests. New endpoints
|
|
156
|
+
include tests that assert their actual generated response. `check --full` runs
|
|
157
|
+
the same tests plus compiled HTTP checks. Extend `test/native_http.rb` for your
|
|
158
|
+
application's native assertions; `test/native_server.rb` is an explicit test
|
|
159
|
+
entrypoint and defaults to no database.
|
|
160
|
+
|
|
161
|
+
`Hamster::Testing::Client` accepts headers, JSON, form, raw and multipart bodies;
|
|
162
|
+
responses expose status, headers, body, parsed `json`, and `content_type`. Bodies
|
|
163
|
+
and request inputs close even on HEAD or iteration failures. Tests inherit
|
|
164
|
+
`Hamster::Testing::Test` for status, content-type, HTML and JSON assertions.
|
|
165
|
+
|
|
166
|
+
For real database tests, require `hamster/test_database`, make the vendored pg
|
|
167
|
+
driver available, and call `Hamster::Testing::TestDatabase.with_database` with
|
|
168
|
+
your migration path. Explicitly set `HAMSTER_ENV=test`, `HAMSTER_TEST_DATABASE=1`
|
|
169
|
+
and `TEST_DATABASE_USERNAME` (plus optional TEST_DATABASE_HOST/PORT/PASSWORD).
|
|
170
|
+
Unset DATABASE_NAME and DATABASE_URL. Each invocation creates a unique database,
|
|
171
|
+
migrates it, and drops only that owned database in ensure. Non-loopback hosts
|
|
172
|
+
require `HAMSTER_TEST_ALLOW_REMOTE=1`; use a dedicated test PostgreSQL service.
|
|
173
|
+
`TestDatabase.rollback(database) { |connection| ... }` isolates fixture changes
|
|
174
|
+
within a transaction that always rolls back. Never share that connection with
|
|
175
|
+
another thread. No production endpoint is inferred from application settings.
|
|
176
|
+
|
|
177
|
+
### Development rebuild loop
|
|
178
|
+
|
|
179
|
+
Run `bin/hamster dev` after setup. It hashes source/view/config/asset/test files,
|
|
180
|
+
debounces changes, runs fast CRuby syntax checks, regenerates deterministic
|
|
181
|
+
manifests through the build command, compiles Spinel, checks freshness, and starts
|
|
182
|
+
the new executable. The server stops as soon as an edit is observed. Failed
|
|
183
|
+
builds leave it stopped, show compiler diagnostics, and recover on the next edit.
|
|
184
|
+
Changes during compilation trigger another build before any server starts.
|
|
185
|
+
|
|
186
|
+
One build runs at a time; polling uses a bounded interval. Build timings are
|
|
187
|
+
printed after every successful rebuild. Ctrl-C/TERM drains the entire child
|
|
188
|
+
server process group with a deadline, then forces cleanup if necessary. Full
|
|
189
|
+
request/native tests remain explicit (`check --full`); dev reports the checks it
|
|
190
|
+
actually ran. AOT compilation still occurs on edits; no incremental compiler or
|
|
191
|
+
runtime code reloading is promised. Compare reported timings after small action,
|
|
192
|
+
view and route edits on your machine before tuning the loop.
|
|
193
|
+
|
|
194
|
+
### Static application inspection
|
|
195
|
+
|
|
196
|
+
`bin/hamster inspect --json` emits a deterministic versioned graph of routes,
|
|
197
|
+
actions, views, tables/columns, queries, concerns, methods/callbacks and tests.
|
|
198
|
+
Nodes have stable declaration-based IDs and relative source paths/lines; edges
|
|
199
|
+
carry `declared`, `inferred`, or `unknown` certainty. `inspect routes --json` and
|
|
200
|
+
`inspect action posts/create --json` filter the graph. `--check` returns nonzero
|
|
201
|
+
for unresolved callbacks/routes, missing views or declared disabled dependencies;
|
|
202
|
+
these checks also participate in `check --quick`.
|
|
203
|
+
|
|
204
|
+
Inspection parses declarations and manifests without executing application Ruby,
|
|
205
|
+
loading credentials, or connecting to a database. It reports dynamic/unresolved
|
|
206
|
+
references instead of claiming complete Ruby analysis. Test-to-action links use
|
|
207
|
+
generator path conventions and are explicitly inferred. No live DB inspection
|
|
208
|
+
is performed. Graph facts update automatically after renames and new components.
|
|
209
|
+
|
|
210
|
+
### Explicit input forms
|
|
211
|
+
|
|
212
|
+
Subclass `Hamster::Form` and declare literal fields, for example `field :title,
|
|
213
|
+
required: true, max_length: 200`, `field :count, type: :integer`, or `field
|
|
214
|
+
:published, type: :boolean`. Construct it with a Hash of scalar input values.
|
|
215
|
+
`valid?`, field-keyed `errors` and `error_codes`, preserved `values`, and explicit
|
|
216
|
+
`attributes` keep missing, blank, malformed, invalid and unauthorized input
|
|
217
|
+
separate. Invalid forms refuse `attributes`; undeclared fields fail validation.
|
|
218
|
+
Sensitive fields opt into `sensitive: true` and are excluded from preserved values.
|
|
219
|
+
|
|
220
|
+
Optional `model Post, operation: :create` (or `:update`) checks declared column
|
|
221
|
+
flags and write permissions; it never changes or inspects the physical schema.
|
|
222
|
+
Form validation performs no persistence. On invalid submission, construct
|
|
223
|
+
`Hamster::View::Form` with action, explicit csrf_token, values and errors, render
|
|
224
|
+
labels/inputs/error_summary, and return 422 for HTML or Turbo Stream responses.
|
|
225
|
+
Valid writes normally redirect with 303. POST URL-encoded forms may use the
|
|
226
|
+
helper's `_method` field for PATCH/DELETE; other methods cannot be overridden.
|
|
227
|
+
|
|
228
|
+
CSRF token generation/storage belongs to the application's session policy.
|
|
229
|
+
Before processing a mutation, call `context.valid_csrf?(expected_session_token)`
|
|
230
|
+
in an explicit before hook. It requires same-origin metadata and compares the
|
|
231
|
+
submitted form/header token without early per-byte exits. Empty tokens fail.
|
|
232
|
+
The rendering helper escapes tokens, labels, user values and errors; password
|
|
233
|
+
inputs are never repopulated. `csrf_token` and `_method` are reserved control
|
|
234
|
+
fields and are never returned as persistence attributes.
|
|
235
|
+
|
|
236
|
+
`generate form posts/create` creates a `PostsCreateForm` and a compiled
|
|
237
|
+
`forms/posts/create` template taking an explicit `form` local. Customize fields,
|
|
238
|
+
authorized action and CSRF policy, then run manifest/check/test/build.
|
|
239
|
+
|
|
240
|
+
### Compiled components, Turbo and assets
|
|
241
|
+
|
|
242
|
+
Views support literal text, escaped `<%= expression %>`, comments, explicit
|
|
243
|
+
`locals:`, literal-name `render` with explicit locals, conditional/each blocks,
|
|
244
|
+
and named layout slots via `content_for`/`yield`. They are compiled restricted
|
|
245
|
+
ERB, not arbitrary Rails ERB evaluation. Missing references/locals and dependency
|
|
246
|
+
cycles fail before deployment. Use `generate component card` to create a compiled
|
|
247
|
+
`components/card` partial. Pass component content/slots as explicit locals;
|
|
248
|
+
ordinary strings escape, while reviewed `Hamster::HTML` fragments retain markup.
|
|
249
|
+
|
|
250
|
+
`Hamster::Turbo.frame(id, content)` and `.stream(action, target, content)` validate
|
|
251
|
+
DOM identifiers and escape untrusted content. Stream actions are replace, append,
|
|
252
|
+
prepend, remove and update. Respond with `type: :turbo_stream`; use 422 for invalid
|
|
253
|
+
submissions and 303 redirects for successful ordinary HTML forms. Explicit Accept
|
|
254
|
+
order breaks equally specific quality ties, so Turbo's preferred stream type is
|
|
255
|
+
honored while absent/wildcard Accept defaults to HTML.
|
|
256
|
+
|
|
257
|
+
Put CSS, JavaScript and images/fonts in `app/assets/`. Manifest generation writes
|
|
258
|
+
content fingerprints under `public/assets/`, a JSON mapping, and a static native
|
|
259
|
+
registry. Relative ESM imports and CSS URLs are rewritten to fingerprinted URLs;
|
|
260
|
+
missing imports and cycles fail clearly. Use `Hamster::Assets.path("application.css")`
|
|
261
|
+
in compiled views. Only registered fingerprint paths are served, with correct
|
|
262
|
+
MIME, nosniff and immutable caching; arbitrary public files are not exposed.
|
|
263
|
+
The runtime root is `HAMSTER_APP_ROOT` or the working directory. Old fingerprints
|
|
264
|
+
may remain on disk for cached clients; deploy assets with their native binary.
|
|
265
|
+
|
|
266
|
+
Generated apps vendor pinned MIT-licensed Turbo and Stimulus distributions; see
|
|
267
|
+
`app/assets/vendor/VERSIONS.md`. `generate stimulus greeting` registers a controller
|
|
268
|
+
automatically in the generated module registry. `application.js` is the editable
|
|
269
|
+
entrypoint. No Node, npm, Vite or bundler is required for app setup/build/runtime.
|
|
270
|
+
Static relative module imports are the supported default; use an explicit custom
|
|
271
|
+
pipeline if you need npm package resolution or advanced bundling.
|
|
272
|
+
|
|
273
|
+
The framework's `examples/frontend` provides native/browser CRUD acceptance with
|
|
274
|
+
components, forms, escaping, CSRF, Turbo updates, Stimulus and no-JS fallback.
|
|
275
|
+
|
|
276
|
+
### Private attachments and local storage
|
|
277
|
+
|
|
278
|
+
Require `hamster/storage`. `generate attachments storage` creates the explicit
|
|
279
|
+
SQL migration for blob metadata and attachment references; review and migrate
|
|
280
|
+
it separately. Instantiate `Hamster::Storage::Disk` with a private existing
|
|
281
|
+
parent/mounted directory (0700), then `Storage::Attachments.new(database: db,
|
|
282
|
+
adapter: disk)`. Adapters implement `put(io, key:, max_bytes:)`, `open(key)`,
|
|
283
|
+
`delete(key)` and `exists?(key)`; put returns byte_size and SHA-256 checksum.
|
|
284
|
+
Local disk is implemented; object storage is a future optional adapter.
|
|
285
|
+
|
|
286
|
+
Upload with explicit filename/owner, then attach the returned blob ID to a
|
|
287
|
+
record_type/record_id/name with owner and an authorization callback. Storage
|
|
288
|
+
keys are independent random values; client names are display metadata only.
|
|
289
|
+
`open`, `download`, `detach` and `delete` require explicit authorization callbacks
|
|
290
|
+
receiving metadata. Bind identity to authenticated application state, never an
|
|
291
|
+
untrusted request owner parameter. Downloads verify size/checksum, default to
|
|
292
|
+
private attachment/octet-stream/nosniff, and return closeable streaming bodies.
|
|
293
|
+
Never place the storage directory under public/ or fingerprinted app assets.
|
|
294
|
+
|
|
295
|
+
Metadata and files are not one atomic transaction: pending metadata commits
|
|
296
|
+
before file writes, and ready is published only after a completed, flushed disk
|
|
297
|
+
write. Storage uses its own idle DB connections; attach records only after the
|
|
298
|
+
business record commits. Failed uploads remain pending for recovery. Deletion
|
|
299
|
+
locks metadata, refuses shared references, commits deleting state, removes the
|
|
300
|
+
file, then removes metadata. Retries are idempotent; a failed disk deletion
|
|
301
|
+
remains recoverable. Detaching one reference never deletes a shared blob.
|
|
302
|
+
|
|
303
|
+
Run privileged `cleanup(older_than: cutoff, limit: 100)` explicitly with a grace
|
|
304
|
+
period longer than the maximum upload/attachment workflow. It removes old
|
|
305
|
+
unreferenced ready/pending/deleting blobs and rechecks references under lock.
|
|
306
|
+
No async job system is required. Mount the same private persistent volume across
|
|
307
|
+
single-host web restarts and back up metadata and files together. Multiple hosts
|
|
308
|
+
need shared storage/an object adapter; local disk does not provide replication.
|
|
309
|
+
|
|
310
|
+
### Native jobs and bounded asynchronous execution
|
|
311
|
+
|
|
312
|
+
The Active Job portability spike and reuse decision are recorded in the framework's
|
|
313
|
+
`docs/compatibility/active-job.md`. The current native API deliberately accepts a
|
|
314
|
+
single explicit JSON argument hash, not Rails arbitrary arguments or GlobalID.
|
|
315
|
+
|
|
316
|
+
Subclass `Hamster::Job`, declare `job "mail.deliver", version: 1`, and implement
|
|
317
|
+
`perform(arguments, version:)`. Use `perform_now({"id" => 1})` or
|
|
318
|
+
`perform_later({"id" => 1}, metadata: {})`. Payloads are versioned, limited to
|
|
319
|
+
64 KiB and JSON values, and copied across the queue boundary. Declare older
|
|
320
|
+
supported payload versions with `accepts: [1]` when advancing the current version;
|
|
321
|
+
handle the provided version explicitly. `generate job deliver_mail` creates an
|
|
322
|
+
intentionally unimplemented job. Run manifest/build after adding or changing jobs.
|
|
323
|
+
The generated registry calls known job classes directly under Spinel.
|
|
324
|
+
|
|
325
|
+
The default adapter is inline. Configure `Hamster::Jobs::Async.new(threads: 2,
|
|
326
|
+
capacity: 64)` explicitly for bounded in-process execution. Full queues raise
|
|
327
|
+
`Overloaded`; stopped queues reject admission. Worker threads never inherit
|
|
328
|
+
request-scoped DB connections; acquire their own scoped connection inside jobs.
|
|
329
|
+
Failures are isolated and retained in a bounded `failures` list containing only
|
|
330
|
+
job identity and error class, without arguments or exception-message data.
|
|
331
|
+
|
|
332
|
+
Async jobs are ephemeral: restart/crash loses queued or active work. Shutdown
|
|
333
|
+
stops admission and drains to a deadline, then drops pending payloads and returns
|
|
334
|
+
false if user code remains active. Running user code is not killed unsafely;
|
|
335
|
+
its bounded execution slot remains until return or process replacement. Hamster
|
|
336
|
+
application shutdown invokes job shutdown before closing its DB pool. Standalone
|
|
337
|
+
programs must call `Hamster::Jobs.shutdown` themselves. Spinner owns no job pool
|
|
338
|
+
or job lifecycle.
|
|
339
|
+
|
|
340
|
+
For deterministic tests configure `Hamster::Jobs::TestAdapter`, inspect its
|
|
341
|
+
serialized `enqueued` payloads, then call `perform_enqueued` or `clear`. Shut down
|
|
342
|
+
an async adapter before replacing it. The candidate native CI also compiles and
|
|
343
|
+
runs CPU/concurrency/failure probes for jobs and binary disk storage.
|
|
344
|
+
|
|
345
|
+
### Durable PostgreSQL jobs and native workers
|
|
346
|
+
|
|
347
|
+
`generate job_queue queue` creates an explicit queue migration (format version 1)
|
|
348
|
+
and installs a missing worker entrypoint in older apps. Migrate it before serving
|
|
349
|
+
or running workers. Configure `Hamster::Jobs::PostgresQueue.new(database: db)` as
|
|
350
|
+
the web adapter; `perform_later({...}, at: Time.now + 60, queue: "mail", priority: 5)`
|
|
351
|
+
supports scheduling and named queues. Higher priorities run first. Inline/async
|
|
352
|
+
adapters reject scheduling, named queue and connection options.
|
|
353
|
+
|
|
354
|
+
For transaction-consistent enqueueing, pass `connection: context.connection` to
|
|
355
|
+
`perform_later`, or to `queue.enqueue(serialized_payload, connection: connection)`
|
|
356
|
+
inside the same business transaction. The connection's database is verified;
|
|
357
|
+
rollback removes both changes and the job. Otherwise enqueue uses a separate
|
|
358
|
+
checkout/commit; size the web pool accordingly. Reusing the same serialized job
|
|
359
|
+
ID/payload makes uncertain enqueue retries idempotent; conflicting payloads with
|
|
360
|
+
an existing ID are rejected. Do not regenerate IDs when retrying an uncertain
|
|
361
|
+
network result.
|
|
362
|
+
|
|
363
|
+
Run `bin/hamster build:worker`, then `bin/hamster jobs:work` (or `--once`). The
|
|
364
|
+
separate native executable statically links the application's registered jobs.
|
|
365
|
+
It uses an independent pool sized by JOB_DATABASE_POOL_SIZE (default 2*threads+2);
|
|
366
|
+
job bodies acquire their own scoped connection through `Hamster::Jobs.database`.
|
|
367
|
+
WORKER_THREADS defaults to 2 (maximum 64), JOB_QUEUES to default,
|
|
368
|
+
JOB_LEASE_SECONDS to 30, and JOB_DRAIN_SECONDS to 10.
|
|
369
|
+
|
|
370
|
+
Claims use one short `FOR UPDATE SKIP LOCKED`/`UPDATE RETURNING` statement. No
|
|
371
|
+
claim transaction remains open while user code executes. Heartbeats renew leases;
|
|
372
|
+
expired jobs recover after worker death or connection failure. Lease tokens fence
|
|
373
|
+
old acknowledgements, but cannot undo external user-code effects. Delivery is
|
|
374
|
+
**at least once**: jobs must be idempotent. There is no exactly-once guarantee.
|
|
375
|
+
Retries use capped exponential backoff and become dead after max_attempts
|
|
376
|
+
(default 5). Error metadata retains class only, not payloads/messages. Use
|
|
377
|
+
`queue.retry_dead(id)` for explicit retries and `queue.cancel(id)` for cancellation.
|
|
378
|
+
Running cancellation is cooperative (`Hamster::Jobs.cancelled?`); arbitrary user
|
|
379
|
+
code is not safely interrupted. TERM/INT stop admission and drain to a deadline;
|
|
380
|
+
unfinished work remains leased and is recovered after process replacement.
|
|
381
|
+
|
|
382
|
+
`jobs:status --json` reports versioned counts, due/scheduled backlog and oldest
|
|
383
|
+
pending timestamp without disclosing arguments. Queue schema versions are checked
|
|
384
|
+
before processing; migrations never run implicitly. For rolling upgrades deploy
|
|
385
|
+
workers accepting old and new job payload versions before producers emit the new
|
|
386
|
+
version, drain old workers, then retire old handlers in a later deployment.
|
|
387
|
+
|
|
388
|
+
`docker build --target worker -t my_app-jobs .` produces a non-root native worker
|
|
389
|
+
image without Ruby/compiler or an HTTP listener. Keep migrations operational and
|
|
390
|
+
separate. The default Docker target remains the web image. The optional
|
|
391
|
+
`config/deploy.worker.yml.example` uses a separate Kamal 2 service/worker role,
|
|
392
|
+
`builder.target: worker`, and no proxy. Configure its registry, architecture,
|
|
393
|
+
private PostgreSQL and secrets; set container stop timeout longer than drain.
|
|
394
|
+
See [Kamal roles](https://kamal-deploy.org/docs/configuration/roles/) and
|
|
395
|
+
[build targets](https://kamal-deploy.org/docs/configuration/builders/).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module __APP_MODULE__
|
|
3
|
+
class Application < Hamster::Application
|
|
4
|
+
def initialize(routes:, database:)
|
|
5
|
+
super(routes: routes, database: database)
|
|
6
|
+
@liveness_router = Hamster::Router.new(routes)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def call(env)
|
|
10
|
+
# Liveness checks process/HTTP dispatch only, even during a DB outage.
|
|
11
|
+
return @liveness_router.call(env) if env.fetch("PATH_INFO", "/") == "/up"
|
|
12
|
+
super
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Vendored Hotwire distributions
|
|
2
|
+
|
|
3
|
+
No package manager or bundler is needed by the app.
|
|
4
|
+
|
|
5
|
+
- @hotwired/stimulus 3.2.2: https://registry.npmjs.org/@hotwired/stimulus/3.2.2
|
|
6
|
+
SHA-256 of stimulus.js: 23deecdac6f36c08e8f39fbed6b27f60c850cacad3a34eb71194462b7b1647f3
|
|
7
|
+
- @hotwired/turbo 8.0.13: https://registry.npmjs.org/@hotwired/turbo/8.0.13
|
|
8
|
+
SHA-256 of turbo.js: 916651cd4516ee97d13e24323d2013e834b952ef1ffb1a702c2f71b1e81c6bc5
|
|
9
|
+
|
|
10
|
+
Npm tarball SHA-512 integrity values were checked before extraction. Upstream
|
|
11
|
+
MIT license texts are retained beside these files. Update pins and acceptance
|
|
12
|
+
checks deliberately when replacing distributions.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2021 Basecamp, LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
The Software is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.
|