Skip to content

Commit 2ff5b93

Browse files
author
Nils Henning
committed
[WIP][REFACTOR] rework documentation, move heroku deployment to seperate guide, add introduction
1 parent a0bef79 commit 2ff5b93

File tree

3 files changed

+85
-46
lines changed

3 files changed

+85
-46
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Getting Started with Matestack
2+
3+
## Guide Assumptions
4+
5+
* Required knowledge etc
6+
7+
## What is Matestack?
8+
9+
* Ruby Gem for easier development...
10+
* Steal from home page ;P
11+
12+
### Apps
13+
14+
* Konzept von Apps erklären
15+
* Allgemeiner Wrapper mit immer darzustellenden Content
16+
* Gefühl einer App/SinglePageApplication erzeugen ohne den Entwicklungsaufwand
17+
* Eine Webanwendung kann aus mehreren Apps bestehen, gliedern Bereiche der Anwendung
18+
19+
### Pages
20+
21+
* Pages sind wechselnder Content in einer App, was üblicherweise neue Seitenaufrufe sind, sind in Matestack Aufrufe von Pages
22+
* Pages werden in App gerendert und App verändert nicht ihren Zustand, wird nicht neu gerendert
23+
24+
### Core Components
25+
26+
* Core Components teilen sich in zwei Gruppen
27+
* **Components**
28+
* Um UIs vollständig in Ruby zu schreiben existieren für fast alle HTML5 Tags entsprechende Core Components
29+
* Verwendung einfach und fasst immer gleich, für Details in die API Doku der jeweiligen Komponente gucken
30+
* **Vue Components**
31+
* Vue Components sind komplexere Komponenten, welche Funktionalitäten abdecken für die meist Javascript benötigt wird
32+
* Ermöglichen Frontend Features in Ruby Backend Code zu schreiben
33+
34+
### Components
35+
36+
* Selber erstellbare Komponenten um UIs in kleinere Teile aufzubrechen
37+
* Sind wiederverwendbar, bedeutet UI Parts können an verschiedensten Stellen erneut verwendet werden

docs/guides/essential/01_setup.md

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ Welcome to the first part of the 10-step-guide of setting up a working Rails CRU
44
## Introduction
55
In this guide, we will
66
- create a new Rails application
7-
- change it to use `postgresql` and `matestack-ui-core`
7+
- install `matestack-ui-core`
88
- add a simple matestack app and two pages
9-
- deploy the application to Heroku
109

