Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10 fix builder #12

Merged
merged 33 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ced980f
adds render:for: method
sebastianconcept Jan 20, 2024
14028c0
fixes model, view stt and presenter builders
sebastianconcept Jan 21, 2024
52f476f
fix in targetedSuperclassFor:
sebastianconcept Jan 21, 2024
bc08d36
upgrade SSTemplate dependency
sebastianconcept Jan 23, 2024
40a009b
no real need for RideAPIPresenter nor RideWebApplicationPresenter
sebastianconcept Jan 23, 2024
7c06dd6
package organization
sebastianconcept Jan 23, 2024
bb0a66c
basic readme review
sebastianconcept Jan 23, 2024
fbeeb84
typo
sebastianconcept Jan 23, 2024
2bc0ae0
readme edit
sebastianconcept Jan 23, 2024
128695d
adjusts baselineOf
sebastianconcept Jan 24, 2024
3f347e2
gh action adjust
sebastianconcept Jan 24, 2024
c9a8971
readme edit
sebastianconcept Jan 24, 2024
c8afcbf
fixed render: inLayout: on: for:
sebastianconcept Jan 24, 2024
8c105c7
adjustments in the rendering API
sebastianconcept Jan 24, 2024
1100f24
the CRUD presenters are able to create and edit title in their models
sebastianconcept Jan 28, 2024
a88a004
gh actions adjust
sebastianconcept Feb 8, 2024
8c1607e
adds Pharo 11 to the CI
sebastianconcept Feb 8, 2024
a4ec571
Update README.md
sebastianconcept Feb 10, 2024
106e4e9
readme edit and guides placeholders added
sebastianconcept Feb 11, 2024
703ee7c
edit
sebastianconcept Feb 11, 2024
9af0859
readme edits
sebastianconcept Feb 11, 2024
ad2f378
upgrades STTemplate and Mapless, pinned version of all dependencies
sebastianconcept Feb 17, 2024
153f31d
adds Builder to the default group in the baseline
sebastianconcept Feb 17, 2024
cbb188e
format
sebastianconcept Feb 17, 2024
180ef42
upgrades STTemplate and adjusts builders
sebastianconcept Feb 18, 2024
6e891a8
template fix
sebastianconcept Feb 18, 2024
bd52aea
template edit
sebastianconcept Feb 18, 2024
716c4d5
updating by following the formAction
sebastianconcept Feb 18, 2024
7c880a1
adjusting create action
sebastianconcept Feb 18, 2024
c03bb4d
reconsidering design of the builder for CRUD
sebastianconcept Feb 18, 2024
16a0689
readme edit
sebastianconcept Feb 18, 2024
02b7889
crud working
sebastianconcept Feb 19, 2024
0f4cc01
Merge 16a0689bd1d1fbc6d49fb98838c1aca17a004afa
sebastianconcept Feb 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unit Tests

on: [push]

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
smalltalk: [Pharo64-10, Pharo64-11]
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v2
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}
- name: Load Image and Run Tests
run: smalltalkci -s ${{ matrix.smalltalk }} .smalltalkci/.unit-tests.ston
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 15
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: ${{matrix.os}}-${{matrix.smalltalk}}
token: ${{ secrets.CODECOV_TOKEN }}
13 changes: 13 additions & 0 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'Ride',
#directory : '',
#load : [ 'Core',
'Tests'
],
#platforms : [ #pharo
]
}
]
}
16 changes: 16 additions & 0 deletions .smalltalkci/.unit-tests.ston
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'Ride',
#directory : '../',
#load : [ 'Core', 'Tests' ],
#platforms : [ #pharo ]
}
],
#testing : {
#coverage : {
#packages : [ 'Ride', 'Ride-Builder', 'Ride-Pharo' ],
#format: #lcov
}
}
}
3 changes: 3 additions & 0 deletions AddAuthToYourRideBasedWebApplication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add auth to your Ride-based web application

