c4a3115e9b247260fb1f5252c3f43de97e7da2a7 — Felix Freeman 6 months ago 04d9684
LeanWeb readme on /leanweb/readme.html
2 files changed, 127 insertions(+), 1 deletions(-)

M routes.rb
A src/views/leanweb/readme.md
M routes.rb => routes.rb +4 -1
@@ 1,3 1,6 @@
# frozen_string_literal: true

ROUTES = [{ path: '/' }].freeze
  { path: '/' },
  { path: '/leanweb/readme.html' }

A src/views/leanweb/readme.md => src/views/leanweb/readme.md +123 -0
@@ 0,0 1,123 @@
# LeanWeb

LeanWeb is a minimal hybrid static / dynamic web framework.

LeanWeb is a *very* lean MVC framework on top of
[Rack](https://github.com/rack/rack/) and
[Tilt](https://github.com/rtomayko/tilt) that works for static and dynamic
content alike. The idea is to build static websites first, but not having to
rely on dirty tricks for adding dynamism when needed.

LeanWeb supports every filetype that Tilt supports, when file extension is
unknown text will be treated as ERB. Default installation adds
[HAML](https://haml.info) as dependency, but you can remove it from the Gemfile.

Great support for Org mode files can be achieved by installing the
[tilt-emacs_org](https://git.hacktivista.org/tilt-emacs_org) gem. Notice that
it requires Emacs installed.

## Developing with LeanWeb

### Getting started

Install the `leanweb` gem on your system.

Create a new project with `leanweb new <project-directory>`.

You're ready to go!

- Place your static files on `public/`
- Place your controllers on `src/controllers/` (inheriting from
- Place your views on `src/views/`
- Setup your routes on `routes.rb`, check API documentation to know how
- Setup your Rack middleware on `config.ru`

You can run a development server with `rackup`.

You can setup easily for production or development on a Debian machine with the
script on `contrib/bin/debian_setup.sh`.

### API documentation

API documentation is in YARD, you can access a web version on
<https://leanweb.hacktivista.org>. Specially relevant are docs on
`Route#initialize`, `Controller#render_response`,
`Controller#default_static_action` and `Controller#create_template`.

### Environment variables

- `LEANWEB_ENDPOINT`: Website endpoint, could be useful for emails and Hawese,
  not used by default.
- `LEANWEB_ROOT_PATH`: Defines the route to the project, defaults to current
- `RACK_ENV`: If set to `development`, serves static files and routes too, else
  it will only serve dynamic routes.

#### Hawese (contrib)

Implements payments through a
[Hawese payment](https://git.hackware.cl/hawese-payment) instance.

- `HAWESE_RETURN_URL`: defaults to `LEANWEB_ENDPOINT/checkout`.

#### LeanMail (contrib)

- `SMTP_HOST`: Where to connect to.
- `SMTP_PORT`: Port, optional (default: 25).
- `SMTP_SECURITY`: `tls` or `starttls`, otherwise no encryption, optional.
- `SMTP_USER`: User, optional.
- `SMTP_PASSWORD`: Password, optional.
- `SMTP_FROM`: In the format `Name <user@mail>` or `user@mail`.

### Deployment

Build static files with `rake build_static`. This might be all you need to do
for static websites.

If your website has dynamic routes, serve with `rackup -E deployment`. Then
configure your webserver to serve dynamic routes by listening to port `9292` and
static files on `public/`.

## Contributing

Source code is available on <https://git.hacktivista.org/leanweb>.

Bug reports and patches are welcome on

### Testing

Only tested contributions are accepted.

Run fast tests with `rake test`. Run all tests with `rake test_all`.

### Source based installation

Simply run `rake install` or `rake install:local`.

## Versioning

Currently using a 0.x.y versioning, where:

- x: Introduces breaking changes.
- y: Introduces non-breaking changes.

Once this project reaches version 1 it will follow Semantic Versioning 2.0.0.

## License

LeanWeb is libre software released under the GNU Affero General Public License
version 3 only. It includes "additional permissions" to make it compatible with
a couple of experimental licenses. For more information, refer to the end of the

To comply with license terms, if you modify this software you must prominently
provide the means to access the source code of your version of the software
easily and free of charge to any person that has access to it, even users which
access through a network (i.e. web browser).

Any modification or inclusion of this source code will inherit the same license