1110
## Prerequisites
1211
To follow along, make sure you have successfully installed
1312
- Ruby (Version > 2.6, [view installation details](https://www.ruby-lang.org))
1413
- RubyOnRails (Version >6.0, [view installation details](https://rubyonrails.org/))
15-
- Heroku CLI ([view installation details](https://devcenter.heroku.com/articles/getting-started-with-ruby#set-up))
1614
- Postgresql ([view installation details](https://devcenter.heroku.com/articles/heroku-postgresql#local-setup))
1715

1816
<details>
@@ -30,7 +28,7 @@ The contents of this article are heavily inspired by [Getting Started on Heroku
3028
In the terminal, create a new Rails app by running
3129

3230
```sh
33-
rails new matestack-demo-application --database=postgresql
31+
rails new matestack-demo-application
3432
```
3533

3634
and switch into the newly created project via
@@ -51,48 +49,13 @@ To make sure things work as expected, you can run
5149
rails s
5250
```
5351

54-
to start the application - visiting [localhost:3000](http://localhost:3000/) now should reveal the canonical **Yay! You're on Rails!** screen!
55-
56-
## Adding Postgres and MatestackUiCore
57-
In the Gemfile, replace the line starting with `gem 'sqlite3'` with `gem 'pg'`.
58-
Make sure to run `bundle install` afterwards and replace the contents of `config/database.yml` with
59-
60-
```yaml
61-
default: &default
62-
adapter: postgresql
63-
encoding: unicode
64-
# For details on connection pooling, see Rails configuration guide
65-
# https://guides.rubyonrails.org/configuring.html#database-pooling
66-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
67-
68-
development:
69-
<<: *default
70-
database: myapp_development
71-
72-
test:
73-
<<: *default
74-
database: myapp_test
75-
76-
production:
77-
<<: *default
78-
database: myapp_production
79-
username: myapp
80-
password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>
81-
```
82-
83-
To install `matestack-ui-core`, add
52+
to start the application. Now visit [localhost:3000](http://localhost:3000/) and you should see the canonical **Yay! You're on Rails!** screen!
8453

85-
```ruby
86-
gem 'matestack-ui-core'
87-
```
54+
## Install Matestack
8855

89-
to your Gemfile and run
90-
91-
```sh
92-
bundle install
93-
```
56+
To install matestack, run `gem install matestack-ui-core` or add `gem 'matestack-ui-core'` to your Gemfile and run `bundle install`.
9457

95-
For a complete setup with Webpacker, you also need to run `yarn add https://github.com/matestack/matestack-ui-core#v0.7.6` followed by `yarn install`.
58+
For a complete setup with Webpacker, you also need to run `yarn add https://github.com/matestack/matestack-ui-core#v1.0.0` followed by `yarn install`.
9659

9760
Then, add
9861

@@ -108,15 +71,15 @@ bin/webpack
10871

10972
to compile your JavaScript code.
11073

111-
In order to complete the `matestack-ui-core` setup, change your `app/controllers/application_controller.rb` to look like this
74+
In order to use matestack complete the setup by including the `Matestack::Ui::Core::ApplicationHelper` in your `ApplicationController`. Your `app/controllers/application_controller.rb` should look like this:
11275

11376
```ruby
11477
class ApplicationController < ActionController::Base
11578
include Matestack::Ui::Core::ApplicationHelper
11679
end
11780
```
11881

119-
and the `app/views/layouts/application.html.erb` to look like this:
82+
And add an element with the id `matestack_ui` to your layout, by changing your `app/views/layouts/application.html.erb`. It should look like this:
12083

12184
```html
12285
<!DOCTYPE html>
@@ -138,7 +101,7 @@ and the `app/views/layouts/application.html.erb` to look like this:
138101
</html>
139102
```
140103

141-
Background: You now can use `matestack` helpers in your controller actions, and your `matestack` apps (and the corresponding pages) get rendered into your application layout!
104+
By including the `Matestack::Ui::Core::ApplicationHelper` and defining a div with the `matestack_ui` id you can now use matestacks render method in your controller actions. Based on the id matestack apps and pages can be rendered and pages can be replaced without a full reload of the browser page.
142105

143106
## Add a demo page
144107
Within your `app` directory, create a directory called `matestack` - this is where `matestack` **apps**, **pages** and, later on, **components**, will live.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Heroku Deployment with Postgres
2+
3+
## Introduction
4+
In this guide, we will
5+
- install and use PostgreSQL instead of SQLite3
6+
- deploy our application to heroku
7+
8+
## Prerequisites
9+
- Heroku CLI ([view installation details](https://devcenter.heroku.com/articles/getting-started-with-ruby#set-up))
10+
- Postgresql ([view installation details](https://devcenter.heroku.com/articles/heroku-postgresql#local-setup))
11+
12+
## Adding Postgres
13+
14+
In the Gemfile, replace the line starting with `gem 'sqlite3'` with `gem 'pg'`.
15+
16+
Make sure to run `bundle install` afterwards and replace the contents of `config/database.yml` with
17+
18+
```yaml
19+
default: &default
20+
adapter: postgresql
21+
encoding: unicode
22+
# For details on connection pooling, see Rails configuration guide
23+
# https://guides.rubyonrails.org/configuring.html#database-pooling
24+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
25+
26+
development:
27+
<<: *default
28+
database: myapp_development
29+
30+
test:
31+
<<: *default
32+
database: myapp_test
33+
34+
production:
35+
<<: *default
36+
database: myapp_production
37+
username: myapp
38+
password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>
39+
```

0 commit comments

Comments
 (0)