To be done.
19 changes: 10 additions & 9 deletions BaselineOfRide/BaselineOfRide.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ Class {
BaselineOfRide >> baseline: spec [

<baseline>
spec for: #common do: [
spec for: #common do: [
self setUpDependencies: spec.
self setUpPackages: spec.
spec
group: 'Core' with: #( 'Ride' );
group: 'Builder' with: #( 'Ride-Builder' );
group: 'Tests' with: #( 'Ride-Tests' );
group: 'Examples' with: #( 'Ride-Examples' );
group: 'Tools' with: #( 'Ride-Tools' );
group: 'default' with: #( 'Core' ) ]
group: 'default' with: #( 'Core' 'Builder' ) ]
]

{ #category : #actions }
Expand All @@ -39,7 +38,7 @@ BaselineOfRide >> mapless: spec [
spec baseline: 'Mapless' with: [
spec
repository:
'github://sebastianconcept/Mapless:v0.6.0/src';
'github://sebastianconcept/Mapless:v0.7.0/src';
loads: #( 'Core' 'Memory' 'SQLite' ) ]
]

Expand Down Expand Up @@ -77,9 +76,11 @@ BaselineOfRide >> setUpPackages: spec [
'Mapless' 'SingularizePluralize' 'STTemplate' ) ].

spec package: 'Ride-Builder' with: [ spec requires: #( 'Ride' ) ].
spec package: 'Ride-Tests' with: [ spec requires: #( 'Ride' ) ].
spec
package: 'Ride-Tests'
with: [ spec requires: #( 'Ride' ) ].
spec package: 'Ride-Examples' with: [ spec requires: #( 'Ride' ) ].
spec package: 'Ride-Tools' with: [ spec requires: #( 'Ride' ) ]
spec package: 'Ride-Tests' with: [ spec requires: #( 'Ride' ) ]
]

{ #category : #dependencies }
Expand All @@ -96,7 +97,7 @@ BaselineOfRide >> sst: spec [

spec baseline: 'STTemplate' with: [
spec
repository: 'github://sebastianconcept/STTemplate:v0.0.3';
repository: 'github://sebastianconcept/STTemplate:v0.2.0';
loads: #( 'Core' ) ]
]

Expand All @@ -105,7 +106,7 @@ BaselineOfRide >> teapot: spec [

spec baseline: 'Teapot' with: [
spec
repository: 'github://zeroflag/Teapot/source';
repository: 'github://zeroflag/Teapot:v2.7.0/source';
loads: #( 'Deployment' ) ]
]

Expand All @@ -114,6 +115,6 @@ BaselineOfRide >> zinc: spec [

spec baseline: 'ZincHTTPComponents' with: [
spec
repository: 'github://svenvc/zinc/repository';
repository: 'github://svenvc/zinc:v5/repository';
loads: #( 'default' 'WebSocket' ) ]
]
3 changes: 3 additions & 0 deletions BuildingATwitterLikeApplicationWithRide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Building a Twitter like application with Ride

To be done.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Jan 23, 2024
===================================
- Added smalltalkCI
- Added Codecov
- Added which Pharo versions are supported (currently only Pharo10)

Jan 2, 2024
===================================
- Added more extensions to `BockClosure` based on `logLevel:` so the application can log content that will be computed only if the log level is allowing that. This is specially convenient for cases when you want to do some handy but costly log in debug mode: `[ 'Prints only when LOGLEVEL=#DEBUG' ] logDebug`.
Expand Down
3 changes: 3 additions & 0 deletions DeployingYourRideBasedWebApplicationOnTheCloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Deploying your Ride-based web application on the cloud

To be done.
3 changes: 3 additions & 0 deletions MakeABlogWithCommentsUsingRideInEightMinutes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Make Blog with comments using Ride in 8 minutes

To be done.
168 changes: 131 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,166 @@
# Ride

The Smalltalk web application framework with productivity as a feature.

### Install in a Pharo image
[![Release](https://img.shields.io/github/v/tag/sebastianconcept/ride?label=release)](https://github.com/sebastianconcept/ride/releases)
[![Unit Tests](https://github.com/sebastianconcept/ride/actions/workflows/build.yml/badge.svg)](https://github.com/sebastianconcept/ride/actions/workflows/build.yml)

Essential core:
[![Coverage Status](https://codecov.io/github/sebastianconcept/ride/coverage.svg?branch=main)](https://codecov.io/gh/sebastianconcept/ride/branch/master)

```Smalltalk
Metacello new
baseline: 'Ride';
repository: 'github://sebastianconcept/ride';
load.
[![Pharo 11](https://img.shields.io/badge/Pharo-11-%23383932.svg)](https://pharo.org/download)
[![Pharo 10](https://img.shields.io/badge/Pharo-10-%23383932.svg)](https://pharo.org/download)

[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE.txt)
[![Social](https://img.shields.io/github/stars/sebastianconcept/ride?style=social)]()

[![Commits](https://img.shields.io/github/commit-activity/m/sebastianconcept/ride)](https://github.com/sebastianconcept/ride/graphs/commit-activity)

## Features

- MVP - Model-View-Presenter architecture.
- Declarative routing.
- Multiple View options for rendering HTML, JSON, XML and more.
- Default Views based in smart efficient templates using [STTemplate](https://github.com/sebastianconcept/STTemplate).
- Versatile and comfortable persistence without lock-in using [Mapless](https://github.com/sebastianconcept/Mapless).
- Intuitive conventions.
- Made with scalability and performance in mind.
- [RESTful](https://restfulapi.net/).
- Builder to scaffold useful code fast.
- ~~Basic validation~~. To be done.
- Optional custom JavaScript for presenters.
- AJAX via [htmx](https://htmx.org/).
- ~~Able to deploy containerized from day one~~. To be done.

---

1. [Description](#description)
2. [Examples](#examples)
3. [Hello World](#hello-world)
4. [Install](#install)
5. [Guides](#guides)
6. [Talks](#talks)

## Description

Ride is a framework designed for building Web Applications and [RESTful](https://restfulapi.net/) APIs, optimizing for developer productivity while preserving production efficiency and scalability. Ride focuses on eliminating the hurdles to quickly build and deploy real projects without compromising your architecture's ability to scale in production.

It comes equipped with a builder that streamlines the process of scaffolding models, views, presenters, [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations and their unit tests for the models you need. Ride removes many technical obstacles, allowing you to progress rapidly in your application development journey from proof of concept and startup product to a growing business.

## Install

#### Fetch a fresh Pharo image

```
mkdir my-ride-app
cd my-ride-app
curl get.pharo.org/64/100 | bash
curl get.pharo.org/64/vm100 | bash
```

All optionals:
And run it

```
./pharo-ui Pharo.image
```

#### Install Ride in it

```Smalltalk
Metacello new
baseline: 'Ride';
repository: 'github://sebastianconcept/ride';
load: #('Core' 'Examples' 'Tools').
onConflict: [ :ex | ex useIncoming ];
load.
```

### Snippets
Handy to start stop the Ride in the Welcome example app:
## Examples

```Smalltalk
"Stop anything Ride that is currently running in the image and reset caches"
Ride stop; reset.

RideWelcomeApp install.
"A Ride-based application has its own helper RideService subclass. Like BlogApp in this example:"

"Install BlogApp as the Ride service"
BlogApp install.

Ride stop.
Ride start.
"Start and stop the service"
BlogApp start.
BlogApp stop.

Ride restart.
"Service restart"
BlogApp restart.
```

### Enhancing developer productivity
Ride offers you a convenient way to quickly draft the basic elements needed for implementing a feature based in a new model. For example, given a CoffeeSystem web application a new `CoffeeInvoice` model, you could:
#### Enhanced developer productivity

Ride offers you a convenient way to quickly create the basic elements needed for implementing basic operations in a new model. For example, given a `Blog` web application to publish `Post` and `Comment` models, you could find the following snippets helpful for pushing useful things fast:

```smalltalk
"Set the default package that will be the destination of the generated code"
Ride draft defaultPackageName: 'CoffeeSystem'.
"Set the default package name that will be the destination
of the code generated by Ride's builder"
Ride create app setPackageNameTo: #Blog.

"Create a RideModel subclass CoffeeInvoice used as app domain state"
Ride draft model for: #CoffeeInvoice.
"Create the foundational Smalltalk code and files
of the project using the given root word 'Blog' "
Ride create app for: #Blog.

"Create a RidePresenter subclass CoffeeInvoicePresenter"
Ride draft presenter for: #CoffeeInvoice.
"Create the Smalltalk code and files for having
basic CRUD features in a model named `Post`"
Ride create mvp crud for: #Post.

"Create the template templates/views/coffee_invoices/index.mustache"
Ride draft view mustache for: #CoffeeInvoice.
"Same for a model named `Comment`"
Ride create mvp crud for: #Comment.
```

## MVP
#### MVP

Ride also can help you create the raw elements of the Model-View-Presenter code separately for a given model:

```smalltalk
"Create the model and presenter classes and STTemplate file at
`views/templates/posts/index.html.stt` for Post"
Ride create mvp for: #Post.

"Same as before but PostsPresenter loads custom JavaScript"
Ride create mvp withJs for: #Post.
```

Using these basic code generators, Ride also can create the elemental Model-View-Presenter code for a given model:
Or even as its individual parts:

```smalltalk
"Create the model and presenter classes and mustache template file for CoffeeInvoice"
Ride draft mvp for: #CoffeeInvoice.
"Create a RideModel subclass Subscription used to
store people subscribed to the blog."
Ride create model for: #Subscription.

"Same as before but CoffeeInvoicePresenter loads custom JavaScript"
Ride draft mvp withJs for: #CoffeeInvoice.
"Create a RidePresenter subclass SubscriptionPresenter"
Ride create presenter for: #Subscription.

"Have an unstyled but functioning CRUD for the CoffeeInvoice models based on MVP"
Ride draft mvp crud for: #CoffeeInvoice.
"Create the template correponding to Subscription at
templates/views/subscriptions/index.stt"
Ride create view stt for: #Subscription.
```

## API
If you need an API and you like to keep concerns organized with MVC, this is how you can generate its boilerplate code:
#### API

If you need an API and you like to keep concerns organized with MVP, this is how you can generate its boilerplate code:

```smalltalk
Ride draft api crud for: #CoffeeInvoice.
```
Ride create api crud for: #Post.
```

## Guides

- [Make a Blog with comments using Ride in 8 minutes](./MakeABlogWithCommentsUsingRideInEightMinutes.md).
- [Building a Twitter like application with Ride](./BuildingATwitterLikeApplicationWithRide.md).
- [Ride-based SaaS template](./RideBasedSaaSTemplate.md).
- [Add auth to your Ride-based web application](AddAuthToYourRideBasedWebApplication.md).
- [Deploying your Ride-based web application on the cloud](DeployingYourRideBasedWebApplicationOnTheCloud.md).

## Talks

Ride was presented for the first time at [Smalltalks 2023](https://smalltalks2023.fast.org.ar/) organized by [F.A.S.T.](https://www.fast.org.ar/) at [Universidad Nacional de Quilmes](https://www.unq.edu.ar/).

#### November 2023

[RAD with templates, htmx and stateless Smalltalk images by Sebastian Sastre](https://www.youtube.com/watch?v=4_gmvN0pimI)
8 changes: 0 additions & 8 deletions Ride-Builder/RideAPICRUDHelper.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,3 @@ Class {
#superclass : #RideCRUDHelper,
#category : #'Ride-Builder'
}

{ #category : #'instance creation' }
RideAPICRUDHelper >> for: aSymbol [

super for: aSymbol.
doer presenter for: aSymbol.
self addCRUDMethodsTo: (self presenterForModel: aSymbol) for: aSymbol
]
2 changes: 1 addition & 1 deletion Ride-Builder/RideAPIHelper.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Class {
RideAPIHelper >> crud [

^ RideAPICRUDHelper new
doer: doer;
doer: builder;
yourself
]

Expand Down
6 changes: 6 additions & 0 deletions Ride-Builder/RideAbstractTemplateHelper.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Class {
#category : #'Ride-Builder'
}

{ #category : #accessing }
RideAbstractTemplateHelper class >> getPathFor: aSymbol [

^ Ride resource viewsDirectory / aSymbol asSnakeCase
]

{ #category : #initialization }
RideAbstractTemplateHelper >> initialize [

Expand Down
Loading
Loading